From: Eric Blake Date: Thu, 21 Feb 2008 14:55:13 +0000 (-0700) Subject: Sync git-version-gen from upstream. X-Git-Tag: v2.62~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf39a653c670fdc167f1ff08e5cfbaf9f1422b70;p=thirdparty%2Fautoconf.git Sync git-version-gen from upstream. * build-aux/git-version-gen: Pull from gnulib. * configure.ac (AC_INIT): Adjust to new calling convention. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 8fe8873d..fc0183b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-21 Eric Blake + + 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 Avoid trailing space in config.h with AC_DEFINE([var], []). diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen index 20c759e7..1a001070 100755 --- a/build-aux/git-version-gen +++ b/build-aux/git-version-gen @@ -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 diff --git a/configure.ac b/configure.ac index cfd8643a..caff001f 100644 --- a/configure.ac +++ b/configure.ac @@ -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])