From unknown Sun Jun 22 03:56:12 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#50475 <50475@debbugs.gnu.org> To: bug#50475 <50475@debbugs.gnu.org> Subject: Status: [PATCH] etc: committer: Amend previous commit if a copyright line was added. Reply-To: bug#50475 <50475@debbugs.gnu.org> Date: Sun, 22 Jun 2025 10:56:12 +0000 retitle 50475 [PATCH] etc: committer: Amend previous commit if a copyright = line was added. reassign 50475 guix-patches submitter 50475 Xinglu Chen severity 50475 normal tag 50475 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 08 09:45:56 2021 Received: (at submit) by debbugs.gnu.org; 8 Sep 2021 13:45:56 +0000 Received: from localhost ([127.0.0.1]:59045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNxtk-0005Yn-5J for submit@debbugs.gnu.org; Wed, 08 Sep 2021 09:45:56 -0400 Received: from lists.gnu.org ([209.51.188.17]:34548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNxtg-0005Yb-Mb for submit@debbugs.gnu.org; Wed, 08 Sep 2021 09:45:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNxtg-0003Pq-9V for guix-patches@gnu.org; Wed, 08 Sep 2021 09:45:52 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:40894 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNxta-0002mB-Fo for guix-patches@gnu.org; Wed, 08 Sep 2021 09:45:52 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1631108740; bh=uFvCbM53TSFbCIEe/a96YcYsd8EsLsi52rNBd7A3+rc=; h=From:To:Subject:Date; b=gvkb0tIFX6pO8OZ8VZTH0ZtwJnw6jrKPTqHFUepjqQ2AmdaBXCXDS62Uwya5IMJw/ PSOHoij+q1pIuTxtnQPy6vltdFe67E+idVkBjrn+8p8/QT/Ii1vLxxk6gwbpJNT/vg LN2R1a2ahrfuiJ7+SB/Vcdgc7v2RuTBOZ3srlY2U= To: guix-patches@gnu.org Subject: [PATCH] etc: committer: Amend previous commit if a copyright line was added. Message-Id: <2e705537217d97d7fdc5070a3897dd68d68f0807.1631108277.git.public@yoctocell.xyz> Date: Wed, 08 Sep 2021 15:45:39 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 28 X-Spam_score: 2.8 X-Spam_bar: ++ X-Spam_report: (2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=1.423, PDS_OTHER_BAD_TLD=1.999, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.7 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Previously, the script would raise an error if a copyright line was added to a file in gnu/packages/. With this change, it will amend the previous commit whenever a copyright line is added, and add th [...] Content analysis details: (1.7 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.51.188.17 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 0.5 FROM_SUSPICIOUS_NTLD_FP From abused NTLD 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Previously, the script would raise an error if a copyright line was added t= o a file in gnu/packages/. With this change, it will amend the previous commit whenever a copyright line is added, and add the copyright line to the commi= t. * etc/committer.scm.in (add-copyright-line): New procedure. (main): Check if a copyright line was added and call =E2=80=98add-copyright= -line=E2=80=99 if necessary. --- Before, you would get an error when a copyright line was added. This might also make people think that the previous commits were not successful, at least I did the first time this happened. --8<---------------cut here---------------start------------->8--- $ ./etc/committer.scm gnu: Add emacs-nasm-mode. * gnu/packages/emacs-xyz.scm (emacs-nasm-mode): New variable. [master bbe52033d7] gnu: Add emacs-nasm-mode. 1 file changed, 23 insertions(+) Backtrace: 5 (primitive-load "/home/yoctocell/src/guix-local/./etc/committe= r.scm") In srfi/srfi-1.scm: 634:9 4 (for-each # ((#f #f #< fi=E2=80=A6>))) In ice-9/eval.scm: 619:8 3 (_ #(#(#(#(#(#(#(#(#(# #)= (=E2=80=A6)) #) #) =E2=80=A6) #) =E2=80=A6) #) #)) 619:8 2 (_ #(#(#(#) "gnu/packages= /emacs-xyz.scm" #f #f =E2=80=A6) =E2=80=A6)) 626:19 1 (_ #(#(#(#) "gnu/packages= /emacs-xyz.scm" #f #f =E2=80=A6) =E2=80=A6)) In unknown file: 0 (cadr #f) ERROR: In procedure cadr: In procedure cadr: Wrong type (expecting pair): #f --8<---------------cut here---------------end--------------->8--- With the patch, you get --8<---------------cut here---------------start------------->8--- $ ./etc/committer.scm gnu: Add emacs-nasm-mode. * gnu/packages/emacs-xyz.scm (emacs-nasm-mode): New variable. [master d662741368] gnu: Add emacs-nasm-mode. 1 file changed, 23 insertions(+) Amend and add copyright line for Xinglu Chen [master 024095ccd6] gnu: Add emacs-nasm-mode. Date: Wed Sep 8 15:39:12 2021 +0200 1 file changed, 24 insertions(+) --8<---------------cut here---------------end--------------->8--- etc/committer.scm.in | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/etc/committer.scm.in b/etc/committer.scm.in index e81ce16611..1ad83e37d7 100755 --- a/etc/committer.scm.in +++ b/etc/committer.scm.in @@ -5,6 +5,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2020, 2021 Ricardo Wurmus ;;; Copyright =C2=A9 2021 Sarah Morgensen +;;; Copyright =C2=A9 2021 Xinglu Chen ;;; ;;; This file is part of GNU Guix. ;;; @@ -288,6 +289,15 @@ ChangeLog entry." (break-string-with-newlines message/f 72) (break-string-with-newlines changelog/f 72)))) =20 +(define (add-copyright-line line) + "Add the copyright line on LINE to the previous commit." + (let ((author (match:substring + (string-match "^\\+;;; Copyright =C2=A9[^[:alpha:]]+(.*)$= " line) + 1))) + (format + (current-output-port) "Amend and add copyright line for ~a~%" author) + (system* "git" "commit" "--amend" "--no-edit"))) + (define (group-hunks-by-sexp hunks) "Return a list of pairs associating all hunks with the S-expression they= are modifying." @@ -370,15 +380,23 @@ modifying." (error "Cannot apply"))) (usleep %delay)) hunks) - (change-commit-message* (hunk-file-name (first hunks)) - old new) - (let ((port (open-pipe* OPEN_WRITE "git" "commit" "-F"= "-"))) + (define copyright-line + (any (lambda (line) (and=3D> (string-prefix? "+;;; C= opyright =C2=A9" line) + (const line))) + (hunk-diff-lines (first hunks)))) + (cond + (copyright-line + (add-copyright-line copyright-line)) + (else + (let ((port (open-pipe* OPEN_WRITE "git" "commit" "-= F" "-"))) + (change-commit-message* (hunk-file-name (first hun= ks)) + old new) (change-commit-message* (hunk-file-name (first hunks= )) old new port) (usleep %delay) (unless (eqv? 0 (status:exit-val (close-pipe port))) - (error "Cannot commit"))))) + (error "Cannot commit"))))))) ;; XXX: we recompute the hunks here because previous ;; insertions lead to offsets. (new+old+hunks (diff-info))))))) base-commit: 5c5e9d4e50af20042947b6b55e462a25b9d8cfc7 --=20 2.33.0 From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 21 08:48:17 2021 Received: (at 50475-done) by debbugs.gnu.org; 21 Sep 2021 12:48:17 +0000 Received: from localhost ([127.0.0.1]:45218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSfC5-00028N-0X for submit@debbugs.gnu.org; Tue, 21 Sep 2021 08:48:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50526) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSfC4-00028B-04 for 50475-done@debbugs.gnu.org; Tue, 21 Sep 2021 08:48:16 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48296) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSfBx-0002zw-CU; Tue, 21 Sep 2021 08:48:09 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=47302 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSfBx-0000cY-3m; Tue, 21 Sep 2021 08:48:09 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Xinglu Chen Subject: Re: bug#50475: [PATCH] etc: committer: Amend previous commit if a copyright line was added. References: <2e705537217d97d7fdc5070a3897dd68d68f0807.1631108277.git.public@yoctocell.xyz> Date: Tue, 21 Sep 2021 14:48:07 +0200 In-Reply-To: <2e705537217d97d7fdc5070a3897dd68d68f0807.1631108277.git.public@yoctocell.xyz> (Xinglu Chen's message of "Wed, 08 Sep 2021 15:45:39 +0200") Message-ID: <87o88mksc8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.3 (/) X-Debbugs-Envelope-To: 50475-done Cc: 50475-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) Hi, Xinglu Chen skribis: > Previously, the script would raise an error if a copyright line was added= to a > file in gnu/packages/. With this change, it will amend the previous comm= it > whenever a copyright line is added, and add the copyright line to the com= mit. > > * etc/committer.scm.in (add-copyright-line): New procedure. > (main): Check if a copyright line was added and call =E2=80=98add-copyrig= ht-line=E2=80=99 if > necessary. Nice, committed! Thanks, Ludo=E2=80=99. From unknown Sun Jun 22 03:56:12 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 20 Oct 2021 11:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator