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