Bug 1407285 - Handle path with spaces in tools/update-packaging/ r?glandium draft
authorSylvestre Ledru <sledru@mozilla.com>
Sat, 14 Oct 2017 13:36:55 +0200
changeset 703223 91f281edc7d6b9ae65822fb813d10369185f62aa
parent 703222 32fe1b2884c74be40626bb00daaebb066ee3f30f
child 703224 6571172b9c73124a0e9389d8fc0f35e79ef90a05
push id90757
push userbmo:sledru@mozilla.com
push dateFri, 24 Nov 2017 16:42:30 +0000
reviewersglandium
bugs1407285
milestone58.0a1
Bug 1407285 - Handle path with spaces in tools/update-packaging/ r?glandium MozReview-Commit-ID: 2WVzUckECNm
tools/update-packaging/common.sh
tools/update-packaging/make_full_update.sh
--- a/tools/update-packaging/common.sh
+++ b/tools/update-packaging/common.sh
@@ -78,25 +78,25 @@ make_add_instruction() {
   fi
 
   is_extension=$(echo "$f" | grep -c 'distribution/extensions/.*/')
   if [ $is_extension = "1" ]; then
     # Use the subdirectory of the extensions folder as the file to test
     # before performing this add instruction.
     testdir=$(echo "$f" | sed 's/\(.*distribution\/extensions\/[^\/]*\)\/.*/\1/')
     notice "     add-if \"$testdir\" \"$f\""
-    echo "add-if \"$testdir\" \"$f\"" >> $filev2
+    echo "add-if \"$testdir\" \"$f\"" >> "$filev2"
     if [ ! $filev3 = "" ]; then
-      echo "add-if \"$testdir\" \"$f\"" >> $filev3
+      echo "add-if \"$testdir\" \"$f\"" >> "$filev3"
     fi
   else
     notice "        add \"$f\"$forced"
-    echo "add \"$f\"" >> $filev2
+    echo "add \"$f\"" >> "$filev2"
     if [ ! $filev3 = "" ]; then
-      echo "add \"$f\"" >> $filev3
+      echo "add \"$f\"" >> "$filev3"
     fi
   fi
 }
 
 check_for_add_if_not_update() {
   add_if_not_file_chk="$1"
 
   if [ `basename $add_if_not_file_chk` = "channel-prefs.js" -o \
@@ -133,22 +133,22 @@ make_patch_instruction() {
   filev3="$3"
 
   is_extension=$(echo "$f" | grep -c 'distribution/extensions/.*/')
   if [ $is_extension = "1" ]; then
     # Use the subdirectory of the extensions folder as the file to test
     # before performing this add instruction.
     testdir=$(echo "$f" | sed 's/\(.*distribution\/extensions\/[^\/]*\)\/.*/\1/')
     notice "   patch-if \"$testdir\" \"$f.patch\" \"$f\""
-    echo "patch-if \"$testdir\" \"$f.patch\" \"$f\"" >> $filev2
-    echo "patch-if \"$testdir\" \"$f.patch\" \"$f\"" >> $filev3
+    echo "patch-if \"$testdir\" \"$f.patch\" \"$f\"" >> "$filev2"
+    echo "patch-if \"$testdir\" \"$f.patch\" \"$f\"" >> "$filev3"
   else
     notice "      patch \"$f.patch\" \"$f\""
-    echo "patch \"$f.patch\" \"$f\"" >> $filev2
-    echo "patch \"$f.patch\" \"$f\"" >> $filev3
+    echo "patch \"$f.patch\" \"$f\"" >> "$filev2"
+    echo "patch \"$f.patch\" \"$f\"" >> "$filev3"
   fi
 }
 
 append_remove_instructions() {
   dir="$1"
   filev2="$2"
   filev3="$3"
 
@@ -167,28 +167,28 @@ append_remove_instructions() {
       # Trim whitespace
       f=$(echo $f)
       # Exclude blank lines.
       if [ -n "$f" ]; then
         # Exclude comments
         if [ ! $(echo "$f" | grep -c '^#') = 1 ]; then
           if [ $(echo "$f" | grep -c '\/$') = 1 ]; then
             notice "      rmdir \"$f\""
-            echo "rmdir \"$f\"" >> $filev2
-            echo "rmdir \"$f\"" >> $filev3
+            echo "rmdir \"$f\"" >> "$filev2"
+            echo "rmdir \"$f\"" >> "$filev3"
           elif [ $(echo "$f" | grep -c '\/\*$') = 1 ]; then
             # Remove the *
             f=$(echo "$f" | sed -e 's:\*$::')
             notice "    rmrfdir \"$f\""
-            echo "rmrfdir \"$f\"" >> $filev2
-            echo "rmrfdir \"$f\"" >> $filev3
+            echo "rmrfdir \"$f\"" >> "$filev2"
+            echo "rmrfdir \"$f\"" >> "$filev3"
           else
             notice "     remove \"$f\""
-            echo "remove \"$f\"" >> $filev2
-            echo "remove \"$f\"" >> $filev3
+            echo "remove \"$f\"" >> "$filev2"
+            echo "remove \"$f\"" >> "$filev3"
           fi
         fi
       fi
     done
   fi
 }
 
 # List all files in the current directory, stripping leading "./"
--- a/tools/update-packaging/make_full_update.sh
+++ b/tools/update-packaging/make_full_update.sh
@@ -62,23 +62,23 @@ if [ ! -f "precomplete" ]; then
   fi
 fi
 
 list_files files
 
 popd
 
 # Add the type of update to the beginning of the update manifests.
-> $updatemanifestv2
-> $updatemanifestv3
+> "$updatemanifestv2"
+> "$updatemanifestv3"
 notice ""
 notice "Adding type instruction to update manifests"
 notice "       type complete"
-echo "type \"complete\"" >> $updatemanifestv2
-echo "type \"complete\"" >> $updatemanifestv3
+echo "type \"complete\"" >> "$updatemanifestv2"
+echo "type \"complete\"" >> "$updatemanifestv3"
 
 notice ""
 notice "Adding file add instructions to update manifests"
 num_files=${#files[*]}
 
 for ((i=0; $i<$num_files; i=$i+1)); do
   f="${files[$i]}"