flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject [1/2] flink git commit: [FLINK-3585][tools] let deploy scripts work with spaces in paths
Date Mon, 07 Mar 2016 17:17:33 GMT
Repository: flink
Updated Branches:
  refs/heads/master f158f3dcd -> d3808c7bc


[FLINK-3585][tools] let deploy scripts work with spaces in paths


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/d3808c7b
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/d3808c7b
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/d3808c7b

Branch: refs/heads/master
Commit: d3808c7bc060e8837b5a35d6f1f305bd4c446384
Parents: c413b23
Author: Maximilian Michels <mxm@apache.org>
Authored: Mon Mar 7 12:53:23 2016 +0100
Committer: Maximilian Michels <mxm@apache.org>
Committed: Mon Mar 7 18:13:51 2016 +0100

----------------------------------------------------------------------
 tools/deploy_to_maven.sh       | 20 ++++++++++----------
 tools/generate_specific_pom.sh | 29 +++++++++++++++++++----------
 2 files changed, 29 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/d3808c7b/tools/deploy_to_maven.sh
----------------------------------------------------------------------
diff --git a/tools/deploy_to_maven.sh b/tools/deploy_to_maven.sh
index 908611a..bc59570 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}

http://git-wip-us.apache.org/repos/asf/flink/blob/d3808c7b/tools/generate_specific_pom.sh
----------------------------------------------------------------------
diff --git a/tools/generate_specific_pom.sh b/tools/generate_specific_pom.sh
index d3da62f..7023ad3 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:<groupId>org.apache.flink</groupId>\n([\t ]*<artifactId>([a-z]+-)+[a-z0-9\.\_]+</artifactId>\n[\t
]*)<version>${old_version}</version>:<groupId>org.apache.flink</groupId>\n\1<version>${new_version}</version>:g"
$p > "$tmp_nuname1"
+  perl -0777 -pe "s:<groupId>org.apache.flink</groupId>\n([\t ]*<artifactId>([a-z]+-)+[a-z0-9\.\_]+</artifactId>\n[\t
]*)<version>${old_version}</version>:<groupId>org.apache.flink</groupId>\n\1<version>${new_version}</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:<flink.version>${old_version}</flink.version>:<flink.version>${new_version}</flink.version>:g"
"$tmp_nuname1" > "$tmp_nuname2"
@@ -109,8 +117,9 @@ for p in $poms; do
     -e "s/\(relativePath>\.\.\)/\1\/${nupom}/" \
     -e "s/<!--hadoop1-->.*name>.*/${hadoop1}/" \
     -e "s/<!--hadoop2-->.*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
 


Mime
View raw message