Package: mumi;
Reported by: Giovanni Biscuolo <g <at> xelera.eu>
Date: Sat, 16 Sep 2023 09:38:02 UTC
Owned by: Giovanni Biscuolo <g <at> xelera.eu>
Severity: wishlist
Tags: help, moreinfo, notabug
To reply to this bug, email your comments to 66027 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-guix <at> gnu.org
:bug#66027
; Package guix
.
(Sat, 16 Sep 2023 09:38:02 GMT) Full text and rfc822 format available.Giovanni Biscuolo <g <at> xelera.eu>
:bug-guix <at> gnu.org
.
(Sat, 16 Sep 2023 09:38:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Giovanni Biscuolo <g <at> xelera.eu> To: bug-guix <at> gnu.org Subject: Add a feature to automatically close specified bug reports upon committing. Date: Sat, 16 Sep 2023 11:37:25 +0200
[Message part 1 (text/plain, inline)]
Hello, following a (lengthy) discussion on guix-devel [1] I propose to add the new feature to our currently used server side post-receive git hook. Some details about the implementation have been discussed with other interested persons in [1] and I'll try to summarize them in this thread Soon™. To complete this feature request (wishlist) we need: 1. code implementation in the git hook _and_ testing 2. documentation ("Contributing" section) 3. installation on out git server I'm going to take ownership of this bug (wishlist) but I'm not able to do it on my own because I miss some info and authorization on the server side. (to be continued...) Happy hacking! Gio' [1] https://yhetil.org/guix/8734zrn1sc.fsf <at> xelera.eu/ -- Giovanni Biscuolo Xelera IT Infrastructures
[signature.asc (application/pgp-signature, inline)]
Giovanni Biscuolo <g <at> xelera.eu>
to control <at> debbugs.gnu.org
.
(Sat, 16 Sep 2023 12:40:01 GMT) Full text and rfc822 format available.Giovanni Biscuolo <g <at> xelera.eu>
to control <at> debbugs.gnu.org
.
(Sat, 16 Sep 2023 12:40:01 GMT) Full text and rfc822 format available.Giovanni Biscuolo <g <at> xelera.eu>
to control <at> debbugs.gnu.org
.
(Sat, 16 Sep 2023 12:48:02 GMT) Full text and rfc822 format available.g <at> xelera.eu, bug-guix <at> gnu.org, Giovanni Biscuolo <g <at> xelera.eu>
:bug#66027
; Package guix
.
(Sun, 08 Oct 2023 17:00:02 GMT) Full text and rfc822 format available.Message #14 received at 66027 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 66027 <at> debbugs.gnu.org Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Simon Tournier <zimon.toutoune <at> gmail.com>, Vagrant Cascadian <vagrant <at> debian.org>, g <at> xelera.eu, ludo <at> gnu.org, Christopher Baines <mail <at> cbaines.net>, Liliana Marie Prikler <liliana.prikler <at> gmail.com> Subject: [PATCH] build: Add a commit-msg hook that embeds Change-Id in commit messages. Date: Sun, 8 Oct 2023 12:58:22 -0400
Partially implements <https://issues.guix.gnu.org/66027>. This will make it possible to track a merged commit back to its original posting on the mailing list, and open the door to new opportunities such as closing fully merged series automatically. * Makefile.am (COMMIT_MSG_MAGIC): New variable. (.git/hooks/commit-msg): New target. * etc/git/commit-msg: New file. * doc/contributing.texi (Configuring Git): Document Change-Id. Change-Id: Ia92fa958eae600fdd4e180bad494c85db8bb4dd6 --- Makefile.am | 12 +++++- doc/contributing.texi | 10 ++++- etc/git/commit-msg | 92 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100755 etc/git/commit-msg diff --git a/Makefile.am b/Makefile.am index 310a231259..b860af7258 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1172,7 +1172,17 @@ cuirass-jobs: $(GOBJECTS) git config --add include.path ../etc/git/gitconfig; \ fi -nodist_noinst_DATA = .git/hooks/pre-push .git/config +COMMIT_MSG_MAGIC = VGhpcyBpcyB0aGUgY29tbWl0LW1zZyBob29rIG9mIEd1aXg= +.git/hooks/commit-msg: etc/git/commit-msg + $(AM_V_at)if test -d .git; then \ + if test -f $@ && ! grep -qF $(COMMIT_MSG_MAGIC) $@; then \ + mkdir -p $@.d && mv $@ $@.d && \ + @ echo user commit-msg hook moved to $@.d/commit-msg; \ + fi; \ + cp etc/git/commit-msg $@; \ + fi + +nodist_noinst_DATA = .git/hooks/pre-push .git/config .git/hooks/commit-msg # Downloading up-to-date PO files. diff --git a/doc/contributing.texi b/doc/contributing.texi index 864190b119..778bfb8fe6 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -1575,8 +1575,16 @@ Configuring Git use @command{git config --local}, or edit @file{.git/config} in the repository instead of @file{~/.gitconfig}. +@cindex commit-msg hook Other important Git configuration will automatically be configured when -building the project (@pxref{Building from Git}). +building the project (@pxref{Building from Git}). A +@file{.git/hooks/commit-msg} hook will be installed that embeds +@samp{Change-Id} Git @emph{trailers} in your commit messages for +traceability purposes. It is important to preserve these when editing +your commit messages, particularly if a first version of your proposed +changes was already published. If you have a @file{commit-msg} hook of +your own you would like to use with Guix, you can place it under the +@file{.git/hooks/commit-msg.d/} directory. @node Sending a Patch Series @subsection Sending a Patch Series diff --git a/etc/git/commit-msg b/etc/git/commit-msg new file mode 100755 index 0000000000..0826f3a56e --- /dev/null +++ b/etc/git/commit-msg @@ -0,0 +1,92 @@ +#!/bin/sh +# From Gerrit Code Review 3.6.1 +# +# Part of Gerrit Code Review (https://www.gerritcodereview.com/) +# +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +### Guix modifications start +COMMIT_MSG_MAGIC=VGhpcyBpcyB0aGUgY29tbWl0LW1zZyBob29rIG9mIEd1aXg= +top=$(git rev-parse --show-toplevel) +for msg_hook in "$top/.git/hooks/commit-msg.d/"*; do + if ! sh "$msg_hook"; then + echo "error while running $msg_hook" + exit 1 + fi +done +### Guix modifications end + +set -u + +# avoid [[ which is not POSIX sh. +if test "$#" != 1 ; then + echo "$0 requires an argument." + exit 1 +fi + +if test ! -f "$1" ; then + echo "file does not exist: $1" + exit 1 +fi + +# Do not create a change id if requested +if test "false" = "$(git config --bool --get gerrit.createChangeId)" ; then + exit 0 +fi + +if git rev-parse --verify HEAD >/dev/null 2>&1; then + refhash="$(git rev-parse HEAD)" +else + refhash="$(git hash-object -t tree /dev/null)" +fi + +random=$({ git var GIT_COMMITTER_IDENT ; echo "$refhash" ; cat "$1"; } | git hash-object --stdin) +dest="$1.tmp.${random}" + +trap 'rm -f "${dest}"' EXIT + +if ! git stripspace --strip-comments < "$1" > "${dest}" ; then + echo "cannot strip comments from $1" + exit 1 +fi + +if test ! -s "${dest}" ; then + echo "file is empty: $1" + exit 1 +fi + +reviewurl="$(git config --get gerrit.reviewUrl)" +if test -n "${reviewurl}" ; then + if ! git interpret-trailers --parse < "$1" | grep -q '^Link:.*/id/I[0-9a-f]\{40\}$' ; then + if ! git interpret-trailers \ + --trailer "Link: ${reviewurl%/}/id/I${random}" < "$1" > "${dest}" ; then + echo "cannot insert link footer in $1" + exit 1 + fi + fi +else + # Avoid the --in-place option which only appeared in Git 2.8 + # Avoid the --if-exists option which only appeared in Git 2.15 + if ! git -c trailer.ifexists=doNothing interpret-trailers \ + --trailer "Change-Id: I${random}" < "$1" > "${dest}" ; then + echo "cannot insert change-id line in $1" + exit 1 + fi +fi + +if ! mv "${dest}" "$1" ; then + echo "cannot mv ${dest} to $1" + exit 1 +fi base-commit: 9b77bd0b9b4f3de69390da0ba7db5b9dbc01e554 -- 2.41.0
g <at> xelera.eu, maxim.cournoyer <at> gmail.com, bug-guix <at> gnu.org, Giovanni Biscuolo <g <at> xelera.eu>
:bug#66027
; Package guix
.
(Mon, 09 Oct 2023 15:06:02 GMT) Full text and rfc822 format available.Message #17 received at 66027 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 66027 <at> debbugs.gnu.org Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Subject: [PATCH v2] build: Add a commit-msg hook that embeds Change-Id in commit messages. Date: Mon, 9 Oct 2023 11:03:52 -0400
Partially implements <https://issues.guix.gnu.org/66027>. This will make it possible to track a merged commit back to its original posting on the mailing list, and open the door to new opportunities such as closing fully merged series automatically. * Makefile.am (COMMIT_MSG_MAGIC): New variable. (.git/hooks/commit-msg): New target. * etc/git/commit-msg: New file. * doc/contributing.texi (Configuring Git): Document Change-Id. Change-Id: Ia92fa958eae600fdd4e180bad494c85db8bb4dd6 --- Changes in v2: * Guard against nonexistant .git/hooks/commit-msg.d in commit-msg hook Makefile.am | 12 +++++- doc/contributing.texi | 10 ++++- etc/git/commit-msg | 94 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 2 deletions(-) create mode 100755 etc/git/commit-msg diff --git a/Makefile.am b/Makefile.am index 310a231259..b860af7258 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1172,7 +1172,17 @@ cuirass-jobs: $(GOBJECTS) git config --add include.path ../etc/git/gitconfig; \ fi -nodist_noinst_DATA = .git/hooks/pre-push .git/config +COMMIT_MSG_MAGIC = VGhpcyBpcyB0aGUgY29tbWl0LW1zZyBob29rIG9mIEd1aXg= +.git/hooks/commit-msg: etc/git/commit-msg + $(AM_V_at)if test -d .git; then \ + if test -f $@ && ! grep -qF $(COMMIT_MSG_MAGIC) $@; then \ + mkdir -p $@.d && mv $@ $@.d && \ + @ echo user commit-msg hook moved to $@.d/commit-msg; \ + fi; \ + cp etc/git/commit-msg $@; \ + fi + +nodist_noinst_DATA = .git/hooks/pre-push .git/config .git/hooks/commit-msg # Downloading up-to-date PO files. diff --git a/doc/contributing.texi b/doc/contributing.texi index 864190b119..778bfb8fe6 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -1575,8 +1575,16 @@ Configuring Git use @command{git config --local}, or edit @file{.git/config} in the repository instead of @file{~/.gitconfig}. +@cindex commit-msg hook Other important Git configuration will automatically be configured when -building the project (@pxref{Building from Git}). +building the project (@pxref{Building from Git}). A +@file{.git/hooks/commit-msg} hook will be installed that embeds +@samp{Change-Id} Git @emph{trailers} in your commit messages for +traceability purposes. It is important to preserve these when editing +your commit messages, particularly if a first version of your proposed +changes was already published. If you have a @file{commit-msg} hook of +your own you would like to use with Guix, you can place it under the +@file{.git/hooks/commit-msg.d/} directory. @node Sending a Patch Series @subsection Sending a Patch Series diff --git a/etc/git/commit-msg b/etc/git/commit-msg new file mode 100755 index 0000000000..dfa07918bb --- /dev/null +++ b/etc/git/commit-msg @@ -0,0 +1,94 @@ +#!/bin/sh +# From Gerrit Code Review 3.6.1 +# +# Part of Gerrit Code Review (https://www.gerritcodereview.com/) +# +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +### Guix modifications start +COMMIT_MSG_MAGIC=VGhpcyBpcyB0aGUgY29tbWl0LW1zZyBob29rIG9mIEd1aXg= +top=$(git rev-parse --show-toplevel) +if test -d "$top/.git/hooks/commit-msg.d/"; then + for msg_hook in "$top/.git/hooks/commit-msg.d/"*; do + if ! sh "$msg_hook"; then + echo "error while running $msg_hook" + exit 1 + fi + done +fi +### Guix modifications end + +set -u + +# avoid [[ which is not POSIX sh. +if test "$#" != 1 ; then + echo "$0 requires an argument." + exit 1 +fi + +if test ! -f "$1" ; then + echo "file does not exist: $1" + exit 1 +fi + +# Do not create a change id if requested +if test "false" = "$(git config --bool --get gerrit.createChangeId)" ; then + exit 0 +fi + +if git rev-parse --verify HEAD >/dev/null 2>&1; then + refhash="$(git rev-parse HEAD)" +else + refhash="$(git hash-object -t tree /dev/null)" +fi + +random=$({ git var GIT_COMMITTER_IDENT ; echo "$refhash" ; cat "$1"; } | git hash-object --stdin) +dest="$1.tmp.${random}" + +trap 'rm -f "${dest}"' EXIT + +if ! git stripspace --strip-comments < "$1" > "${dest}" ; then + echo "cannot strip comments from $1" + exit 1 +fi + +if test ! -s "${dest}" ; then + echo "file is empty: $1" + exit 1 +fi + +reviewurl="$(git config --get gerrit.reviewUrl)" +if test -n "${reviewurl}" ; then + if ! git interpret-trailers --parse < "$1" | grep -q '^Link:.*/id/I[0-9a-f]\{40\}$' ; then + if ! git interpret-trailers \ + --trailer "Link: ${reviewurl%/}/id/I${random}" < "$1" > "${dest}" ; then + echo "cannot insert link footer in $1" + exit 1 + fi + fi +else + # Avoid the --in-place option which only appeared in Git 2.8 + # Avoid the --if-exists option which only appeared in Git 2.15 + if ! git -c trailer.ifexists=doNothing interpret-trailers \ + --trailer "Change-Id: I${random}" < "$1" > "${dest}" ; then + echo "cannot insert change-id line in $1" + exit 1 + fi +fi + +if ! mv "${dest}" "$1" ; then + echo "cannot mv ${dest} to $1" + exit 1 +fi base-commit: 87ffb3d3fbcc9273cb77f22e153ed31a70e2da11 -- 2.41.0
bug-guix <at> gnu.org, Giovanni Biscuolo <g <at> xelera.eu>
:bug#66027
; Package guix
.
(Thu, 12 Oct 2023 14:45:02 GMT) Full text and rfc822 format available.Message #20 received at 66027 <at> debbugs.gnu.org (full text, mbox):
From: Simon Tournier <zimon.toutoune <at> gmail.com> To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, 66027 <at> debbugs.gnu.org Cc: Giovanni Biscuolo <g <at> xelera.eu>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Subject: Re: bug#66027: [PATCH v2] build: Add a commit-msg hook that embeds Change-Id in commit messages. Date: Thu, 12 Oct 2023 15:54:45 +0200
Hi, On Mon, 09 Oct 2023 at 11:03, Maxim Cournoyer <maxim.cournoyer <at> gmail.com> wrote: > + particularly if a first version of your proposed > +changes was already published. Sorry if my English is not good enough. Here, it is not clear for me what “published” means. Does it mean “tracked” by Debbugs? If yes, I would suggest: particularly if a previous version of your proposed changes was already submitted for review. Cheers, simon
bug-guix <at> gnu.org, Giovanni Biscuolo <g <at> xelera.eu>
:bug#66027
; Package guix
.
(Fri, 13 Oct 2023 03:36:01 GMT) Full text and rfc822 format available.Message #23 received at 66027 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 66027 <at> debbugs.gnu.org Cc: Giovanni Biscuolo <g <at> xelera.eu>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Simon Tournier <zimon.toutoune <at> gmail.com> Subject: [PATCH v3 1/3] build: Add a commit-msg hook that embeds Change-Id in commit messages. Date: Thu, 12 Oct 2023 23:33:43 -0400
Partially implements <https://issues.guix.gnu.org/66027>. This will make it possible to track a merged commit back to its original posting on the mailing list, and open the door to new opportunities such as closing fully merged series automatically. * Makefile.am (COMMIT_MSG_MAGIC): New variable. (.git/hooks/commit-msg): New target. * etc/git/commit-msg: New file. * doc/contributing.texi (Configuring Git): Document Change-Id. Change-Id: Ia92fa958eae600fdd4e180bad494c85db8bb4dd6 Reviewed-by: Simon Tournier <zimon.toutoune <at> gmail.com> --- Changes in v3: - Clarify documentation text, as suggested by Simon Makefile.am | 12 +++++- doc/contributing.texi | 10 ++++- etc/git/commit-msg | 94 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 2 deletions(-) create mode 100755 etc/git/commit-msg diff --git a/Makefile.am b/Makefile.am index 310a231259..b860af7258 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1172,7 +1172,17 @@ cuirass-jobs: $(GOBJECTS) git config --add include.path ../etc/git/gitconfig; \ fi -nodist_noinst_DATA = .git/hooks/pre-push .git/config +COMMIT_MSG_MAGIC = VGhpcyBpcyB0aGUgY29tbWl0LW1zZyBob29rIG9mIEd1aXg= +.git/hooks/commit-msg: etc/git/commit-msg + $(AM_V_at)if test -d .git; then \ + if test -f $@ && ! grep -qF $(COMMIT_MSG_MAGIC) $@; then \ + mkdir -p $@.d && mv $@ $@.d && \ + @ echo user commit-msg hook moved to $@.d/commit-msg; \ + fi; \ + cp etc/git/commit-msg $@; \ + fi + +nodist_noinst_DATA = .git/hooks/pre-push .git/config .git/hooks/commit-msg # Downloading up-to-date PO files. diff --git a/doc/contributing.texi b/doc/contributing.texi index 864190b119..43cfae26c4 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -1575,8 +1575,16 @@ Configuring Git use @command{git config --local}, or edit @file{.git/config} in the repository instead of @file{~/.gitconfig}. +@cindex commit-msg hook Other important Git configuration will automatically be configured when -building the project (@pxref{Building from Git}). +building the project (@pxref{Building from Git}). A +@file{.git/hooks/commit-msg} hook will be installed that embeds +@samp{Change-Id} Git @emph{trailers} in your commit messages for +traceability purposes. It is important to preserve these when editing +your commit messages, particularly if a first version of your proposed +changes was already submitted for review. If you have a +@file{commit-msg} hook of your own you would like to use with Guix, you +can place it under the @file{.git/hooks/commit-msg.d/} directory. @node Sending a Patch Series @subsection Sending a Patch Series diff --git a/etc/git/commit-msg b/etc/git/commit-msg new file mode 100755 index 0000000000..dfa07918bb --- /dev/null +++ b/etc/git/commit-msg @@ -0,0 +1,94 @@ +#!/bin/sh +# From Gerrit Code Review 3.6.1 +# +# Part of Gerrit Code Review (https://www.gerritcodereview.com/) +# +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +### Guix modifications start +COMMIT_MSG_MAGIC=VGhpcyBpcyB0aGUgY29tbWl0LW1zZyBob29rIG9mIEd1aXg= +top=$(git rev-parse --show-toplevel) +if test -d "$top/.git/hooks/commit-msg.d/"; then + for msg_hook in "$top/.git/hooks/commit-msg.d/"*; do + if ! sh "$msg_hook"; then + echo "error while running $msg_hook" + exit 1 + fi + done +fi +### Guix modifications end + +set -u + +# avoid [[ which is not POSIX sh. +if test "$#" != 1 ; then + echo "$0 requires an argument." + exit 1 +fi + +if test ! -f "$1" ; then + echo "file does not exist: $1" + exit 1 +fi + +# Do not create a change id if requested +if test "false" = "$(git config --bool --get gerrit.createChangeId)" ; then + exit 0 +fi + +if git rev-parse --verify HEAD >/dev/null 2>&1; then + refhash="$(git rev-parse HEAD)" +else + refhash="$(git hash-object -t tree /dev/null)" +fi + +random=$({ git var GIT_COMMITTER_IDENT ; echo "$refhash" ; cat "$1"; } | git hash-object --stdin) +dest="$1.tmp.${random}" + +trap 'rm -f "${dest}"' EXIT + +if ! git stripspace --strip-comments < "$1" > "${dest}" ; then + echo "cannot strip comments from $1" + exit 1 +fi + +if test ! -s "${dest}" ; then + echo "file is empty: $1" + exit 1 +fi + +reviewurl="$(git config --get gerrit.reviewUrl)" +if test -n "${reviewurl}" ; then + if ! git interpret-trailers --parse < "$1" | grep -q '^Link:.*/id/I[0-9a-f]\{40\}$' ; then + if ! git interpret-trailers \ + --trailer "Link: ${reviewurl%/}/id/I${random}" < "$1" > "${dest}" ; then + echo "cannot insert link footer in $1" + exit 1 + fi + fi +else + # Avoid the --in-place option which only appeared in Git 2.8 + # Avoid the --if-exists option which only appeared in Git 2.15 + if ! git -c trailer.ifexists=doNothing interpret-trailers \ + --trailer "Change-Id: I${random}" < "$1" > "${dest}" ; then + echo "cannot insert change-id line in $1" + exit 1 + fi +fi + +if ! mv "${dest}" "$1" ; then + echo "cannot mv ${dest} to $1" + exit 1 +fi base-commit: 0c1d893b346d2fdbe7bb89b26fc913325b4bd57b -- 2.41.0
efraim <at> flashner.co.il, vagrant <at> debian.org, bug-guix <at> gnu.org, Giovanni Biscuolo <g <at> xelera.eu>
:bug#66027
; Package guix
.
(Fri, 13 Oct 2023 03:36:02 GMT) Full text and rfc822 format available.Message #26 received at 66027 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 66027 <at> debbugs.gnu.org Cc: Giovanni Biscuolo <g <at> xelera.eu>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Simon Tournier <zimon.toutoune <at> gmail.com> Subject: [PATCH v3 2/3] gnu: patman: Apply patch for new Change-Id setting. Date: Thu, 12 Oct 2023 23:33:44 -0400
* gnu/packages/bootloaders.scm (u-boot) [source]: Apply patch. * gnu/packages/patches/u-boot-patman-change-id.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * .patman (keep_change_id): Use it. Change-Id: I33c03013f6a260b5f5d80212b7b6ebe8a3f97efa --- Changes in v3: - New commit .patman | 1 + gnu/local.mk | 1 + gnu/packages/bootloaders.scm | 3 +- .../patches/u-boot-patman-change-id.patch | 232 ++++++++++++++++++ 4 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/u-boot-patman-change-id.patch diff --git a/.patman b/.patman index 13fa4d0fab..efc42144a2 100644 --- a/.patman +++ b/.patman @@ -8,3 +8,4 @@ add_signoff: False # TODO: enable check_patch check_patch: False ignore_bad_tags: True +keep_change_id: True diff --git a/gnu/local.mk b/gnu/local.mk index 13c2b94944..39d833cee0 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2052,6 +2052,7 @@ dist_patch_DATA = \ %D%/packages/patches/u-boot-fix-build-python-3.10.patch \ %D%/packages/patches/u-boot-fix-u-boot-lib-build.patch \ %D%/packages/patches/u-boot-nintendo-nes-serial.patch \ + %D%/packages/patches/u-boot-patman-change-id.patch \ %D%/packages/patches/u-boot-rockchip-inno-usb.patch \ %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch \ %D%/packages/patches/u-boot-rk3399-enable-emmc-phy.patch \ diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 1124eca837..fb20ba0efa 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -654,7 +654,8 @@ (define u-boot %u-boot-sifive-prevent-relocating-initrd-fdt %u-boot-rk3399-enable-emmc-phy-patch (search-patch "u-boot-fix-build-python-3.10.patch") - (search-patch "u-boot-fix-u-boot-lib-build.patch"))) + (search-patch "u-boot-fix-u-boot-lib-build.patch") + (search-patch "u-boot-patman-change-id.patch"))) (method url-fetch) (uri (string-append "https://ftp.denx.de/pub/u-boot/" diff --git a/gnu/packages/patches/u-boot-patman-change-id.patch b/gnu/packages/patches/u-boot-patman-change-id.patch new file mode 100644 index 0000000000..354aee2755 --- /dev/null +++ b/gnu/packages/patches/u-boot-patman-change-id.patch @@ -0,0 +1,232 @@ +Upstream status: https://patchwork.ozlabs.org/project/uboot/patch/20231013030633.7191-1-maxim.cournoyer <at> gmail.com/ + +From f83a5e07b0934e38cbee923e0c5b7fc0a890926c Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> +Date: Thu, 12 Oct 2023 17:04:25 -0400 +Subject: [PATCH] patman: Add a 'keep_change_id' setting + +A Change-Id can be useful for traceability purposes, and some projects +may wish to have them preserved. This change makes it configurable +via a new 'keep_change_id' setting. + +Series-version: 2 +Series-changes: 2 +- Add missing argument to send parser +--- + tools/patman/__main__.py | 2 ++ + tools/patman/control.py | 12 +++++++++--- + tools/patman/patchstream.py | 17 ++++++++++++----- + tools/patman/patman.rst | 11 ++++++----- + tools/patman/test_checkpatch.py | 16 ++++++++++++++++ + 5 files changed, 45 insertions(+), 13 deletions(-) + +diff --git a/tools/patman/__main__.py b/tools/patman/__main__.py +index 8eba5d3486..197ac1aad1 100755 +--- a/tools/patman/__main__.py ++++ b/tools/patman/__main__.py +@@ -103,6 +103,8 @@ send.add_argument('--no-signoff', action='store_false', dest='add_signoff', + default=True, help="Don't add Signed-off-by to patches") + send.add_argument('--smtp-server', type=str, + help="Specify the SMTP server to 'git send-email'") ++send.add_argument('--keep-change-id', action='store_true', ++ help='Preserve Change-Id tags in patches to send.') + + send.add_argument('patchfiles', nargs='*') + +diff --git a/tools/patman/control.py b/tools/patman/control.py +index 916ddf8fcf..b292da9dc2 100644 +--- a/tools/patman/control.py ++++ b/tools/patman/control.py +@@ -16,11 +16,14 @@ from patman import gitutil + from patman import patchstream + from u_boot_pylib import terminal + ++ + def setup(): + """Do required setup before doing anything""" + gitutil.setup() + +-def prepare_patches(col, branch, count, start, end, ignore_binary, signoff): ++ ++def prepare_patches(col, branch, count, start, end, ignore_binary, signoff, ++ keep_change_id=False): + """Figure out what patches to generate, then generate them + + The patch files are written to the current directory, e.g. 0001_xxx.patch +@@ -35,6 +38,7 @@ def prepare_patches(col, branch, count, start, end, ignore_binary, signoff): + end (int): End patch to use (0=last one in series, 1=one before that, + etc.) + ignore_binary (bool): Don't generate patches for binary files ++ keep_change_id (bool): Preserve the Change-Id tag. + + Returns: + Tuple: +@@ -59,11 +63,12 @@ def prepare_patches(col, branch, count, start, end, ignore_binary, signoff): + branch, start, to_do, ignore_binary, series, signoff) + + # Fix up the patch files to our liking, and insert the cover letter +- patchstream.fix_patches(series, patch_files) ++ patchstream.fix_patches(series, patch_files, keep_change_id) + if cover_fname and series.get('cover'): + patchstream.insert_cover_letter(cover_fname, series, to_do) + return series, cover_fname, patch_files + ++ + def check_patches(series, patch_files, run_checkpatch, verbose, use_tree): + """Run some checks on a set of patches + +@@ -166,7 +171,8 @@ def send(args): + col = terminal.Color() + series, cover_fname, patch_files = prepare_patches( + col, args.branch, args.count, args.start, args.end, +- args.ignore_binary, args.add_signoff) ++ args.ignore_binary, args.add_signoff, ++ keep_change_id=args.keep_change_id) + ok = check_patches(series, patch_files, args.check_patch, + args.verbose, args.check_patch_use_tree) + +diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py +index f91669a940..e2e2a83e67 100644 +--- a/tools/patman/patchstream.py ++++ b/tools/patman/patchstream.py +@@ -68,6 +68,7 @@ STATE_PATCH_SUBJECT = 1 # In patch subject (first line of log for a commit) + STATE_PATCH_HEADER = 2 # In patch header (after the subject) + STATE_DIFFS = 3 # In the diff part (past --- line) + ++ + class PatchStream: + """Class for detecting/injecting tags in a patch or series of patches + +@@ -76,7 +77,7 @@ class PatchStream: + unwanted tags or inject additional ones. These correspond to the two + phases of processing. + """ +- def __init__(self, series, is_log=False): ++ def __init__(self, series, is_log=False, keep_change_id=False): + self.skip_blank = False # True to skip a single blank line + self.found_test = False # Found a TEST= line + self.lines_after_test = 0 # Number of lines found after TEST= +@@ -86,6 +87,7 @@ class PatchStream: + self.section = [] # The current section...END section + self.series = series # Info about the patch series + self.is_log = is_log # True if indent like git log ++ self.keep_change_id = keep_change_id # True to keep Change-Id tags + self.in_change = None # Name of the change list we are in + self.change_version = 0 # Non-zero if we are in a change list + self.change_lines = [] # Lines of the current change +@@ -452,6 +454,8 @@ class PatchStream: + + # Detect Change-Id tags + elif change_id_match: ++ if self.keep_change_id: ++ out = [line] + value = change_id_match.group(1) + if self.is_log: + if self.commit.change_id: +@@ -763,7 +767,7 @@ def get_metadata_for_test(text): + pst.finalise() + return series + +-def fix_patch(backup_dir, fname, series, cmt): ++def fix_patch(backup_dir, fname, series, cmt, keep_change_id=False): + """Fix up a patch file, by adding/removing as required. + + We remove our tags from the patch file, insert changes lists, etc. +@@ -776,6 +780,7 @@ def fix_patch(backup_dir, fname, series, cmt): + fname (str): Filename to patch file to process + series (Series): Series information about this patch set + cmt (Commit): Commit object for this patch file ++ keep_change_id (bool): Keep the Change-Id tag. + + Return: + list: A list of errors, each str, or [] if all ok. +@@ -783,7 +788,7 @@ def fix_patch(backup_dir, fname, series, cmt): + handle, tmpname = tempfile.mkstemp() + outfd = os.fdopen(handle, 'w', encoding='utf-8') + infd = open(fname, 'r', encoding='utf-8') +- pst = PatchStream(series) ++ pst = PatchStream(series, keep_change_id=keep_change_id) + pst.commit = cmt + pst.process_stream(infd, outfd) + infd.close() +@@ -795,7 +800,7 @@ def fix_patch(backup_dir, fname, series, cmt): + shutil.move(tmpname, fname) + return cmt.warn + +-def fix_patches(series, fnames): ++def fix_patches(series, fnames, keep_change_id=False): + """Fix up a list of patches identified by filenames + + The patch files are processed in place, and overwritten. +@@ -803,6 +808,7 @@ def fix_patches(series, fnames): + Args: + series (Series): The Series object + fnames (:type: list of str): List of patch files to process ++ keep_change_id (bool): Keep the Change-Id tag. + """ + # Current workflow creates patches, so we shouldn't need a backup + backup_dir = None #tempfile.mkdtemp('clean-patch') +@@ -811,7 +817,8 @@ def fix_patches(series, fnames): + cmt = series.commits[count] + cmt.patch = fname + cmt.count = count +- result = fix_patch(backup_dir, fname, series, cmt) ++ result = fix_patch(backup_dir, fname, series, cmt, ++ keep_change_id=keep_change_id) + if result: + print('%d warning%s for %s:' % + (len(result), 's' if len(result) > 1 else '', fname)) +diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst +index 038b651ee8..a8b317eed6 100644 +--- a/tools/patman/patman.rst ++++ b/tools/patman/patman.rst +@@ -371,11 +371,12 @@ Series-process-log: sort, uniq + Separate each tag with a comma. + + Change-Id: +- This tag is stripped out but is used to generate the Message-Id +- of the emails that will be sent. When you keep the Change-Id the +- same you are asserting that this is a slightly different version +- (but logically the same patch) as other patches that have been +- sent out with the same Change-Id. ++ This tag is used to generate the Message-Id of the emails that ++ will be sent. When you keep the Change-Id the same you are ++ asserting that this is a slightly different version (but logically ++ the same patch) as other patches that have been sent out with the ++ same Change-Id. The Change-Id tag line is removed from outgoing ++ patches, unless the `keep_change_id` settings is set to `True`. + + Various other tags are silently removed, like these Chrome OS and + Gerrit tags:: +diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py +index a8bb364e42..59a53ef8ca 100644 +--- a/tools/patman/test_checkpatch.py ++++ b/tools/patman/test_checkpatch.py +@@ -160,6 +160,22 @@ Signed-off-by: Simon Glass <sjg <at> chromium.org> + + rc = os.system('diff -u %s %s' % (inname, expname)) + self.assertEqual(rc, 0) ++ os.remove(inname) ++ ++ # Test whether the keep_change_id settings works. ++ inhandle, inname = tempfile.mkstemp() ++ infd = os.fdopen(inhandle, 'w', encoding='utf-8') ++ infd.write(data) ++ infd.close() ++ ++ patchstream.fix_patch(None, inname, series.Series(), com, ++ keep_change_id=True) ++ ++ with open(inname, 'r') as f: ++ content = f.read() ++ self.assertIn( ++ 'Change-Id: I80fe1d0c0b7dd10aa58ce5bb1d9290b6664d5413', ++ content) + + os.remove(inname) + os.remove(expname) + +base-commit: f9a47ac8d97da2b3aaf463f268a9a872a8d921df +-- +2.41.0 + -- 2.41.0
bug-guix <at> gnu.org, Giovanni Biscuolo <g <at> xelera.eu>
:bug#66027
; Package guix
.
(Fri, 13 Oct 2023 03:36:02 GMT) Full text and rfc822 format available.Message #29 received at 66027 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: 66027 <at> debbugs.gnu.org Cc: Giovanni Biscuolo <g <at> xelera.eu>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Simon Tournier <zimon.toutoune <at> gmail.com> Subject: [PATCH v3 3/3] etc: teams: Parse 'From' commit more leniently. Date: Thu, 12 Oct 2023 23:33:45 -0400
When a Change-Id is used, patman prepends a Message-Id field on the first line of the patch, which broke the assumption that the 'From $commit' line must appear on the first line. * etc/teams.scm.in (git-patch->commit-id): Loop each line of the file until a match is found. Update doc. Change-Id: I20400f87469ffb761ffc82dd32e34cd06f619043 --- Changes in v3: - New commit etc/teams.scm.in | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/etc/teams.scm.in b/etc/teams.scm.in index 55242caad1..703d76fe8d 100644 --- a/etc/teams.scm.in +++ b/etc/teams.scm.in @@ -770,13 +770,16 @@ (define (diff-revisions rev-start rev-end) files)) (define (git-patch->commit-id file) - "Parse the commit ID from the first line of FILE, a patch produced with git." + "Parse the commit ID from FILE, a patch produced with git." (call-with-input-file file (lambda (port) - (let ((m (string-match "^From ([0-9a-f]{40})" (read-line port)))) - (unless m - (error "invalid patch file:" file)) - (match:substring m 1))))) + (let loop ((line (read-line port))) + (when (eof-object? line) + (error "could not find 'from' commit in patch" file)) + (let ((m (string-match "^From ([0-9a-f]{40})" line))) + (if m + (match:substring m 1) + (loop (read-line port)))))))) (define (git-patch->revisions file) "Return the start and end revisions of FILE, a patch file produced with git." -- 2.41.0
bug-guix <at> gnu.org, Giovanni Biscuolo <g <at> xelera.eu>
:bug#66027
; Package guix
.
(Mon, 23 Oct 2023 17:31:02 GMT) Full text and rfc822 format available.Message #32 received at 66027 <at> debbugs.gnu.org (full text, mbox):
From: Simon Tournier <zimon.toutoune <at> gmail.com> To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Cc: Giovanni Biscuolo <g <at> xelera.eu>, 66027 <at> debbugs.gnu.org Subject: Re: bug#66027: Add a feature to automatically close specified bug reports upon committing. Date: Mon, 23 Oct 2023 15:58:55 +0200
Hi Maxim, If I read correctly, this series had been merged with: fb3707762d * etc: teams: Parse 'From' commit more leniently. f44fa21c3e * gnu: patman: Apply patch for new Change-Id setting. 8005e09b26 * build: Add a commit-msg hook that embeds Change-Id in commit messages. Right? Mark the submission as done? Or maybe is it a way for testing the feature? ;-) Cheers, simon
bug-guix <at> gnu.org, Giovanni Biscuolo <g <at> xelera.eu>
:bug#66027
; Package guix
.
(Mon, 23 Oct 2023 20:11:01 GMT) Full text and rfc822 format available.Message #35 received at 66027 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: Simon Tournier <zimon.toutoune <at> gmail.com> Cc: Giovanni Biscuolo <g <at> xelera.eu>, 66027 <at> debbugs.gnu.org Subject: Re: bug#66027: Add a feature to automatically close specified bug reports upon committing. Date: Mon, 23 Oct 2023 16:09:33 -0400
Hi, Simon Tournier <zimon.toutoune <at> gmail.com> writes: > Hi Maxim, > > If I read correctly, this series had been merged with: > > fb3707762d * etc: teams: Parse 'From' commit more leniently. > f44fa21c3e * gnu: patman: Apply patch for new Change-Id setting. > 8005e09b26 * build: Add a commit-msg hook that embeds Change-Id in commit messages. > > Right? > > Mark the submission as done? Or maybe is it a way for testing the > feature? ;-) It's only partially implementing the fix as mentioned in fb3707762d; the missing bit is making use of the newly introduced Change-Id in mumi or a script to determine if a series was fully merged, and close it if so. So it should remain open until then :-). -- Thanks, Maxim
Felix Lechner <felix.lechner <at> lease-up.com>
to control <at> debbugs.gnu.org
.
(Thu, 08 Feb 2024 18:11:02 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.