Simon Josefsson wrote:
> I think '9.1-dirty' would be better than '9.1' in this case, as a
> differentiator to '9.1', but I agree that probably most distributions
> will not like the '-dirty' word in there.

OK, we have a majority (PRO: Bruno, Simon; CONTRA: Bernhard). I'm
changing the suffix. This has the advantage that we drop the

  | sed -e 's/dirty$/modified/'

line, that was ugly and that does not work on Solaris (because the
Solaris /usr/bin/sed program produces empty output in this situation).

> Generally, I have not experienced a scenario where the '-dirty' or now
> '-modified' version suffix actually helps with anything, and several
> scenarios (like the one with no longer reproducible generated files)
> where it actively doesn't contribute.

I think it may help
  - the user who views a directory listing on ftp.gnu.org [1],
  - the maintainer of a package who receives a test-suite.log as part of
    a bug report. The test-suite.log contains the package's version number
    in the second line. The maintainer is thus quickly alerted if
    the originator was working off a git repository and had uncommitted
    modifications.

[1] https://ftp.gnu.org/gnu/artanis/


2025-01-28  Bruno Haible  <br...@clisp.org>

        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'.

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_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 @@
 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}])




Reply via email to