brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [1/3] brooklyn-client git commit: better errors in build script if missing/wrong go version
Date Thu, 10 Mar 2016 08:58:08 GMT
Repository: brooklyn-client
Updated Branches:
  refs/heads/master 0623158fd -> d64428c52


better errors in build script if missing/wrong go version

and better progress output


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/8cf78875
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/8cf78875
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/8cf78875

Branch: refs/heads/master
Commit: 8cf78875115072c82b969146c0486f8274239108
Parents: 0623158
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Wed Mar 9 17:35:03 2016 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Wed Mar 9 17:35:03 2016 +0000

----------------------------------------------------------------------
 release/build.sh | 42 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/8cf78875/release/build.sh
----------------------------------------------------------------------
diff --git a/release/build.sh b/release/build.sh
index bc9502e..a872624 100755
--- a/release/build.sh
+++ b/release/build.sh
@@ -30,7 +30,7 @@ CLI_PACKAGE="${PROJECT}/${BRNAME}"
 GOBIN=go
 GODEP=godep
 
-
+START_TIME=$(date +%s)
 
 #
 # Globals
@@ -129,11 +129,38 @@ while [ $# -gt 0 ]; do
 	esac
 done
 
+echo "Starting build.sh (brooklyn-client go build script)"
 
 #
 # Test if go is available
 #
-command -v $GOBIN >/dev/null 2>&1 || { echo "Command for compiling Go not found:
$GOBIN" 1>&2 ; exit 1; }
+if ! command -v $GOBIN >/dev/null 2>&1 ; then
+  cat 1>&2 << \
+--MARKER--
+
+ERROR: Go language binaries not found (running "$GOBIN")
+
+The binaries for go v1.6 must be installed to build the brooklyn-client CLI.
+See golang.org for more information, or run maven with '-Pno-go-client' to skip.
+
+--MARKER--
+  exit 1
+fi
+
+GO_VERSION=`go version | awk '{print $3}'`
+GO_V=`echo $GO_VERSION | sed 's/^go1\.\([0-9][0-9]*\).*/\1/'`
+if ! (( "$GO_V" > 4 )) ; then
+  cat 1>&2 << \
+--MARKER--
+
+ERROR: Incompatible Go language version: $GO_VERSION
+
+Go version 1.6 or higher is required to build the brooklyn-client CLI.
+See golang.org for more information, or run maven with '-Pno-go-client' to skip.
+
+--MARKER--
+  exit 1
+fi
 
 
 if [ -n "$outdir" -a ! -d "$outdir" ]; then
@@ -149,7 +176,7 @@ mkdir -p ${GOPATH}/src/${PROJECT%/*}
 PATH=${GOPATH}/bin:${PATH}
 
 command -v $GODEP >/dev/null 2>&1 || {
-	echo installing $GODEP
+	echo Installing $GODEP
 	go get github.com/tools/godep || { echo failed installing $GODEP ; exit 1; }
 }
 
@@ -216,4 +243,13 @@ else
 	done
 fi
 
+echo
+echo Successfully built the following binaries:
+echo
+ls -al ${GO_PATH}/bin/
+echo
+
+END_TIME=$(date +%s)
+echo "Completed build.sh (brooklyn-client go build script) in $(( $END_TIME - START_TIME
))s"
+
 exit 0


Mime
View raw message