Bruno Haible via Gnulib discussion list <bug-gnulib@gnu.org> writes:

> Simon Josefsson wrote:
>> > is to suffix it with a date:
>> >
>> >          Gnulib 552c0b06355a6720c8ce87ce305f42ed15a32d20 (2024-12-28)
>> 
>> I agree. Even the date is more human friendly, so how about
>> 
>>   Gnulib 2024-12-28 (552c0b06355a6720c8ce87ce305f42ed15a32d20)
>
> Yes, this is even better. It answers the user's question "was it a recent
> gnulib?" more succintly. In this presentation, the commit ID serves only
> to disambiguate among several commits that happened on the same date.
>
>> The TZ question arise here again (git commit timestamp vs TZ-less
>> ChangeLog date), but let's hope it won't be a big problem in practice.
>
> Right. For a question "was it a recent gnulib?" neither the time in the day
> nor the time zone matter.

I agree and used this style in the attached patch.  I hope nobody was
relying on $(gnulib-version) being a single word.  There are corner
cases where the logic isn't complete, consider if gnulib-dir is not a
git checkout and GNULIB_REVISION is not part of bootstrap.conf, what to
even make of that situation?  Now it will only print the ChangeLog date,
which I think is all that we have available.

Paul Eggert <egg...@cs.ucla.edu> writes:

> On 12/28/24 15:46, Bruno Haible via Gnulib discussion list wrote:
>> What a human reader would like to understand is whether such a
>> commit number is recent or not. Therefore, what I would suggest
>> is to suffix it with a date:
>>           Gnulib 552c0b06355a6720c8ce87ce305f42ed15a32d20
>> (2024-12-28)
>
> It might also help to put the date first (as that's better for a human
> reader) and make it a full timestamp, e.g.:
>
>   Gnulib 2024-12-28 19:46:30 +0100 552c0b06355a6720c8ce87ce305f42ed15a32d20
>
> This sort of thing is more robust across version-control systems, and
> we found it useful when switching Emacs from bzr to git.

I found this slightly uglier and more difficult to generate (consider
the situation where you have no gnulib .git checkout, how to generate
the git commit timestamp information from?).

/Simon
From e7d6a9e033ff82d5bd7f001d6d1a17bd6cc9607c Mon Sep 17 00:00:00 2001
From: Simon Josefsson <si...@josefsson.org>
Date: Thu, 2 Jan 2025 09:28:48 +0100
Subject: [PATCH] maintainer-makefile: Improve gnulib-version handling.

* top/maint.mk (gnulib-version): Prefix commit id with human
readable leading ChangeLog date, suggested by Bruno Haible.
(announcement): Handle multi-word gnulib-version.
---
 ChangeLog    | 7 +++++++
 top/maint.mk | 9 ++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f3e3f1e784..70bf7a7bb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-01-02  Simon Josefsson  <si...@josefsson.org>
+
+	maintainer-makefile: Improve gnulib-version handling.
+	* top/maint.mk (gnulib-version): Prefix commit id with human
+	readable leading ChangeLog date, suggested by Bruno Haible.
+	(announcement): Handle multi-word gnulib-version.
+
 2025-01-01  Bruno Haible  <br...@clisp.org>
 
 	doc: Update regarding stable branches.
diff --git a/top/maint.mk b/top/maint.mk
index af98762e49..78c757d8f1 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -1516,13 +1516,12 @@ vc-diff-check:
 rel-files = $(DIST_ARCHIVES)
 
 gnulib-version ?= \
-  $$(if test -e $(gnulib_dir)/.git; then				\
+  $$(head -c11 $(gnulib_dir)/ChangeLog;					\
+     if test -e $(gnulib_dir)/.git; then				\
        git -C $(gnulib_dir) rev-parse HEAD;				\
      elif test -f $(srcdir)/bootstrap.conf; then			\
        perl -lne '/^\s*GNULIB_REVISION=(\S+)/ and $$d=$$1;'		\
          -e 'END{defined $$d and print $$d}' $(srcdir)/bootstrap.conf;	\
-     else								\
-       head -1 $(gnulib_dir)/ChangeLog | sed -e 's/ .*//;q ';		\
      fi)
 bootstrap-tools ?= autoconf,automake,gnulib
 
@@ -1578,8 +1577,8 @@ announcement: NEWS ChangeLog $(rel-files)
 	    --srcdir=$(srcdir)						\
 	    --news=$(srcdir)/NEWS					\
 	    --bootstrap-tools=$(bootstrap-tools)			\
-	    $$(case ,$(bootstrap-tools), in (*,gnulib,*)		\
-	       echo --gnulib-version=$(gnulib-version);; esac)		\
+	    "$$(case ,$(bootstrap-tools), in (*,gnulib,*)		\
+	       echo --gnulib-version=$(gnulib-version);; esac)"		\
 	    $(addprefix --url-dir=, $(url_dir_list))			\
 	    $(announce_gen_args)
 
-- 
2.47.1

Attachment: signature.asc
Description: PGP signature

Reply via email to