Basil L. Contovounesios [2026-02-04 15:12 +0100] wrote: > That said, I think we can keep the generality by offsetting the line > number found by AWK by the start of the sed address. > > I attach a patch which attempts this. WDYT?
Sorry, wrong patch; correct one attached. I tried it with both single and double sed addresses in my cfg.mk value of news-check-lines-spec. -- Basil
>From 974658d771dcf6589211463ae965c1154362dcfa Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" <[email protected]> Date: Wed, 4 Feb 2026 14:52:47 +0100 Subject: [PATCH] do-release-commit-and-tag: Fix stub line numbers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by Pádraig Brady in <https://lists.gnu.org/r/bug-gnulib/2026-02/msg00027.html>. * build-aux/do-release-commit-and-tag: The stub_line number is relative to the --stub-lines sed address, so offset it accordingly. --- ChangeLog | 8 ++++++++ build-aux/do-release-commit-and-tag | 11 +++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a421e3381..4ec626ae5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2026-02-04 Basil L. Contovounesios <[email protected]> + + do-release-commit-and-tag: Fix stub line numbers. + Reported by Pádraig Brady in + <https://lists.gnu.org/r/bug-gnulib/2026-02/msg00027.html>. + * build-aux/do-release-commit-and-tag: The stub_line number is + relative to the --stub-lines sed address, so offset it accordingly. + 2026-02-03 Zack Weinberg <[email protected]> maintainer-makefile: Avoid false positives of unsigned_* syntax checks. diff --git a/build-aux/do-release-commit-and-tag b/build-aux/do-release-commit-and-tag index 52d801c86d..da5326cfa1 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-11-12.12 # UTC +VERSION=2026-02-04.14 # UTC # Note: this is a bash script (could be zsh or dash) @@ -178,16 +178,19 @@ stub_line=$(sed -n "${stub_range}p" $news \ test -n "$stub_line" \ || die "one of line(s) $stub_range of $news must be exactly '$noteworthy_stub'" +# One more than the line number $stub_line is relative to. +stub_offset=$(sed "${stub_range}!d;=" $news | head -n 1) + ## --------------- ## ## Then, changes. ## ## --------------- ## # Update NEWS to have today's date, plus desired version number and $type. 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" \ + gl_type=$type gl_type_stub="$type_stub" gl_date_stub="$date_stub" \ + gl_offset="$stub_offset" gl_line="$stub_line" \ perl -MPOSIX -pi \ - -e 'if ($. == $ENV{gl_line}) {' \ + -e 'if ($. == $ENV{gl_offset} + $ENV{gl_line} - 1) {' \ -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)/;' \ -- 2.51.0
