Bug 375415 - MAR generation broken when paths in the MAR contain spaces, r=cf
authorbenjamin@smedbergs.us
Thu, 29 Mar 2007 07:11:40 -0700
changeset 210 c99ffff23cd7b9a7cb018c72ec34cb690b2ca639
parent 209 6af33aa441b5672aaa9f83736443c7e91e589c54
child 211 de651e46125b5b9bc0739139437eb4caf7ad87c3
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscf
bugs375415
milestone1.9a4pre
Bug 375415 - MAR generation broken when paths in the MAR contain spaces, r=cf
tools/update-packaging/common.sh
tools/update-packaging/make_full_update.sh
tools/update-packaging/make_incremental_update.sh
--- a/tools/update-packaging/common.sh
+++ b/tools/update-packaging/common.sh
@@ -88,16 +88,24 @@ append_remove_instructions() {
         fi
       fi
     done
   fi
 }
 
 # List all files in the current directory, stripping leading "./"
 # Skip the channel-prefs.js file as it should not be included in any
-# generated MAR files (see bug 306077).
+# generated MAR files (see bug 306077). Pass a variable name and it will be
+# filled as an array.
 list_files() {
+  count=0
+
   find . -type f \
     ! -name "channel-prefs.js" \
     ! -name "update.manifest" \
-    | sed 's/\.\/\(.*\)/"\1"/' \
-    | sort
+    | sed 's/\.\/\(.*\)/\1/' \
+    | sort > "$workdir/temp-filelist"
+  while read file; do
+    eval "${1}[$count]=\"$file\""
+    (( count++ ))
+  done < "$workdir/temp-filelist"
+  rm "$workdir/temp-filelist"
 }
--- a/tools/update-packaging/make_full_update.sh
+++ b/tools/update-packaging/make_full_update.sh
@@ -31,33 +31,34 @@ fi
 # -----------------------------------------------------------------------------
 
 archive="$1"
 targetdir="$2"
 workdir="$targetdir.work"
 manifest="$workdir/update.manifest"
 targetfiles="update.manifest"
 
+mkdir -p "$workdir"
+
 # Generate a list of all files in the target directory.
 pushd "$targetdir"
 if test $? -ne 0 ; then
   exit 1
 fi
 
-files=($(list_files))
+list_files files
 
 popd
 
-mkdir -p "$workdir"
 > $manifest
 
 num_files=${#files[*]}
 
 for ((i=0; $i<$num_files; i=$i+1)); do
-  eval "f=${files[$i]}"
+  f="${files[$i]}"
 
   notice "processing $f"
 
   make_add_instruction "$f" >> $manifest
 
   dir=$(dirname "$f")
   mkdir -p "$workdir/$dir"
   $BZIP2 -cz9 "$targetdir/$f" > "$workdir/$f"
--- a/tools/update-packaging/make_incremental_update.sh
+++ b/tools/update-packaging/make_incremental_update.sh
@@ -65,43 +65,43 @@ shift $arg_start
 
 archive="$1"
 olddir="$2"
 newdir="$3"
 workdir="$newdir.work"
 manifest="$workdir/update.manifest"
 archivefiles="update.manifest"
 
+mkdir -p "$workdir"
+
 # Generate a list of all files in the target directory.
 pushd "$olddir"
 if test $? -ne 0 ; then
   exit 1
 fi
 
-oldfiles=($(list_files))
+list_files oldfiles
 
 popd
 
 pushd "$newdir"
 if test $? -ne 0 ; then
   exit 1
 fi
 
-list=$(list_files)
-newfiles=($(list_files))
+list_files newfiles
 
 popd
 
-mkdir -p "$workdir"
 > $manifest
 
 num_oldfiles=${#oldfiles[*]}
 
 for ((i=0; $i<$num_oldfiles; i=$i+1)); do
-  eval "f=${oldfiles[$i]}"
+  f="${oldfiles[$i]}"
 
   # This file is created by Talkback, so we can ignore it
   if [ "$f" = "readme.txt" ]; then
     continue 1
   fi
 
   # If this file exists in the new directory as well, then check if it differs.
   if [ -f "$newdir/$f" ]; then
@@ -141,17 +141,17 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); d
     echo "remove \"$f\"" >> $manifest
   fi
 done
 
 # Now, we just need to worry about newly added files
 num_newfiles=${#newfiles[*]}
 
 for ((i=0; $i<$num_newfiles; i=$i+1)); do
-  eval "f=${newfiles[$i]}"
+  f="${newfiles[$i]}"
 
   # If we've already tested this file, then skip it
   for ((j=0; $j<$num_oldfiles; j=$j+1)); do
     if [ "\"$f\"" = "${oldfiles[j]}" ]; then
       continue 2
     fi
   done