]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Sync git-version-gen from upstream.
authorEric Blake <ebb9@byu.net>
Thu, 21 Feb 2008 14:55:13 +0000 (07:55 -0700)
committerEric Blake <ebb9@byu.net>
Thu, 21 Feb 2008 14:55:13 +0000 (07:55 -0700)
* build-aux/git-version-gen: Pull from gnulib.
* configure.ac (AC_INIT): Adjust to new calling convention.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
build-aux/git-version-gen
configure.ac

index 8fe8873dc5bb23c1597234c6e46c007cc55afbf0..fc0183b374f16b514d7b79c9eea492247af8ebe5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-21  Eric Blake  <ebb9@byu.net>
+
+       Sync git-version-gen from upstream.
+       * build-aux/git-version-gen: Pull from gnulib.
+       * configure.ac (AC_INIT): Adjust to new calling convention.
+
 2008-02-12  Eric Blake  <ebb9@byu.net>
 
        Avoid trailing space in config.h with AC_DEFINE([var], []).
index 20c759e7e2e4a5f51b0917e0d7ccd56117474343..1a00107051d0fc3696299ef39d9cc8c01a10a81d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2007-11-11.19
+scriptversion=2008-02-08.11
 
 # Copyright (C) 2007 Free Software Foundation
 #
@@ -21,26 +21,25 @@ scriptversion=2007-11-11.19
 
 # This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
 # It may be run two ways:
-# - from a git repository in which the git-describe command below
+# - from a git repository in which the "git describe" command below
 #   produces useful output (thus requiring at least one signed tag)
 # - from a non-git-repo directory containing a .version file, which
-#   presumes this script is invoked like "./git-version-gen $srcdir .version".
+#   presumes this script is invoked like "./git-version-gen .tarball-version".
 
 case $# in
-    2) ;;
-    *) echo 1>&2 "Usage: $0 \$srcdir .version"; exit 1;;
+    1) ;;
+    *) echo 1>&2 "Usage: $0 \$srcdir/.version"; exit 1;;
 esac
 
-srcdir=$1
-tarball_version_file=$srcdir/$2
+tarball_version_file=$1
 nl='
 '
 
 # First see if there is a tarball-only version file.
-# then try git-describe, then default.
+# then try "git describe", then default.
 if test -f $tarball_version_file
 then
-    v=`cat "$tarball_version_file"` || exit 1
+    v=`cat $tarball_version_file` || exit 1
     case $v in
        *$nl*) v= ;; # reject multi-line output
        [0-9]*) ;;
@@ -53,15 +52,32 @@ fi
 if test -n "$v"
 then
     : # use $v
-elif test -d "$srcdir/.git" \
-    && v=`git --git-dir="$srcdir/.git" describe --abbrev=4 HEAD 2>/dev/null` \
+elif test -d .git \
+    && v=`git describe --abbrev=4 HEAD 2>/dev/null` \
     && case $v in
         v[0-9]*) ;;
         *) (exit 1) ;;
        esac
 then
+    # Is this a new git that lists number of commits since the last
+    # tag or the previous older version that did not?
+    #   Newer: v6.10-77-g0f8faeb
+    #   Older: v6.10-g0f8faeb
+    case $v in
+       *-*-*) : git describe is okay three part flavor ;;
+       *-*)
+           : git describe is older two part flavor
+           # Recreate the number of commits and rewrite such that the
+           # result is the same as if we were using the newer version
+           # of git describe.
+           vtag=`echo "$v" | sed 's/-.*//'`
+           numcommits=`git rev-list "$vtag"..HEAD | wc -l`
+           v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
+           ;;
+    esac
+
     # Change the first '-' to a '.', so version-comparing tools work properly.
-    # Remove the "g" in git-describe's output string, to save a byte.
+    # Remove the "g" in git describe's output string, to save a byte.
     v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
 else
     v=UNKNOWN
@@ -70,7 +86,7 @@ fi
 v=`echo "$v" |sed 's/^v//'`
 
 # Don't declare a version "dirty" merely because a time stamp has changed.
-git-status > /dev/null 2>&1
+git status > /dev/null 2>&1
 
 dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty=
 case "$dirty" in
index cfd8643a4b21f22741112e83c34ce541768872b9..caff001f53605d9e0ae79037454415e5f9bd557a 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 # Copyright (C) 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 # We need AC_CONFIG_TESTDIR, AC_PROG_SED, AC_PROG_GREP.
 AC_PREREQ([2.60])
 
-AC_INIT([GNU Autoconf], m4_esyscmd([build-aux/git-version-gen . .version]),
+AC_INIT([GNU Autoconf], m4_esyscmd([build-aux/git-version-gen .version]),
        [bug-autoconf@gnu.org])
 AC_SUBST([PACKAGE_NAME])dnl
 AC_CONFIG_SRCDIR([ChangeLog])