diff options
author | Jim Meyering <meyering@redhat.com> | 2007-10-22 19:54:52 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2007-10-28 15:29:01 +0100 |
commit | 441bb2a1c354b07da17ce0751fb9a41aa2cfdcbe (patch) | |
tree | 9b797f29db85e9187d4d6fcac9f4e0959f5a25c1 | |
parent | 0f345668724e79af9c89555a480c83ce7d7ed953 (diff) | |
download | autoconf-441bb2a1c354b07da17ce0751fb9a41aa2cfdcbe.tar.gz |
Make inter-release --version output more useful.
Now, each unofficial build has a version "number" like 2.61a-19-58dd,
which indicates that it is built using the 19th change set
(in _some_ repository) following the "v2.61a" tag, and that 58dd
is a prefix of the commit SHA1.
* build-aux/git-version-gen: New file.
* configure.ac: Run it to set the version.
(AM_INIT_AUTOMAKE): Don't check NEWS here.
* Makefile.am (dist-hook): Arrange so that .version appears only
in distribution tarballs, never in a checked-out repository.
* .gitignore: Add .version here, too. Just in case.
* tests/Makefile.am ($(srcdir)/package.m4): Depend on Makefile,
not configure.ac, now that the version number changes automatically.
Ensure that $(VERSION) is up to date for dist-related targets.
* GNUmakefile: Arrange to rerun autoconf, if the version reported by
git-version-gen doesn't match $(VERSION), but only for dist targets.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | GNUmakefile | 14 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | README-hacking | 1 | ||||
-rwxr-xr-x | build-aux/git-version-gen | 65 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | tests/Makefile.am | 2 |
8 files changed, 111 insertions, 3 deletions
@@ -1,6 +1,7 @@ *.log *~ .#* +.version CVS Makefile Makefile.in @@ -1,3 +1,24 @@ +2007-10-28 Jim Meyering <meyering@redhat.com> + + Make inter-release --version output more useful. + + Now, each unofficial build has a version "number" like 2.61a-19-58dd, + which indicates that it is built using the 19th change set + (in _some_ repository) following the "v2.61a" tag, and that 58dd + is a prefix of the commit SHA1. + * build-aux/git-version-gen: New file. + * configure.ac: Run it to set the version. + (AM_INIT_AUTOMAKE): Don't check NEWS here. + * Makefile.am (dist-hook): Arrange so that .version appears only + in distribution tarballs, never in a checked-out repository. + * .gitignore: Add .version here, too. Just in case. + * tests/Makefile.am ($(srcdir)/package.m4): Depend on Makefile, + not configure.ac, now that the version number changes automatically. + + Ensure that $(VERSION) is up to date for dist-related targets. + * GNUmakefile: Arrange to rerun autoconf, if the version reported by + git-version-gen doesn't match $(VERSION), but only for dist targets. + 2007-10-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> Fix `Deep Package' failure with a configure script early in PATH diff --git a/GNUmakefile b/GNUmakefile index 7a1b0d2b..30fdcc42 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -39,6 +39,20 @@ ifeq ($(have-Makefile),yes) export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner include Makefile + +# Ensure that $(VERSION) is up to date for dist-related targets, but not +# for others: rerunning autoconf and recompiling everything isn't cheap. +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) + ifneq ($(_curr-ver),$(VERSION)) + $(info INFO: rerunning autoconf for new version string: $(_curr-ver)) + dummy := $(shell rm -rf autom4te.cache; $(AUTOCONF)) + endif + endif +endif + include $(srcdir)/Makefile.cfg include $(srcdir)/Makefile.maint diff --git a/Makefile.am b/Makefile.am index 9c01c5c8..a74088bc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -86,3 +86,8 @@ autom4te-update: for file in $(autom4te_files); do \ $(move_if_change) Fetchdir/$$file $(srcdir)/lib/$$file || exit; \ done + +# Arrange so that .version appears only in distribution tarballs, +# never in a checked-out repository. +dist-hook: + echo $(VERSION) > $(distdir)/.version diff --git a/README-hacking b/README-hacking index 0f0aa295..cbf27545 100644 --- a/README-hacking +++ b/README-hacking @@ -29,6 +29,7 @@ You can get a copy of the source repository like this: The next step is to generate files like configure and Makefile.in: + $ cd autoconf $ aclocal -I m4 $ automake $ autoconf diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen new file mode 100755 index 00000000..812ffb9e --- /dev/null +++ b/build-aux/git-version-gen @@ -0,0 +1,65 @@ +#!/bin/sh +# Print a version string. +# 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 +# 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". + +case $# in + 1) ;; + *) echo 1>&2 "Usage: $0 \$srcdir/.version"; exit 1;; +esac + +tarball_version_file=$1 +nl=' +' + +# First see if there is a tarball-only version file. +# then try git-describe, then default. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || exit 1 + case $v in + *$nl*) v= ;; # reject multi-line output + [0-9]*) ;; + *) v= ;; + esac + test -z "$v" \ + && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2 +fi + +if test -n "$v" +then + : # use $v +elif test -d .git \ + && v=`git describe --abbrev=4 HEAD 2>/dev/null` \ + && case $v in + # FIXME: remove this after v6.10. + COREUTILS-[0-9]*) v=`echo "$v" | sed 's/^COREUTILS-//;s/_/./g'` ;; + v[0-9]*) ;; + *) (exit 1) ;; + esac +then + # Remove the "g" in git-describe's output string. + v=`echo "$v" | sed 's/\(.*\)-g/\1-/'`; +else + v=UNKNOWN +fi + +v=`echo "$v" |sed 's/^v//'` + +git-status > /dev/null 2>&1 +dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= +case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; +esac + +# Omit the trailing newline, so that m4_esyscmd can use the result directly. +echo "$v" | tr -d '\012' diff --git a/configure.ac b/configure.ac index 1a32ea32..4f9a71eb 100644 --- a/configure.ac +++ b/configure.ac @@ -20,13 +20,14 @@ # We need AC_CONFIG_TESTDIR. AC_PREREQ([2.59]) -AC_INIT([GNU Autoconf], [2.61b], [bug-autoconf@gnu.org]) +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]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([check-news 1.7.9 dist-bzip2 readme-alpha]) +AM_INIT_AUTOMAKE([1.7.9 dist-bzip2 readme-alpha]) # We use `/bin/sh -n script' to check that there are no syntax errors # in the scripts. Although incredible, there are /bin/sh that go into diff --git a/tests/Makefile.am b/tests/Makefile.am index c1141c62..4c3ad1a7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -34,7 +34,7 @@ include ../lib/freeze.mk ## package.m4. ## ## ------------ ## -$(srcdir)/package.m4: $(top_srcdir)/configure.ac +$(srcdir)/package.m4: Makefile { \ echo '# Signature of the current package.'; \ echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \ |