From 9496497d039ec21a29ad65c66d5d41b03c4098d6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 28 Jan 2025 10:33:34 +0100 Subject: [PATCH] git-version-gen: Change suffix. * doc/package-version.texi (Propagating the package version): Drop the git-version-gen postprocessing line, that does not work on Solaris. * build-aux/git-version-gen: Likewise. Produce a suffix '-modified' instead of '-dirty'. --- ChangeLog | 8 ++++++++ build-aux/git-version-gen | 26 +++++++++++++++++--------- doc/package-version.texi | 6 ++---- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index a18da52db3..bf91899783 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-01-28 Bruno Haible + + git-version-gen: Change suffix. + * doc/package-version.texi (Propagating the package version): Drop the + git-version-gen postprocessing line, that does not work on Solaris. + * build-aux/git-version-gen: Likewise. Produce a suffix '-modified' + instead of '-dirty'. + 2025-01-26 Bruno Haible package-version: Avoid compiler warnings in config.log. diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen index 32c14e996d..da6e131c03 100755 --- a/build-aux/git-version-gen +++ b/build-aux/git-version-gen @@ -1,6 +1,6 @@ #!/bin/sh # Print a version string. -scriptversion=2025-01-22.18; # UTC +scriptversion=2025-01-28.09; # UTC # Copyright (C) 2007-2025 Free Software Foundation, Inc. # @@ -59,8 +59,7 @@ scriptversion=2025-01-22.18; # UTC # AC_CONFIG_SRCDIR([@var{unique-file-in-source-dir}]) # AC_CONFIG_AUX_DIR([build-aux]) # VERSION_NUMBER=`cd $srcdir \ -# && build-aux/git-version-gen .tarball-version \ -# | sed -e 's/dirty$/modified/'` +# && build-aux/git-version-gen .tarball-version` # gl_INIT_PACKAGE_VERSION([$VERSION_NUMBER]) # AM_INIT_AUTOMAKE([@var{options}]) # @@ -213,20 +212,29 @@ v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`; v=`echo "$v" |sed "s/^$prefix//"` -# Test whether to append the "-dirty" suffix only if the version +# The "-modified" suffix was previously called "-dirty". While this term +# was invented by the git people to designate a checkout that is not "clean", +# it has a negative connotation that is not in line with the fact that +# a Free Software developer routinely works with modified source code. +# In fact, modifying source code is the *essence* of Free Software. +# What we need here is a term that is suitable for naming tarballs, without +# shaming the developer. Giving a name to a tarball is something else than +# describing the state of a git checkout. +# +# Test whether to append the "-modified" suffix only if the version # string we're using came from git. I.e., skip the test if it's "UNKNOWN" # or if it came from .tarball-version. if test "x$v_from_git" != x; then - # Don't declare a version "dirty" merely because a timestamp has changed. + # Don't declare a version "modified" merely because a timestamp has changed. git update-index --refresh > /dev/null 2>&1 - dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty= - case "$dirty" in + modified=`exec 2>/dev/null;git diff-index --name-only HEAD` || modified= + case "$modified" in '') ;; *) # Append the suffix only if there isn't one already. case $v in - *-dirty) ;; - *) v="$v-dirty" ;; + *-dirty | *-modified) ;; + *) v="$v-modified" ;; esac ;; esac fi diff --git a/doc/package-version.texi b/doc/package-version.texi index dc8c8e8c55..b8aa9ff96b 100644 --- a/doc/package-version.texi +++ b/doc/package-version.texi @@ -122,8 +122,7 @@ AC_INIT([@var{package}], [dummy]) AC_CONFIG_SRCDIR([@var{unique-file-in-source-dir}]) AC_CONFIG_AUX_DIR([build-aux]) VERSION_NUMBER=`cd $srcdir \ - && build-aux/git-version-gen .tarball-version \ - | sed -e 's/dirty$/modified/'` + && build-aux/git-version-gen .tarball-version` gl_INIT_PACKAGE_VERSION([$VERSION_NUMBER]) AM_INIT_AUTOMAKE([@var{options}]) @end example @@ -151,8 +150,7 @@ The second such old code pattern is to invoke @code{git-version-gen} at @code{autoconf} time: @example AC_INIT([@var{package}], - m4_esyscmd([build-aux/git-version-gen .tarball-version \ - | sed -e 's/dirty$/modified/'])]) + m4_esyscmd([build-aux/git-version-gen .tarball-version])]) AC_CONFIG_SRCDIR([@var{unique-file-in-source-dir}]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([@var{options}]) -- 2.39.5