From bf821b9887bec422e15f6764efee000dfad3e271 Mon Sep 17 00:00:00 2001 From: Rahul Singhal Date: Mon, 28 Apr 2014 22:06:20 +0530 Subject: [PATCH 1/2] SPARK-1658: Correctly identify if maven is installed and working The current test is checking the exit code of "tail" rather than "mvn". This new check will make sure that mvn is installed and was able to execute the "version command". --- make-distribution.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/make-distribution.sh b/make-distribution.sh index 4ac80efae0ab2..a1654aeee503b 100755 --- a/make-distribution.sh +++ b/make-distribution.sh @@ -43,12 +43,13 @@ FWDIR="$(cd `dirname $0`; pwd)" DISTDIR="$FWDIR/dist" -VERSION=$(mvn help:evaluate -Dexpression=project.version | grep -v "INFO" | tail -n 1) -if [ $? == -1 ] ;then +VERSION_TEXT=$(mvn help:evaluate -Dexpression=project.version 2>/dev/null) +if [ $? != 0 ] ;then echo -e "You need Maven installed to build Spark." echo -e "Download Maven from https://maven.apache.org." exit -1; fi +VERSION=$(echo "$VERSION_TEXT" | grep -v "INFO" | tail -n 1) # Initialize defaults SPARK_HADOOP_VERSION=1.0.4 From 83c03136933c84f041badd53a1c7aa6d48914410 Mon Sep 17 00:00:00 2001 From: Rahul Singhal Date: Sun, 4 May 2014 18:29:51 +0530 Subject: [PATCH 2/2] SPARK-1658: Correctly identify if maven is installed and working Use "set -o pipefail" to catch all pipeline failures and avoid creating an intermidiate variable. --- make-distribution.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/make-distribution.sh b/make-distribution.sh index a1654aeee503b..66dd78facd213 100755 --- a/make-distribution.sh +++ b/make-distribution.sh @@ -43,13 +43,13 @@ FWDIR="$(cd `dirname $0`; pwd)" DISTDIR="$FWDIR/dist" -VERSION_TEXT=$(mvn help:evaluate -Dexpression=project.version 2>/dev/null) -if [ $? != 0 ] ;then +set -o pipefail +VERSION=$(mvn help:evaluate -Dexpression=project.version 2>/dev/null | grep -v "INFO" | tail -n 1) +if [ $? != 0 ]; then echo -e "You need Maven installed to build Spark." echo -e "Download Maven from https://maven.apache.org." exit -1; fi -VERSION=$(echo "$VERSION_TEXT" | grep -v "INFO" | tail -n 1) # Initialize defaults SPARK_HADOOP_VERSION=1.0.4