diff --git a/tools/deploy_to_maven.sh b/tools/deploy_to_maven.sh index 908611a57d5bf..bc5957046c781 100755 --- a/tools/deploy_to_maven.sh +++ b/tools/deploy_to_maven.sh @@ -22,15 +22,15 @@ # function getVersion() { - here="`dirname \"$0\"`" # relative - here="`( cd \"$here\" && pwd )`" # absolutized and normalized - if [ -z "$here" ] ; then - # error; for some reason, the path is not accessible - # to the script (e.g. permissions re-evaled after suid) - exit 1 # fail - fi - flink_home="`dirname \"$here\"`" - cd $flink_home + here="`dirname \"$0\"`" # relative + here="`( cd \"$here\" && pwd )`" # absolutized and normalized + if [ -z "$here" ] ; then + # error; for some reason, the path is not accessible + # to the script (e.g. permissions re-evaled after suid) + exit 1 # fail + fi + flink_home="`dirname \"$here\"`" + cd "$flink_home" echo `mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -E '^([0-9]+.[0-9]+(.[0-9]+)?(-[a-zA-Z0-9]+)?)$'` } @@ -69,7 +69,7 @@ cd dummy-lifecycle-mapping-plugin mvn -B install cd .. -# this will take a while + CURRENT_FLINK_VERSION=`getVersion` if [[ "$CURRENT_FLINK_VERSION" == *-SNAPSHOT ]]; then CURRENT_FLINK_VERSION_HADOOP1=${CURRENT_FLINK_VERSION/-SNAPSHOT/-hadoop1-SNAPSHOT} diff --git a/tools/generate_specific_pom.sh b/tools/generate_specific_pom.sh index d3da62fb24322..7023ad39d619b 100755 --- a/tools/generate_specific_pom.sh +++ b/tools/generate_specific_pom.sh @@ -78,12 +78,20 @@ if [[ -z "$new_pom_name" ]]; then fi echo "Using $nupom as name for the generated pom file." -poms=`find $flink_home -name pom.xml` -for p in $poms; do +# export relevant variables for find command subshells +export hadoop1 +export hadoop2 +export nupom + +# paths may contain spaces +find "$flink_home" -name pom.xml -exec bash -c ' + + p="$0" + # write into tmp file because in-place replacement is not possible (if nupom="pom.xml") - tmp_nuname1="`dirname $p`/__generate_specific_pom_tmp1" - tmp_nuname2="`dirname $p`/__generate_specific_pom_tmp2" - nuname="`dirname $p`/${nupom}" + tmp_nuname1="`dirname "$p"`/__generate_specific_pom_tmp1" + tmp_nuname2="`dirname "$p"`/__generate_specific_pom_tmp2" + nuname="`dirname "$p"`/${nupom}" # Now we do search and replace of explicit strings. The best way of # seeing what the below does is by doing a diff between the original # pom and the generated pom (pom.hadoop1.xml or pom.hadoop2.xml). We @@ -97,7 +105,7 @@ for p in $poms; do # To avoid accidentally replace version numbers in our dependencies # sharing the version number with the current release use the following. - perl -0777 -pe "s:org.apache.flink\n([\t ]*([a-z]+-)+[a-z0-9\.\_]+\n[\t ]*)${old_version}:org.apache.flink\n\1${new_version}:g" $p > "$tmp_nuname1" + perl -0777 -pe "s:org.apache.flink\n([\t ]*([a-z]+-)+[a-z0-9\.\_]+\n[\t ]*)${old_version}:org.apache.flink\n\1${new_version}:g" "$p" > "$tmp_nuname1" # replace the version also in the quickstart poms (so that the hadoop1 quickstart creates an hadoop1 project) perl -0777 -pe "s:${old_version}:${new_version}:g" "$tmp_nuname1" > "$tmp_nuname2" @@ -109,8 +117,9 @@ for p in $poms; do -e "s/\(relativePath>\.\.\)/\1\/${nupom}/" \ -e "s/.*name>.*/${hadoop1}/" \ -e "s/.*name>.*/${hadoop2}/" \ - $tmp_nuname2 > "$tmp_nuname1" - rm $tmp_nuname2 - mv $tmp_nuname1 $nuname -done + "$tmp_nuname2" > "$tmp_nuname1" + rm "$tmp_nuname2" + mv "$tmp_nuname1" "$nuname" + +' "{}" \; # pass file name as argument