build.bash: use plain "git describe" for go-fuse

go-fuse recently added a git tag - let's use it.
This commit is contained in:
Jakob Unterwurzacher 2017-06-20 18:59:48 +02:00
parent c9c4bc0141
commit f3965a4e4c
1 changed files with 12 additions and 20 deletions

View File

@ -3,6 +3,7 @@
set -eu
cd "$(dirname "$0")"
# GOPATH may contain multiple paths separated by ":"
GOPATH1=$(go env GOPATH | cut -f1 -d:)
@ -11,26 +12,17 @@ GOPATH1=$(go env GOPATH | cut -f1 -d:)
GITVERSION=$(git describe --tags --dirty)
# go-fuse version according to git
# Note: git in CentOS 7 does not have "git -C" yet. That's why we use
# plain "cd" in a subshell.
cd $GOPATH1/src/
SHORT=$(git rev-parse --short HEAD)
if [[ $SHORT == 5e829bc ]] ; then
echo "Error: The version $SHORT of the go-fuse library has a known crasher that" >&2
echo "has been fixed by . Please upgrade." >&2
exit 1
# Check if the tree is dirty, adapted from
if ! git diff-index --quiet HEAD ; then
echo $SHORT-dirty
echo $SHORT
# Note: git in CentOS 7 does not have "git -C" yet, so we use plain "cd".
cd $GOPATH1/src/
OUT=$(git describe --tags --dirty 2>&1) || FAIL=1
if [[ $FAIL -ne 0 ]]; then
echo "$PWD: git describe: $OUT"
echo "Hint: are you missing git tags?"
exit 1
cd "$MYDIR"
# Build Unix timestamp, something like 1467554204.
BUILDTIME=$(date +%s)