build.bash: abort if we hit a known-bad go-fuse version

Also, standardize to "if [[ ]] ; then" style.
This commit is contained in:
Jakob Unterwurzacher 2016-10-30 16:10:40 +01:00
parent 85f1fd0b0f
commit c7385b3681

View File

@ -11,13 +11,21 @@ GOPATH2=$(echo $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
# plain "cd" in a subshell.
GITVERSIONFUSE=$( GITVERSIONFUSE=$(
cd $GOPATH2/src/github.com/hanwen/go-fuse cd $GOPATH2/src/github.com/hanwen/go-fuse
SHORT=$(git rev-parse --short HEAD) 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 https://github.com/hanwen/go-fuse/pull/131 . Please upgrade." >&2
exit 1
fi
# Check if the tree is dirty, adapted from # Check if the tree is dirty, adapted from
# http://stackoverflow.com/a/2659808/1380267 # http://stackoverflow.com/a/2659808/1380267
if ! git diff-index --quiet HEAD; then if ! git diff-index --quiet HEAD ; then
echo $SHORT-dirty echo $SHORT-dirty
else else
echo $SHORT echo $SHORT
@ -33,8 +41,7 @@ go version > /dev/null
# "go version go1.6.2 linux/amd64" -> "1.6" # "go version go1.6.2 linux/amd64" -> "1.6"
V=$(go version | cut -d" " -f3 | cut -c3-5) V=$(go version | cut -d" " -f3 | cut -c3-5)
if [ $V == "1.3" -o $V == "1.4" ] if [[ $V == "1.3" || $V == "1.4" ]] ; then
then
go build -ldflags="-X main.GitVersion $GITVERSION -X main.GitVersionFuse $GITVERSIONFUSE -X main.BuildTime $BUILDTIME" $@ go build -ldflags="-X main.GitVersion $GITVERSION -X main.GitVersionFuse $GITVERSIONFUSE -X main.BuildTime $BUILDTIME" $@
else else
# Go 1.5 wants an "=" here # Go 1.5 wants an "=" here