Accommodate non-srcdir build-from-checkout.

* build-aux/git-version-gen: Require an additional parameter: $srcdir.
Use git's --git-dir=$srcdir/.git option.
Add quotes, in case tarball_version_file contains shell meta-characters.
* GNUmakefile (_curr-ver): Pass $(srcdir) to git-version-gen.
* configure.ac: Pass "." to git-version-gen.
This commit is contained in:
Jim Meyering 2007-11-11 20:05:08 +01:00
parent 703fbf369a
commit 3b793a96bb
4 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,12 @@
2007-11-12 Jim Meyering <meyering@redhat.com>
Accommodate non-srcdir build-from-checkout.
* build-aux/git-version-gen: Require an additional parameter: $srcdir.
Use git's --git-dir=$srcdir/.git option.
Add quotes, in case tarball_version_file contains shell meta-characters.
* GNUmakefile (_curr-ver): Pass $(srcdir) to git-version-gen.
* configure.ac: Pass "." to git-version-gen.
Avoid spurious test failures due to version skew.
* GNUmakefile (dummy): Run $(MAKE) clean after autoreconf -i.

View File

@ -50,7 +50,7 @@ include Makefile
ifeq (0,$(MAKELEVEL))
_is-dist-target = $(filter dist% alpha beta major,$(MAKECMDGOALS))
ifneq (,$(_is-dist-target))
_curr-ver := $(shell build-aux/git-version-gen .version)
_curr-ver := $(shell build-aux/git-version-gen $(srcdir) .version)
ifneq ($(_curr-ver),$(VERSION))
$(info INFO: running autoreconf for new version string: $(_curr-ver))
dummy := $(shell rm -rf autom4te.cache; autoreconf -i && $(MAKE) clean)

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Print a version string.
scriptversion=2007-11-03.22
scriptversion=2007-11-11.19
# Copyright (C) 2007 Free Software Foundation
#
@ -24,14 +24,15 @@ scriptversion=2007-11-03.22
# - 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 .version".
# presumes this script is invoked like "./git-version-gen $srcdir .version".
case $# in
1) ;;
*) echo 1>&2 "Usage: $0 \$srcdir/.version"; exit 1;;
2) ;;
*) echo 1>&2 "Usage: $0 \$srcdir .version"; exit 1;;
esac
tarball_version_file=$1
srcdir=$1
tarball_version_file=$srcdir/$2
nl='
'
@ -39,7 +40,7 @@ nl='
# 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]*) ;;
@ -52,8 +53,8 @@ fi
if test -n "$v"
then
: # use $v
elif test -d .git \
&& v=`git describe --abbrev=4 HEAD 2>/dev/null` \
elif test -d "$srcdir/.git" \
&& v=`git --git-dir="$srcdir/.git" describe --abbrev=4 HEAD 2>/dev/null` \
&& case $v in
v[0-9]*) ;;
*) (exit 1) ;;

View File

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