@@ -90,19 +90,11 @@ NEXUS_ROOT=https://repository.apache.org/service/local/staging
9090NEXUS_PROFILE=d63f592e7eac0 # Profile for Spark staging uploads
9191BASE_DIR=$( pwd)
9292
93- MVN=" build/mvn -B"
94-
95- java_version=$( " ${JAVA_HOME} " /bin/javac -version 2>&1 | cut -d " " -f 2)
96- MVN_EXTRA_OPTS=
97- if [[ $java_version < " 1.8." ]]; then
98- # Needed for maven central when using Java 7.
99- export SBT_OPTS=" -Dhttps.protocols=TLSv1.1,TLSv1.2"
100- MVN_EXTRA_OPTS=" -Dhttps.protocols=TLSv1.1,TLSv1.2"
101- MVN=" $MVN $MVN_EXTRA_OPTS "
102- fi
93+ init_java
94+ init_maven_sbt
10395
10496rm -rf spark
105- git clone https://git-wip-us.apache.org/repos/asf/spark.git
97+ git clone " $ASF_REPO "
10698cd spark
10799git checkout $GIT_REF
108100git_hash=` git rev-parse --short HEAD`
@@ -138,22 +130,16 @@ PUBLISH_PROFILES="$BASE_PROFILES $HIVE_PROFILES -Pspark-ganglia-lgpl -Pkinesis-a
138130# Profiles for building binary releases
139131BASE_RELEASE_PROFILES=" $BASE_PROFILES -Psparkr"
140132
141- # Verify we have the right java version set
142- if [ -z " $JAVA_HOME " ]; then
143- echo " Please set JAVA_HOME."
144- exit 1
145- fi
146-
147133if [[ ! $SPARK_VERSION < " 2.2." ]]; then
148- if [[ $java_version < " 1.8." ]]; then
149- echo " Java version $java_version is less than required 1.8 for 2.2+"
134+ if [[ $JAVA_VERSION < " 1.8." ]]; then
135+ echo " Java version $JAVA_VERSION is less than required 1.8 for 2.2+"
150136 echo " Please set JAVA_HOME correctly."
151137 exit 1
152138 fi
153139else
154- if ! [[ $java_version =~ 1\. 7\. .* ]]; then
140+ if ! [[ $JAVA_VERSION =~ 1\. 7\. .* ]]; then
155141 if [ -z " $JAVA_7_HOME " ]; then
156- echo " Java version $java_version is higher than required 1.7 for pre-2.2"
142+ echo " Java version $JAVA_VERSION is higher than required 1.7 for pre-2.2"
157143 echo " Please set JAVA_HOME correctly."
158144 exit 1
159145 else
@@ -378,13 +364,15 @@ if [[ "$1" == "publish-release" ]]; then
378364
379365 # Using Nexus API documented here:
380366 # https://support.sonatype.com/entries/39720203-Uploading-to-a-Staging-Repository-via-REST-API
381- echo " Creating Nexus staging repository"
382- repo_request=" <promoteRequest><data><description>Apache Spark $SPARK_VERSION (commit $git_hash )</description></data></promoteRequest>"
383- out=$( curl -X POST -d " $repo_request " -u $ASF_USERNAME :$ASF_PASSWORD \
384- -H " Content-Type:application/xml" -v \
385- $NEXUS_ROOT /profiles/$NEXUS_PROFILE /start)
386- staged_repo_id=$( echo $out | sed -e " s/.*\(orgapachespark-[0-9]\{4\}\).*/\1/" )
387- echo " Created Nexus staging repository: $staged_repo_id "
367+ if ! is_dry_run; then
368+ echo " Creating Nexus staging repository"
369+ repo_request=" <promoteRequest><data><description>Apache Spark $SPARK_VERSION (commit $git_hash )</description></data></promoteRequest>"
370+ out=$( curl -X POST -d " $repo_request " -u $ASF_USERNAME :$ASF_PASSWORD \
371+ -H " Content-Type:application/xml" -v \
372+ $NEXUS_ROOT /profiles/$NEXUS_PROFILE /start)
373+ staged_repo_id=$( echo $out | sed -e " s/.*\(orgapachespark-[0-9]\{4\}\).*/\1/" )
374+ echo " Created Nexus staging repository: $staged_repo_id "
375+ fi
388376
389377 tmp_repo=$( mktemp -d spark-repo-XXXXX)
390378
@@ -393,7 +381,7 @@ if [[ "$1" == "publish-release" ]]; then
393381
394382 $MVN -DzincPort=$ZINC_PORT -Dmaven.repo.local=$tmp_repo -DskipTests $SCALA_2_11_PROFILES $PUBLISH_PROFILES clean install
395383
396- if [[ $PUBLISH_SCALA_2_10 = 1 ]]; then
384+ if ! is_dry_run && [[ $PUBLISH_SCALA_2_10 = 1 ]]; then
397385 ./dev/change-scala-version.sh 2.10
398386 $MVN -DzincPort=$(( ZINC_PORT + 1 )) -Dmaven.repo.local=$tmp_repo -Dscala-2.10 \
399387 -DskipTests $PUBLISH_PROFILES $SCALA_2_10_PROFILES clean install
@@ -429,23 +417,26 @@ if [[ "$1" == "publish-release" ]]; then
429417 sha1sum $file | cut -f1 -d' ' > $file .sha1
430418 done
431419
432- nexus_upload=$NEXUS_ROOT /deployByRepositoryId/$staged_repo_id
433- echo " Uplading files to $nexus_upload "
434- for file in $( find . -type f)
435- do
436- # strip leading ./
437- file_short=$( echo $file | sed -e " s/\.\///" )
438- dest_url=" $nexus_upload /org/apache/spark/$file_short "
439- echo " Uploading $file_short "
440- curl -u $ASF_USERNAME :$ASF_PASSWORD --upload-file $file_short $dest_url
441- done
420+ if ! is_dry_run; then
421+ nexus_upload=$NEXUS_ROOT /deployByRepositoryId/$staged_repo_id
422+ echo " Uplading files to $nexus_upload "
423+ for file in $( find . -type f)
424+ do
425+ # strip leading ./
426+ file_short=$( echo $file | sed -e " s/\.\///" )
427+ dest_url=" $nexus_upload /org/apache/spark/$file_short "
428+ echo " Uploading $file_short "
429+ curl -u $ASF_USERNAME :$ASF_PASSWORD --upload-file $file_short $dest_url
430+ done
431+
432+ echo " Closing nexus staging repository"
433+ repo_request=" <promoteRequest><data><stagedRepositoryId>$staged_repo_id </stagedRepositoryId><description>Apache Spark $SPARK_VERSION (commit $git_hash )</description></data></promoteRequest>"
434+ out=$( curl -X POST -d " $repo_request " -u $ASF_USERNAME :$ASF_PASSWORD \
435+ -H " Content-Type:application/xml" -v \
436+ $NEXUS_ROOT /profiles/$NEXUS_PROFILE /finish)
437+ echo " Closed Nexus staging repository: $staged_repo_id "
438+ fi
442439
443- echo " Closing nexus staging repository"
444- repo_request=" <promoteRequest><data><stagedRepositoryId>$staged_repo_id </stagedRepositoryId><description>Apache Spark $SPARK_VERSION (commit $git_hash )</description></data></promoteRequest>"
445- out=$( curl -X POST -d " $repo_request " -u $ASF_USERNAME :$ASF_PASSWORD \
446- -H " Content-Type:application/xml" -v \
447- $NEXUS_ROOT /profiles/$NEXUS_PROFILE /finish)
448- echo " Closed Nexus staging repository: $staged_repo_id "
449440 popd
450441 rm -rf $tmp_repo
451442 cd ..
0 commit comments