]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
maintainer-makefile: Improve gnulib-version derivation.
authorSimon Josefsson <simon@josefsson.org>
Sat, 28 Dec 2024 18:46:30 +0000 (19:46 +0100)
committerSimon Josefsson <simon@josefsson.org>
Sat, 28 Dec 2024 18:49:18 +0000 (19:49 +0100)
* top/maint.mk (gnulib-version): Use git only when possible,
falling back to GNULIB_REVISION or ChangeLog date otherwise.  Use
consistent full identifier.

ChangeLog
top/maint.mk

index 2eed147ec8376f7c0fffe5c462595ea667fd1f2f..0de411cb2f8fc99697bfdfe02ba17cf58de4fe9d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-12-28  Simon Josefsson  <simon@josefsson.org>
+
+       maintainer-makefile: Improve gnulib-version derivation.
+       * top/maint.mk (gnulib-version): Use git only when possible,
+       falling back to GNULIB_REVISION or ChangeLog date otherwise.  Use
+       consistent full identifier.
+
 2024-12-28  Simon Josefsson  <simon@josefsson.org>
 
        announce-gen: Support VPATH builds better.
index b2baa02edff3c7cf591caf5fd24a9b7c6717122a..0115d30f103b58048c0cc3bd8ac31a23d02bde7d 100644 (file)
@@ -1515,8 +1515,15 @@ vc-diff-check:
 
 rel-files = $(DIST_ARCHIVES)
 
-gnulib-version = $$(cd $(gnulib_dir)                           \
-                    && { git describe 2> /dev/null || git rev-parse --short=10 HEAD; } )
+gnulib-version ?= \
+  $$(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
 
 gpgv = $$(gpgv2 --version >/dev/null && echo gpgv2 || echo gpgv)