]> code.delx.au - pulseaudio/commitdiff
git-version-gen: Honor GIT_DESCRIBE_FOR_BUILD environment variable
authorColin Walters <walters@verbum.org>
Tue, 25 Sep 2012 23:26:18 +0000 (19:26 -0400)
committerTanu Kaskinen <tanuk@iki.fi>
Thu, 27 Sep 2012 12:22:10 +0000 (15:22 +0300)
The GNOME-OSTree build system currently creates chroots and bind
mounts to the source tree outside the root; this means that we can't
necessarily run git inside the root, because in the case of git
submodules, the .git repository will point to outside root.

Also, error out fatally if we fail to determine the version; it
makes no sense to put UNKNOWN in e.g. the pkg-config files
since this will just cause errors later on.

configure.ac
git-version-gen

index 06923e3b973cc3e2b69dc84fe59996da87387226..19f60899d9b1fd45a29dbff3a1cd3b1db2ccf465 100644 (file)
@@ -28,6 +28,10 @@ AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules color-tests dist-xz tar-ustar])
 
+AS_IF([! test -n "$VERSION"], [
+   AC_MSG_ERROR([git-version-gen failed])
+])
+
 m4_define(pa_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
 m4_define(pa_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
 
index 6181ad92058d453edad8aba8714a2328efd040db..9d65b80098ffcc8a185021d95137b3a941f9441c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2008-04-08.07.01
+scriptversion=2012-09-25.20
 
 # Copyright (C) 2007-2008 Free Software Foundation
 #
@@ -93,6 +93,15 @@ then
        && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2
 fi
 
+# This is presently used by the GNOME-OSTree build system; it
+# helps support the case where the meta-build system has already
+# determined the git revision, but we may not be able to run "git describe"
+# because we're inside a chroot.
+if test -n "$GIT_DESCRIBE_FOR_BUILD";
+then
+    v=$GIT_DESCRIBE_FOR_BUILD
+fi
+
 if test -n "$v"
 then
     : # use $v
@@ -133,7 +142,8 @@ then
 #    v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
     :
 else
-    v=UNKNOWN
+    echo 1>&2 "$0: Failed to determine git revision"
+    exit 1
 fi
 
 v=`echo "$v" |sed 's/^v//'`