autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Enable use of older two part flavor 'git describe'.


From: Eric Blake
Subject: Re: [PATCH] Enable use of older two part flavor 'git describe'.
Date: Thu, 21 Feb 2008 06:21:51 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Jim Meyering on 2/21/2008 1:37 AM:
| Bob found that it is required to work around a relatively obscure
| problem you'd see only when trying to bootstrap the autotools tool chain
| with only the relatively old git-1.4.4.4 installed (debian unstable).
| The problem was that your built-from-sources autoconf would end up with
| a version string like 2.61a-ab8fd, which is not of the usual
M.N.O-hhhhhh form.

I'm applying this patch to autoconf.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHvXru84KuGfSFAYARApX+AKC1iebEDi9qWtkv5hGBW3NCywDX3gCdFeKS
mLlVYySJCuE6LAZsEW5iasU=
=Pzge
-----END PGP SIGNATURE-----
>From 45abe43294068197195e0a29b6ea9449ad68602c Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 21 Feb 2008 06:18:32 -0700
Subject: [PATCH] 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 <address@hidden>
---
 ChangeLog                 |    6 ++++++
 build-aux/git-version-gen |   42 +++++++++++++++++++++++++++++-------------
 configure.ac              |    4 ++--
 3 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8fe8873..fc0183b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-21  Eric Blake  <address@hidden>
+
+       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  <address@hidden>
 
        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 20c759e..1a00107 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 cfd8643..caff001 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]),
        address@hidden)
 AC_SUBST([PACKAGE_NAME])dnl
 AC_CONFIG_SRCDIR([ChangeLog])
-- 
1.5.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]