All,

I've pushed this patch so that announce-gen handles 'guix --version'
output.  It bothered me for some time that randomly this worked and
randomly it didn't, the reason was that it happened to work when the
guix --version (which is git commit SHA1 identifier) began with 0-9 and
failed when it began with a-f.  This also makes the error message more
understandable and actually include the relevant string again.

/Simon
From 61c40358bc9b09fa0985747064c48f81f607039a Mon Sep 17 00:00:00 2001
From: Simon Josefsson <si...@josefsson.org>
Date: Sat, 1 Feb 2025 00:24:27 +0100
Subject: [PATCH] announce-gen: Deal with 'guix --version'.

* build-aux/announce-gen (get_tool_versions): Handle git commit
--versions.  Improve error message.
---
 ChangeLog              | 6 ++++++
 build-aux/announce-gen | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fb649ea68c..2f0e8d34e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-02-01  Simon Josefsson  <si...@josefsson.org>
+
+	announce-gen: Deal with 'guix --version'.
+	* build-aux/announce-gen (get_tool_versions): Handle git commit
+	--versions.  Improve error message.
+
 2025-01-28  Collin Funk  <collin.fu...@gmail.com>
 
 	doc: Document version-etc, version-etc-fsf, and argp-version-etc.
diff --git a/build-aux/announce-gen b/build-aux/announce-gen
index fc3787bf62..8e75608cbd 100755
--- a/build-aux/announce-gen
+++ b/build-aux/announce-gen
@@ -35,7 +35,7 @@
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
-my $VERSION = '2024-12-28 18:31'; # UTC
+my $VERSION = '2025-01-31 23:21'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -375,16 +375,16 @@ sub get_tool_versions ($$)
       # Assume that the last "word" on the first line of
       # 'tool --version' output is the version string.
       my ($first_line, undef) = split ("\n", `$t --version`);
-      if ($first_line =~ /.* (\d[\w.-]+)$/)
+      if ($first_line =~ /.* ([a-f\d][\w.-]+)$/)
         {
           $t = ucfirst $t;
           push @tool_version_pair, "$t $1";
         }
       else
         {
+          warn "$t: unexpected --version output:\n$first_line";
           defined $first_line
             and $first_line = '';
-          warn "$t: unexpected --version output\n:$first_line";
           $fail = 1;
         }
     }
-- 
2.48.1

Attachment: signature.asc
Description: PGP signature

Reply via email to