changeset 13379:d62002e5d9f4

git-version-gen: take a sed script to transform the git tag * build-aux/git-version-gen (tag_sed_script): New variable. Use it to transform the output of "git describe" to the canonical form. * top/GNUmakefile (_curr-ver): Pass $(git-version-gen-tag-sed-script) as a second argument to `git-version-gen'.
author Ludovic Courtès <ludo@gnu.org>
date Fri, 28 May 2010 12:15:23 +0200
parents c4a059473950
children 6f654cc21888
files build-aux/git-version-gen top/GNUmakefile
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2010-04-26.16; # UTC
+scriptversion=2010-05-28.15; # UTC
 
 # Copyright (C) 2007-2010 Free Software Foundation, Inc.
 #
@@ -67,11 +67,14 @@
 #	echo $(VERSION) > $(distdir)/.tarball-version
 
 case $# in
-    1) ;;
-    *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;;
+    1|2) ;;
+    *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version" \
+         '[TAG-NORMALIZATION-SED-SCRIPT]'
+       exit 1;;
 esac
 
 tarball_version_file=$1
+tag_sed_script="${2:-s/x/x/}"
 nl='
 '
 
@@ -95,6 +98,7 @@
 elif test -d .git \
     && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
 	  || git describe --abbrev=4 HEAD 2>/dev/null` \
+    && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
     && case $v in
 	 v[0-9]*) ;;
 	 *) (exit 1) ;;
--- a/top/GNUmakefile
+++ b/top/GNUmakefile
@@ -60,8 +60,10 @@
     $(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
   _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
   ifneq (,$(_is-dist-target)$(_is-install-target))
-    _curr-ver := $(shell cd $(srcdir) \
-                   && $(_build-aux)/git-version-gen .tarball-version)
+    _curr-ver := $(shell cd $(srcdir)				\
+                   && $(_build-aux)/git-version-gen		\
+                         .tarball-version			\
+                         $(git-version-gen-tag-sed-script))
     ifneq ($(_curr-ver),$(VERSION))
       ifeq ($(_curr-ver),UNKNOWN)
         $(info WARNING: unable to verify if $(VERSION) is the correct version)