Hi Bruno,

Thank you for reviewing and applying the patches so quickly.

Bruno Haible via Gnulib discussion list [2025-11-11 21:18 +0100] wrote:

> The patches look reasonable to me, in the sense that the existing support
> of the NEWS file appears to continue to work.

Except...

> I have applied patches 1, 3, 4 in your name, adjusting the first line
> of the git commit message to match the first line of the ChangeLog entry.
>
> For patch 2, I would suggest three tweaks of how long commands are broken
> across lines:

...patch 3 depends on patch 2, since maint.mk now passes the new options
--news, --stub, and --stub-lines to do-release-commit-and-tag (which
chokes on unrecognised options).

Should patch 3 should be reverted until patch 2 can be applied?

[ By the way, I welcome suggestions for better option names, etc.
  For example, I tried to copy existing naming schemes in maint.mk, but
  I'm not aware of the intended difference between names like_this,
  like_this_, or like-this. ]

> 1)
> +test -n "$stub_line" || die "one of line(s) $stub_range of $news" \
> +                            "must be exactly '$noteworthy_stub'"
>
> Write this as:
>
> +test -n "$stub_line" \
> + || die "one of line(s) $stub_range of $news must be exactly
> '$noteworthy_stub'"
>
> 2)
> +    perl -MPOSIX -pi \
> +    -e 'if ($. == $ENV{gl_line}) {' \
> +    -e '  my $today = strftime "%F", localtime time;' \
> +    -e '  s/\Q$ENV{gl_ver_stub}/$ENV{gl_ver}/;' \
> +    -e '  s/\Q$ENV{gl_date_stub}/($today)/;' \
> +    -e '  s/\Q$ENV{gl_type_stub}/[$ENV{gl_type}]/;' \
> +    -e '}' \
>
> Better add 5 spaces before each '-e', for a useful indentation.
>
> 3)
> +    $news || die 'failed to update NEWS'
>
> Write this as:
>
> +         $news \
> +    || die 'failed to update NEWS'

Done.  I attach the updated patch.

> Also, since the total size of your contributions is becoming relevant
> for copyright purposes, I'd like to ask whether you can exchange copyright
> assignment papers with the FSF regarding GNULIB, like you already did for
> EMACS ? Thanks!

Gladly.  I just submitted my request mentioning you under:
> [Additional people we should notify about the progress of the assignment.]
though I imagine you would have been notified either way.

Thanks again,
-- 
Basil

>From 9daf7dfda017e33a9c04fa2b4dcfbbc593941b8e Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <[email protected]>
Date: Tue, 11 Nov 2025 19:23:39 +0100
Subject: [PATCH 2/4 v2] do-release-commit-and-tag: Accommodate alternative
 NEWS formats.

* build-aux/do-release-commit-and-tag: Introduce new options
parametrizing the NEWS file name, and its noteworthy_stub location
and contents.  Avoid unconditional strftime in inner Perl loop.
(help): Describe the new options.
---
 ChangeLog                           |  8 ++++
 build-aux/do-release-commit-and-tag | 57 ++++++++++++++++++++++-------
 2 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9d6b483bb6..06142c4a10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-11-12  Basil L. Contovounesios  <[email protected]>
+
+	do-release-commit-and-tag: Accommodate alternative NEWS formats.
+	* build-aux/do-release-commit-and-tag: Introduce new options
+	parametrizing the NEWS file name, and its noteworthy_stub location
+	and contents.  Avoid unconditional strftime in inner Perl loop.
+	(help): Describe the new options.
+
 2025-11-11  Bruno Haible  <[email protected]>
 
 	pthread-cond, cond, cnd tests: Fix spurious failure on Linux/SPARC.
diff --git a/build-aux/do-release-commit-and-tag b/build-aux/do-release-commit-and-tag
index f01934c1eb..3cc211fe12 100755
--- a/build-aux/do-release-commit-and-tag
+++ b/build-aux/do-release-commit-and-tag
@@ -3,7 +3,7 @@
 # controlled .prev-version file, automate the procedure by which we record
 # the date, release-type and version string in the NEWS file.  That commit
 # will serve to identify the release, so apply a signed tag to it as well.
-VERSION=2025-06-10.02 # UTC
+VERSION=2025-11-12.12 # UTC
 
 # Note: this is a bash script (could be zsh or dash)
 
@@ -42,12 +42,22 @@ directory.
 Requirements:
 - you use git for version-control
 - a version-controlled .prev-version file
-- a NEWS file, with line 3 identical to this:
+- a NEWS file, by default with line 3 identical to this:
 $noteworthy_stub
 
 Options:
   --branch=BRANCH     set release branch (default: $branch)
   -C, --builddir=DIR  location of (configured) Makefile (default: $builddir)
+
+  --news=FILE         NEWS file name (default: $news)
+  --stub=STR          release heading placeholder (default:
+                      $noteworthy_stub)
+  --stub-version=STR  release version placeholder (default: $ver_stub)
+  --stub-date=STR     release date placeholder (default: $date_stub)
+  --stub-type=STR     release type placeholder (default: $type_stub)
+  --stub-lines=RANGE  sed line address range to search for heading
+                      (default: $stub_range)
+
   --help              print this help, then exit
   --version           print version number, then exit
 
@@ -80,11 +90,16 @@ EOF
 
 # Constants.
 noteworthy='* Noteworthy changes in release'
-noteworthy_stub="$noteworthy ?.? (????-??-??) [?]"
 
 # Variables.
 branch=$(git branch | sed -ne '/^\* /{s///;p;q;}')
 builddir=.
+news=NEWS
+ver_stub='?.?'
+date_stub='(????-??-??)'
+type_stub='[?]'
+noteworthy_stub="$noteworthy $ver_stub $date_stub $type_stub"
+stub_range=3
 
 while test $# != 0
 do
@@ -102,6 +117,12 @@ do
     --help|--version) ${1#--};;
     --branch) shift; branch=$1; shift ;;
     -C|--builddir) shift; builddir=$1; shift ;;
+    --news) shift; news=$1; shift ;;
+    --stub) shift; noteworthy_stub=$1; shift ;;
+    --stub-version) shift; ver_stub=$1; shift ;;
+    --stub-date) shift; date_stub=$1; shift ;;
+    --stub-type) shift; type_stub=$1; shift ;;
+    --stub-lines) shift; stub_range=$1; shift ;;
     --*) die "unrecognized option: $1";;
     *) break;;
   esac
@@ -150,22 +171,32 @@ Makefile=$builddir/Makefile
 pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' "$Makefile") \
   || die "failed to determine package name from $Makefile"
 
-# Check that line 3 of NEWS is the stub line about to be replaced.
-test "$(sed -n 3p NEWS)" = "$noteworthy_stub" \
-  || die "line 3 of NEWS must be exactly '$noteworthy_stub'"
+# Check that stub about to be replaced is in given NEWS line range.
+stub_line=$(sed -n "${stub_range}p" $news \
+              | env gl_stub="$noteworthy_stub" \
+                    awk '$0 == ENVIRON["gl_stub"] { print NR }')
+test -n "$stub_line" \
+  || die "one of line(s) $stub_range of $news must be exactly '$noteworthy_stub'"
 
 ## --------------- ##
 ## Then, changes.  ##
 ## --------------- ##
 
 # Update NEWS to have today's date, plus desired version number and $type.
-perl -MPOSIX -ni -e 'my $today = strftime "%F", localtime time;' \
- -e 'my ($type, $ver) = qw('"$type $ver"');' \
- -e 'my $pfx = "'"$noteworthy"'";' \
- -e 'print $.==3 ? "$pfx $ver ($today) [$type]\n" : $_' \
-     NEWS || die 'failed to update NEWS'
-
-printf "version %s\n\n* NEWS: Record release date.\n" "$ver" \
+env gl_ver=$ver gl_ver_stub="$ver_stub" \
+    gl_type=$type gl_type_stub="$type_stub" \
+    gl_date_stub="$date_stub" gl_line="$stub_line" \
+    perl -MPOSIX -pi \
+         -e 'if ($. == $ENV{gl_line}) {' \
+         -e '  my $today = strftime "%F", localtime time;' \
+         -e '  s/\Q$ENV{gl_ver_stub}/$ENV{gl_ver}/;' \
+         -e '  s/\Q$ENV{gl_date_stub}/($today)/;' \
+         -e '  s/\Q$ENV{gl_type_stub}/[$ENV{gl_type}]/;' \
+         -e '}' \
+         $news \
+    || die 'failed to update NEWS'
+
+printf "version %s\n\n* ${news}: Record release date.\n" "$ver" \
     | git commit -F -  -a || die 'git commit failed'
 git tag -s -m "$pkg $ver" v$ver HEAD || die 'git tag failed'
 
-- 
2.51.0

Reply via email to