Skip to content

Commit d0ea496

Browse files
committed
SPARK-2526: Simplify options in make-distribution.sh
Right now we have a bunch of parallel logic in make-distribution.sh that's just extra work to maintain. We should just pass through Maven profiles in this case and keep the script simple. See the JIRA for more details. Author: Patrick Wendell <[email protected]> Closes apache#1445 from pwendell/make-distribution.sh and squashes the following commits: f1294ea [Patrick Wendell] Simplify options in make-distribution.sh.
1 parent 7c23c0d commit d0ea496

File tree

2 files changed

+30
-58
lines changed

2 files changed

+30
-58
lines changed

dev/create-release/create-release.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ make_binary_release() {
9595
cp -r spark spark-$RELEASE_VERSION-bin-$NAME
9696

9797
cd spark-$RELEASE_VERSION-bin-$NAME
98-
./make-distribution.sh $FLAGS --name $NAME --tgz
98+
./make-distribution.sh --name $NAME --tgz $FLAGS
9999
cd ..
100100
cp spark-$RELEASE_VERSION-bin-$NAME/spark-$RELEASE_VERSION-bin-$NAME.tgz .
101101
rm -rf spark-$RELEASE_VERSION-bin-$NAME
@@ -111,9 +111,10 @@ make_binary_release() {
111111
spark-$RELEASE_VERSION-bin-$NAME.tgz.sha
112112
}
113113

114-
make_binary_release "hadoop1" "--with-hive --hadoop 1.0.4"
115-
make_binary_release "cdh4" "--with-hive --hadoop 2.0.0-mr1-cdh4.2.0"
116-
make_binary_release "hadoop2" "--with-hive --with-yarn --hadoop 2.2.0"
114+
make_binary_release "hadoop1" "-Phive -Dhadoop.version=1.0.4"
115+
make_binary_release "cdh4" "-Phive -Dhadoop.version=2.0.0-mr1-cdh4.2.0"
116+
make_binary_release "hadoop2" \
117+
"-Phive -Pyarn -Phadoop-2.2 -Dhadoop.version=2.2.0 -Pyarn.version=2.2.0"
117118

118119
# Copy data
119120
echo "Copying release tarballs"

make-distribution.sh

Lines changed: 25 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,6 @@
2323
# The distribution contains fat (assembly) jars that include the Scala library,
2424
# so it is completely self contained.
2525
# It does not contain source or *.class files.
26-
#
27-
# Optional Arguments
28-
# --tgz: Additionally creates spark-$VERSION-bin.tar.gz
29-
# --hadoop VERSION: Builds against specified version of Hadoop.
30-
# --with-yarn: Enables support for Hadoop YARN.
31-
# --with-hive: Enable support for reading Hive tables.
32-
# --name: A moniker for the release target. Defaults to the Hadoop verison.
33-
#
34-
# Recommended deploy/testing procedure (standalone mode):
35-
# 1) Rsync / deploy the dist/ dir to one host
36-
# 2) cd to deploy dir; ./sbin/start-master.sh
37-
# 3) Verify master is up by visiting web page, ie http://master-ip:8080. Note the spark:// URL.
38-
# 4) ./sbin/start-slave.sh 1 <<spark:// URL>>
39-
# 5) ./bin/spark-shell --master spark://my-master-ip:7077
40-
#
4126

4227
set -o pipefail
4328
set -e
@@ -46,26 +31,35 @@ set -e
4631
FWDIR="$(cd `dirname $0`; pwd)"
4732
DISTDIR="$FWDIR/dist"
4833

49-
# Initialize defaults
50-
SPARK_HADOOP_VERSION=1.0.4
51-
SPARK_YARN=false
52-
SPARK_HIVE=false
5334
SPARK_TACHYON=false
5435
MAKE_TGZ=false
5536
NAME=none
5637

38+
function exit_with_usage {
39+
echo "make-distribution.sh - tool for making binary distributions of Spark"
40+
echo ""
41+
echo "usage:"
42+
echo "./make-distribution.sh [--name] [--tgz] [--with-tachyon] <maven build options>"
43+
echo "See Spark's \"Building with Maven\" doc for correct Maven options."
44+
echo ""
45+
exit 1
46+
}
47+
5748
# Parse arguments
5849
while (( "$#" )); do
5950
case $1 in
6051
--hadoop)
61-
SPARK_HADOOP_VERSION="$2"
62-
shift
52+
echo "Error: '--hadoop' is no longer supported:"
53+
echo "Error: use Maven options -Phadoop.version and -Pyarn.version"
54+
exit_with_usage
6355
;;
6456
--with-yarn)
65-
SPARK_YARN=true
57+
echo "Error: '--with-yarn' is no longer supported, use Maven option -Pyarn"
58+
exit_with_usage
6659
;;
6760
--with-hive)
68-
SPARK_HIVE=true
61+
echo "Error: '--with-hive' is no longer supported, use Maven option -Pyarn"
62+
exit_with_usage
6963
;;
7064
--skip-java-test)
7165
SKIP_JAVA_TEST=true
@@ -80,6 +74,12 @@ while (( "$#" )); do
8074
NAME="$2"
8175
shift
8276
;;
77+
--help)
78+
exit_with_usage
79+
;;
80+
*)
81+
break
82+
;;
8383
esac
8484
shift
8585
done
@@ -143,14 +143,6 @@ else
143143
echo "Making distribution for Spark $VERSION in $DISTDIR..."
144144
fi
145145

