summaryrefslogtreecommitdiff
path: root/git-version-gen
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2012-09-25 19:26:18 -0400
committerTanu Kaskinen <tanuk@iki.fi>2012-09-27 15:22:10 +0300
commitf16a532e88f124422aea4c823e6c645382cab263 (patch)
tree91b29383a3a730357b5dc69c6d1dfe9da3fce431 /git-version-gen
parentbf0a640cfd8807cfe856b02c175497e76243e7cd (diff)
downloadpulseaudio-f16a532e88f124422aea4c823e6c645382cab263.tar.gz
git-version-gen: Honor GIT_DESCRIBE_FOR_BUILD environment variable
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.
Diffstat (limited to 'git-version-gen')
-rwxr-xr-xgit-version-gen14
1 files changed, 12 insertions, 2 deletions
diff --git a/git-version-gen b/git-version-gen
index 6181ad920..9d65b8009 100755
--- a/git-version-gen
+++ b/git-version-gen
@@ -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//'`