146-
echo "Hadoop version set to $SPARK_HADOOP_VERSION"
147-
echo "Release name set to $NAME"
148-
if [ "$SPARK_YARN" == "true" ]; then
149-
echo "YARN enabled"
150-
else
151-
echo "YARN disabled"
152-
fi
153-
154146
if [ "$SPARK_TACHYON" == "true" ]; then
155147
echo "Tachyon Enabled"
156148
else
@@ -162,33 +154,12 @@ cd $FWDIR
162154

163155
export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m"
164156

165-
BUILD_COMMAND="mvn clean package"
166-
167-
# Use special profiles for hadoop versions 0.23.x, 2.2.x, 2.3.x, 2.4.x
168-
if [[ "$SPARK_HADOOP_VERSION" =~ ^0\.23\. ]]; then BUILD_COMMAND="$BUILD_COMMAND -Phadoop-0.23"; fi
169-
if [[ "$SPARK_HADOOP_VERSION" =~ ^2\.2\. ]]; then BUILD_COMMAND="$BUILD_COMMAND -Phadoop-2.2"; fi
170-
if [[ "$SPARK_HADOOP_VERSION" =~ ^2\.3\. ]]; then BUILD_COMMAND="$BUILD_COMMAND -Phadoop-2.3"; fi
171-
if [[ "$SPARK_HADOOP_VERSION" =~ ^2\.4\. ]]; then BUILD_COMMAND="$BUILD_COMMAND -Phadoop-2.4"; fi
172-
if [[ "$SPARK_HIVE" == "true" ]]; then BUILD_COMMAND="$BUILD_COMMAND -Phive"; fi
173-
if [[ "$SPARK_YARN" == "true" ]]; then
174-
# For hadoop versions 0.23.x to 2.1.x, use the yarn-alpha profile
175-
if [[ "$SPARK_HADOOP_VERSION" =~ ^0\.2[3-9]\. ]] ||
176-
[[ "$SPARK_HADOOP_VERSION" =~ ^0\.[3-9][0-9]\. ]] ||
177-
[[ "$SPARK_HADOOP_VERSION" =~ ^1\.[0-9]\. ]] ||
178-
[[ "$SPARK_HADOOP_VERSION" =~ ^2\.[0-1]\. ]]; then
179-
BUILD_COMMAND="$BUILD_COMMAND -Pyarn-alpha"
180-
# For hadoop versions 2.2+, use the yarn profile
181-
elif [[ "$SPARK_HADOOP_VERSION" =~ ^2.[2-9]. ]]; then
182-
BUILD_COMMAND="$BUILD_COMMAND -Pyarn"
183-
fi
184-
BUILD_COMMAND="$BUILD_COMMAND -Dyarn.version=$SPARK_HADOOP_VERSION"
185-
fi
186-
BUILD_COMMAND="$BUILD_COMMAND -Dhadoop.version=$SPARK_HADOOP_VERSION"
187-
BUILD_COMMAND="$BUILD_COMMAND -DskipTests"
157+
BUILD_COMMAND="mvn clean package -DskipTests $@"
188158

189159
# Actually build the jar
190160
echo -e "\nBuilding with..."
191161
echo -e "\$ $BUILD_COMMAND\n"
162+
192163
${BUILD_COMMAND}
193164

194165
# Make directories

0 commit comments

Comments
 (0)