зеркало из https://github.com/mozilla/gecko-dev.git
Mac v2 signing - Bug 1059567 - Packaging changes for the move of removed-files file from Contents/MacOS to Contents/Resources. r=bbondy, r=nthomas
--HG-- rename : tools/update-packaging/test/from-mac/Contents/MacOS/application.ini => tools/update-packaging/test/from-mac/Contents/Resources/application.ini rename : tools/update-packaging/test/from-mac/Contents/MacOS/distribution/extensions/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/from-mac/Contents/Resources/distribution/extensions/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/extensions/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/from-mac/Contents/Resources/extensions/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/readme.txt => tools/update-packaging/test/from-mac/Contents/Resources/readme.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/removed.txt => tools/update-packaging/test/from-mac/Contents/Resources/removed.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/same.txt => tools/update-packaging/test/from-mac/Contents/Resources/same.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/searchplugins/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/from-mac/Contents/Resources/searchplugins/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/update-settings.ini => tools/update-packaging/test/from-mac/Contents/Resources/update-settings.ini rename : tools/update-packaging/test/from-mac/Contents/MacOS/{foodir/channel-prefs.js => tools/update-packaging/test/from-mac/Contents/Resources/{foodir/channel-prefs.js rename : tools/update-packaging/test/from-mac/Contents/MacOS/{foodir/force.txt => tools/update-packaging/test/from-mac/Contents/Resources/{foodir/force.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/application.ini => tools/update-packaging/test/to-mac/Contents/Resources/application.ini rename : tools/update-packaging/test/to-mac/Contents/MacOS/distribution/extensions/added/file.txt => tools/update-packaging/test/to-mac/Contents/Resources/distribution/extensions/added/file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/distribution/extensions/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/to-mac/Contents/Resources/distribution/extensions/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/extensions/added/file.txt => tools/update-packaging/test/to-mac/Contents/Resources/extensions/added/file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/extensions/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/to-mac/Contents/Resources/extensions/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/readme.txt => tools/update-packaging/test/to-mac/Contents/Resources/readme.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/removed-files => tools/update-packaging/test/to-mac/Contents/Resources/removed-files rename : tools/update-packaging/test/to-mac/Contents/MacOS/same.txt => tools/update-packaging/test/to-mac/Contents/Resources/same.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/searchplugins/added/file.txt => tools/update-packaging/test/to-mac/Contents/Resources/searchplugins/added/file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/searchplugins/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/to-mac/Contents/Resources/searchplugins/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/update-settings.ini => tools/update-packaging/test/to-mac/Contents/Resources/update-settings.ini rename : tools/update-packaging/test/to-mac/Contents/MacOS/{foodir/channel-prefs.js => tools/update-packaging/test/to-mac/Contents/Resources/{foodir/channel-prefs.js rename : tools/update-packaging/test/to-mac/Contents/MacOS/{foodir/force.txt => tools/update-packaging/test/to-mac/Contents/Resources/{foodir/force.txt
This commit is contained in:
Родитель
2230b3918e
Коммит
e401342c35
|
@ -52,51 +52,66 @@
|
||||||
#
|
#
|
||||||
# Example: path/to/dir/*
|
# Example: path/to/dir/*
|
||||||
|
|
||||||
|
# Due to Apple Mac OS X packaging requirements files that are in the same
|
||||||
|
# directory on other platforms must be located in different directories on
|
||||||
|
# Mac OS X. The following defines allow specifying the Mac OS X bundle
|
||||||
|
# location which also work on other platforms.
|
||||||
|
#
|
||||||
|
# @DIR_MACOS@
|
||||||
|
# Equals Contents/MacOS/ on Mac OX X and is an empty string on other platforms.
|
||||||
|
#
|
||||||
|
# @DIR_RESOURCES@
|
||||||
|
# Equals Contents/Resources/ on Mac OX X and is an empty string on other
|
||||||
|
# platforms.
|
||||||
|
|
||||||
# File Removals
|
# File Removals
|
||||||
# This is located under the "distribution/" directory and it was added before
|
# This is located under the "distribution/" directory and it was added before
|
||||||
# Firefox 27
|
# Firefox 27
|
||||||
distribution/extensions/testpilot@labs.mozilla.com.xpi
|
@DIR_MACOS@distribution/extensions/testpilot@labs.mozilla.com.xpi
|
||||||
|
|
||||||
# Some users are ending up with unpacked chrome instead of omni.ja. This
|
# Some users are ending up with unpacked chrome instead of omni.ja. This
|
||||||
# causes updates to break badly, see bug 1063052. Removing the toplevel
|
# causes updates to break badly, see bug 1063052. Removing the toplevel
|
||||||
# chrome.manifest causes us to use the updated omni.ja.
|
# chrome.manifest causes us to use the updated omni.ja.
|
||||||
#ifndef MOZ_GTK
|
#ifndef MOZ_GTK
|
||||||
chrome.manifest
|
@DIR_MACOS@chrome.manifest
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
@DIR_RESOURCES@chrome.manifest
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# Directory removals
|
# Directory removals
|
||||||
chrome/
|
@DIR_MACOS@chrome/
|
||||||
#ifdef XP_UNIX
|
#ifdef XP_UNIX
|
||||||
#ifndef XP_MACOSX
|
#ifndef XP_MACOSX
|
||||||
chrome/icons/
|
chrome/icons/
|
||||||
chrome/icons/default/
|
chrome/icons/default/
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
chrome/overlayinfo/
|
@DIR_MACOS@chrome/overlayinfo/
|
||||||
components/
|
@DIR_MACOS@components/
|
||||||
defaults/autoconfig/
|
@DIR_MACOS@defaults/autoconfig/
|
||||||
defaults/profile/
|
@DIR_MACOS@defaults/profile/
|
||||||
defaults/profile/chrome/
|
@DIR_MACOS@defaults/profile/chrome/
|
||||||
defaults/profile/US/*
|
@DIR_MACOS@defaults/profile/US/*
|
||||||
defaults/profile/extensions/
|
@DIR_MACOS@defaults/profile/extensions/
|
||||||
defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
|
@DIR_MACOS@defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
|
||||||
distribution/
|
@DIR_MACOS@distribution/
|
||||||
distribution/extensions/
|
@DIR_MACOS@distribution/extensions/
|
||||||
extensions/
|
@DIR_MACOS@extensions/
|
||||||
extensions/inspector@mozilla.org/*
|
@DIR_MACOS@extensions/inspector@mozilla.org/*
|
||||||
extensions/reporter@mozilla.org/*
|
@DIR_MACOS@extensions/reporter@mozilla.org/*
|
||||||
extensions/talkback@mozilla.org/*
|
@DIR_MACOS@extensions/talkback@mozilla.org/*
|
||||||
extensions/testpilot@labs.mozilla.com/*
|
@DIR_MACOS@extensions/testpilot@labs.mozilla.com/*
|
||||||
extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/*
|
@DIR_MACOS@extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/*
|
||||||
extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
|
@DIR_MACOS@extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
|
||||||
greprefs/
|
@DIR_MACOS@greprefs/
|
||||||
jssubloader/
|
@DIR_MACOS@jssubloader/
|
||||||
modules/
|
@DIR_MACOS@modules/
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
plugins/Default Plugin.plugin/*
|
@DIR_MACOS@plugins/Default Plugin.plugin/*
|
||||||
plugins/JavaEmbeddingPlugin.bundle/*
|
@DIR_MACOS@plugins/JavaEmbeddingPlugin.bundle/*
|
||||||
plugins/MRJPlugin.plugin/*
|
@DIR_MACOS@plugins/MRJPlugin.plugin/*
|
||||||
../Plug-Ins/PrintPDE.plugin/*
|
Contents/Plug-Ins/PrintPDE.plugin/*
|
||||||
#endif
|
#endif
|
||||||
searchplugins/*
|
@DIR_MACOS@searchplugins/*
|
||||||
webapprt/components/
|
@DIR_MACOS@webapprt/components/
|
||||||
|
|
|
@ -608,6 +608,12 @@ endif
|
||||||
|
|
||||||
DEFINES += -DDLL_PREFIX=$(DLL_PREFIX) -DDLL_SUFFIX=$(DLL_SUFFIX) -DBIN_SUFFIX=$(BIN_SUFFIX)
|
DEFINES += -DDLL_PREFIX=$(DLL_PREFIX) -DDLL_SUFFIX=$(DLL_SUFFIX) -DBIN_SUFFIX=$(BIN_SUFFIX)
|
||||||
|
|
||||||
|
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||||
|
DEFINES += -DDIR_MACOS=Contents/MacOS/ -DDIR_RESOURCES=Contents/Resources/
|
||||||
|
else
|
||||||
|
DEFINES += -DDIR_MACOS= -DDIR_RESOURCES=
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef MOZ_FOLD_LIBS
|
ifdef MOZ_FOLD_LIBS
|
||||||
DEFINES += -DMOZ_FOLD_LIBS=1
|
DEFINES += -DMOZ_FOLD_LIBS=1
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -130,11 +130,9 @@ append_remove_instructions() {
|
||||||
filev3="$3"
|
filev3="$3"
|
||||||
|
|
||||||
if [ -f "$dir/removed-files" ]; then
|
if [ -f "$dir/removed-files" ]; then
|
||||||
prefix=
|
|
||||||
listfile="$dir/removed-files"
|
listfile="$dir/removed-files"
|
||||||
elif [ -f "$dir/Contents/MacOS/removed-files" ]; then
|
elif [ -f "$dir/Contents/Resources/removed-files" ]; then
|
||||||
prefix=Contents/MacOS/
|
listfile="$dir/Contents/Resources/removed-files"
|
||||||
listfile="$dir/Contents/MacOS/removed-files"
|
|
||||||
fi
|
fi
|
||||||
if [ -n "$listfile" ]; then
|
if [ -n "$listfile" ]; then
|
||||||
# Map spaces to pipes so that we correctly handle filenames with spaces.
|
# Map spaces to pipes so that we correctly handle filenames with spaces.
|
||||||
|
@ -149,33 +147,20 @@ append_remove_instructions() {
|
||||||
if [ -n "$f" ]; then
|
if [ -n "$f" ]; then
|
||||||
# Exclude comments
|
# Exclude comments
|
||||||
if [ ! $(echo "$f" | grep -c '^#') = 1 ]; then
|
if [ ! $(echo "$f" | grep -c '^#') = 1 ]; then
|
||||||
# Normalize the path to the root of the Mac OS X bundle if necessary
|
|
||||||
fixedprefix="$prefix"
|
|
||||||
if [ $prefix ]; then
|
|
||||||
if [ $(echo "$f" | grep -c '^\.\./') = 1 ]; then
|
|
||||||
if [ $(echo "$f" | grep -c '^\.\./\.\./') = 1 ]; then
|
|
||||||
f=$(echo $f | sed -e 's:^\.\.\/\.\.\/::')
|
|
||||||
fixedprefix=""
|
|
||||||
else
|
|
||||||
f=$(echo $f | sed -e 's:^\.\.\/::')
|
|
||||||
fixedprefix=$(echo "$prefix" | sed -e 's:[^\/]*\/$::')
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ $(echo "$f" | grep -c '\/$') = 1 ]; then
|
if [ $(echo "$f" | grep -c '\/$') = 1 ]; then
|
||||||
notice " rmdir \"$fixedprefix$f\""
|
notice " rmdir \"$f\""
|
||||||
echo "rmdir \"$fixedprefix$f\"" >> $filev2
|
echo "rmdir \"$f\"" >> $filev2
|
||||||
echo "rmdir \"$fixedprefix$f\"" >> $filev3
|
echo "rmdir \"$f\"" >> $filev3
|
||||||
elif [ $(echo "$f" | grep -c '\/\*$') = 1 ]; then
|
elif [ $(echo "$f" | grep -c '\/\*$') = 1 ]; then
|
||||||
# Remove the *
|
# Remove the *
|
||||||
f=$(echo "$f" | sed -e 's:\*$::')
|
f=$(echo "$f" | sed -e 's:\*$::')
|
||||||
notice " rmrfdir \"$fixedprefix$f\""
|
notice " rmrfdir \"$f\""
|
||||||
echo "rmrfdir \"$fixedprefix$f\"" >> $filev2
|
echo "rmrfdir \"$f\"" >> $filev2
|
||||||
echo "rmrfdir \"$fixedprefix$f\"" >> $filev3
|
echo "rmrfdir \"$f\"" >> $filev3
|
||||||
else
|
else
|
||||||
notice " remove \"$fixedprefix$f\""
|
notice " remove \"$f\""
|
||||||
echo "remove \"$fixedprefix$f\"" >> $filev2
|
echo "remove \"$f\"" >> $filev2
|
||||||
echo "remove \"$fixedprefix$f\"" >> $filev3
|
echo "remove \"$f\"" >> $filev3
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -144,17 +144,6 @@ num_removes=0
|
||||||
for ((i=0; $i<$num_oldfiles; i=$i+1)); do
|
for ((i=0; $i<$num_oldfiles; i=$i+1)); do
|
||||||
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
|
|
||||||
|
|
||||||
# removed-files is excluded by make_incremental_updates.py so it is excluded
|
|
||||||
# here for consistency.
|
|
||||||
if [ `basename $f` = "removed-files" ]; then
|
|
||||||
continue 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If this file exists in the new directory as well, then check if it differs.
|
# If this file exists in the new directory as well, then check if it differs.
|
||||||
if [ -f "$newdir/$f" ]; then
|
if [ -f "$newdir/$f" ]; then
|
||||||
|
|
||||||
|
@ -219,12 +208,6 @@ num_newfiles=${#newfiles[*]}
|
||||||
for ((i=0; $i<$num_newfiles; i=$i+1)); do
|
for ((i=0; $i<$num_newfiles; i=$i+1)); do
|
||||||
f="${newfiles[$i]}"
|
f="${newfiles[$i]}"
|
||||||
|
|
||||||
# removed-files is excluded by make_incremental_updates.py so it is excluded
|
|
||||||
# here for consistency.
|
|
||||||
if [ `basename $f` = "removed-files" ]; then
|
|
||||||
continue 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If we've already tested this file, then skip it
|
# If we've already tested this file, then skip it
|
||||||
for ((j=0; $j<$num_oldfiles; j=$j+1)); do
|
for ((j=0; $j<$num_oldfiles; j=$j+1)); do
|
||||||
if [ "$f" = "${oldfiles[j]}" ]; then
|
if [ "$f" = "${oldfiles[j]}" ]; then
|
||||||
|
|
|
@ -22,7 +22,7 @@ class PatchInfo:
|
||||||
archive_files = list of files to include in this patch
|
archive_files = list of files to include in this patch
|
||||||
manifestv2 = set of manifest version 2 patch instructions
|
manifestv2 = set of manifest version 2 patch instructions
|
||||||
manifestv3 = set of manifest version 3 patch instructions
|
manifestv3 = set of manifest version 3 patch instructions
|
||||||
file_exclusion_list =
|
file_exclusion_list =
|
||||||
files to exclude from this patch. names without slashes will be
|
files to exclude from this patch. names without slashes will be
|
||||||
excluded anywhere in the directory hiearchy. names with slashes
|
excluded anywhere in the directory hiearchy. names with slashes
|
||||||
will only be excluded at that exact path
|
will only be excluded at that exact path
|
||||||
|
@ -154,7 +154,7 @@ class PatchInfo:
|
||||||
dirname_set.add(dirname)
|
dirname_set.add(dirname)
|
||||||
|
|
||||||
return mar_entry_hash, filename_set, dirname_set
|
return mar_entry_hash, filename_set, dirname_set
|
||||||
|
|
||||||
|
|
||||||
class MarFileEntry:
|
class MarFileEntry:
|
||||||
"""Represents a file inside a Mozilla Archive Format (MAR)
|
"""Represents a file inside a Mozilla Archive Format (MAR)
|
||||||
|
@ -163,7 +163,7 @@ class MarFileEntry:
|
||||||
foo.mar/dir/bar.txt extracted into /tmp/foo:
|
foo.mar/dir/bar.txt extracted into /tmp/foo:
|
||||||
abs_path=/tmp/foo/dir/bar.txt
|
abs_path=/tmp/foo/dir/bar.txt
|
||||||
name = dir/bar.txt
|
name = dir/bar.txt
|
||||||
"""
|
"""
|
||||||
def __init__(self, root, name):
|
def __init__(self, root, name):
|
||||||
"""root = path the the top of the mar
|
"""root = path the the top of the mar
|
||||||
name = relative path within the mar"""
|
name = relative path within the mar"""
|
||||||
|
@ -211,10 +211,10 @@ def bunzip_file(filename):
|
||||||
if not filename.endswith(".bz2"):
|
if not filename.endswith(".bz2"):
|
||||||
os.rename(filename, filename+".bz2")
|
os.rename(filename, filename+".bz2")
|
||||||
filename=filename+".bz2"
|
filename=filename+".bz2"
|
||||||
exec_shell_cmd('bzip2 -d "' + filename+'"')
|
exec_shell_cmd('bzip2 -d "' + filename+'"')
|
||||||
|
|
||||||
|
|
||||||
def extract_mar(filename, work_dir):
|
def extract_mar(filename, work_dir):
|
||||||
""" Extracts the marfile intot he work_dir
|
""" Extracts the marfile intot he work_dir
|
||||||
assumes work_dir already exists otherwise will throw osError"""
|
assumes work_dir already exists otherwise will throw osError"""
|
||||||
print "Extracting "+filename+" to "+work_dir
|
print "Extracting "+filename+" to "+work_dir
|
||||||
|
@ -280,7 +280,7 @@ def create_partial_patch_for_file(from_marfile_entry, to_marfile_entry, shas, pa
|
||||||
# Copy the pre-calculated file into our new patch work aread
|
# Copy the pre-calculated file into our new patch work aread
|
||||||
copy_file(src_file_abs_path, os.path.join(patch_info.work_dir, file_in_manifest_name))
|
copy_file(src_file_abs_path, os.path.join(patch_info.work_dir, file_in_manifest_name))
|
||||||
patch_info.archive_files.append('"'+file_in_manifest_name+'"')
|
patch_info.archive_files.append('"'+file_in_manifest_name+'"')
|
||||||
|
|
||||||
def create_add_patch_for_file(to_marfile_entry, patch_info):
|
def create_add_patch_for_file(to_marfile_entry, patch_info):
|
||||||
""" Copy the file to the working dir, add the add instruction, and add it to the list of archive files """
|
""" Copy the file to the working dir, add the add instruction, and add it to the list of archive files """
|
||||||
copy_file(to_marfile_entry.abs_path, os.path.join(patch_info.work_dir, to_marfile_entry.name))
|
copy_file(to_marfile_entry.abs_path, os.path.join(patch_info.work_dir, to_marfile_entry.name))
|
||||||
|
@ -293,36 +293,28 @@ def create_add_if_not_patch_for_file(to_marfile_entry, patch_info):
|
||||||
patch_info.append_add_if_not_instruction(to_marfile_entry.name)
|
patch_info.append_add_if_not_instruction(to_marfile_entry.name)
|
||||||
patch_info.archive_files.append('"'+to_marfile_entry.name+'"')
|
patch_info.archive_files.append('"'+to_marfile_entry.name+'"')
|
||||||
|
|
||||||
def process_explicit_remove_files(dir_path, patch_info):
|
def process_explicit_remove_files(dir_path, patch_info):
|
||||||
""" Looks for a 'removed-files' file in the dir_path. If the removed-files does not exist
|
""" Looks for a 'removed-files' file in the dir_path. If the removed-files does not exist
|
||||||
this will throw. If found adds the removed-files
|
this will throw. If found adds the removed-files
|
||||||
found in that file to the patch_info"""
|
found in that file to the patch_info"""
|
||||||
|
|
||||||
# Windows and linux have this file at the root of the dir
|
# Windows and linux have this file at the root of the dir
|
||||||
list_file_path = os.path.join(dir_path, "removed-files")
|
list_file_path = os.path.join(dir_path, "removed-files")
|
||||||
prefix=""
|
|
||||||
if not os.path.exists(list_file_path):
|
if not os.path.exists(list_file_path):
|
||||||
# On Mac removed-files contains relative paths from Contents/MacOS/
|
list_file_path = os.path.join(dir_path, "Contents/Resources/removed-files")
|
||||||
prefix= "Contents/MacOS"
|
|
||||||
list_file_path = os.path.join(dir_path, prefix+"/removed-files")
|
|
||||||
|
|
||||||
if (os.path.exists(list_file_path)):
|
if (os.path.exists(list_file_path)):
|
||||||
list_file = bz2.BZ2File(list_file_path,"r") # throws if doesn't exist
|
list_file = open(list_file_path,"r") # throws if doesn't exist
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
for line in list_file:
|
for line in list_file:
|
||||||
lines.append(line.strip())
|
lines.append(line.strip())
|
||||||
|
list_file.close()
|
||||||
|
|
||||||
lines.sort(reverse=True)
|
lines.sort(reverse=True)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
# Exclude any blank and comment lines.
|
# Exclude any blank and comment lines.
|
||||||
if line and not line.startswith("#"):
|
if line and not line.startswith("#"):
|
||||||
if prefix != "":
|
|
||||||
if line.startswith("../"):
|
|
||||||
line = line.replace("../../", "")
|
|
||||||
line = line.replace("../", "Contents/")
|
|
||||||
else:
|
|
||||||
line = os.path.join(prefix,line)
|
|
||||||
# Python on windows uses \ for path separators and the update
|
# Python on windows uses \ for path separators and the update
|
||||||
# manifests expects / for path separators on all platforms.
|
# manifests expects / for path separators on all platforms.
|
||||||
line = line.replace("\\", "/")
|
line = line.replace("\\", "/")
|
||||||
|
@ -336,7 +328,7 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
|
||||||
# Create a hashtable of the from and to directories
|
# Create a hashtable of the from and to directories
|
||||||
from_dir_hash,from_file_set,from_dir_set = patch_info.build_marfile_entry_hash(from_dir_path)
|
from_dir_hash,from_file_set,from_dir_set = patch_info.build_marfile_entry_hash(from_dir_path)
|
||||||
to_dir_hash,to_file_set,to_dir_set = patch_info.build_marfile_entry_hash(to_dir_path)
|
to_dir_hash,to_file_set,to_dir_set = patch_info.build_marfile_entry_hash(to_dir_path)
|
||||||
# Create a list of the forced updates
|
# Create a list of the forced updates
|
||||||
forced_list = forced_updates.strip().split('|')
|
forced_list = forced_updates.strip().split('|')
|
||||||
# Require that the precomplete file is included in the complete update
|
# Require that the precomplete file is included in the complete update
|
||||||
if "precomplete" not in to_file_set:
|
if "precomplete" not in to_file_set:
|
||||||
|
@ -364,7 +356,7 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
|
||||||
print 'Forcing "'+filename+'"'
|
print 'Forcing "'+filename+'"'
|
||||||
# This filename is in the forced list, explicitly add
|
# This filename is in the forced list, explicitly add
|
||||||
create_add_patch_for_file(to_dir_hash[filename], patch_info)
|
create_add_patch_for_file(to_dir_hash[filename], patch_info)
|
||||||
else:
|
else:
|
||||||
if from_marfile_entry.sha() != to_marfile_entry.sha():
|
if from_marfile_entry.sha() != to_marfile_entry.sha():
|
||||||
# Not the same - calculate a patch
|
# Not the same - calculate a patch
|
||||||
create_partial_patch_for_file(from_marfile_entry, to_marfile_entry, shas, patch_info)
|
create_partial_patch_for_file(from_marfile_entry, to_marfile_entry, shas, patch_info)
|
||||||
|
@ -404,27 +396,27 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
|
||||||
if not os.path.exists(patch_file_dir):
|
if not os.path.exists(patch_file_dir):
|
||||||
os.makedirs(patch_file_dir)
|
os.makedirs(patch_file_dir)
|
||||||
shutil.copy2(os.path.join(patch_info.work_dir,"output.mar"), patch_filename)
|
shutil.copy2(os.path.join(patch_info.work_dir,"output.mar"), patch_filename)
|
||||||
|
|
||||||
return patch_filename
|
return patch_filename
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "-h for help"
|
print "-h for help"
|
||||||
print "-f for patchlist_file"
|
print "-f for patchlist_file"
|
||||||
|
|
||||||
def get_buildid(work_dir, platform):
|
def get_buildid(work_dir):
|
||||||
""" extracts buildid from MAR
|
""" extracts buildid from MAR
|
||||||
TODO: this should handle 1.8 branch too
|
|
||||||
"""
|
"""
|
||||||
if platform == 'mac':
|
ini = '%s/application.ini' % work_dir
|
||||||
ini = '%s/Contents/MacOS/application.ini' % work_dir
|
|
||||||
else:
|
|
||||||
ini = '%s/application.ini' % work_dir
|
|
||||||
if not os.path.exists(ini):
|
if not os.path.exists(ini):
|
||||||
print 'WARNING: application.ini not found, cannot find build ID'
|
ini = '%s/Contents/Resources/application.ini' % work_dir
|
||||||
return ''
|
if not os.path.exists(ini):
|
||||||
|
print 'WARNING: application.ini not found, cannot find build ID'
|
||||||
|
return ''
|
||||||
|
|
||||||
file = bz2.BZ2File(ini)
|
file = bz2.BZ2File(ini)
|
||||||
for line in file:
|
for line in file:
|
||||||
if line.find('BuildID') == 0:
|
if line.find('BuildID') == 0:
|
||||||
return line.strip().split('=')[1]
|
return line.strip().split('=')[1]
|
||||||
print 'WARNING: cannot find build ID in application.ini'
|
print 'WARNING: cannot find build ID in application.ini'
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -457,7 +449,7 @@ def create_partial_patches(patches):
|
||||||
try:
|
try:
|
||||||
work_dir_root = tempfile.mkdtemp('-fastmode', 'tmp', os.getcwd())
|
work_dir_root = tempfile.mkdtemp('-fastmode', 'tmp', os.getcwd())
|
||||||
print "Building patches using work dir: %s" % (work_dir_root)
|
print "Building patches using work dir: %s" % (work_dir_root)
|
||||||
|
|
||||||
# Iterate through every patch set in the patch file
|
# Iterate through every patch set in the patch file
|
||||||
patch_num = 1
|
patch_num = 1
|
||||||
for patch in patches:
|
for patch in patches:
|
||||||
|
@ -475,7 +467,7 @@ def create_partial_patches(patches):
|
||||||
os.mkdir(work_dir_from)
|
os.mkdir(work_dir_from)
|
||||||
extract_mar(from_filename,work_dir_from)
|
extract_mar(from_filename,work_dir_from)
|
||||||
from_decoded = decode_filename(from_filename)
|
from_decoded = decode_filename(from_filename)
|
||||||
from_buildid = get_buildid(work_dir_from, from_decoded['platform'])
|
from_buildid = get_buildid(work_dir_from)
|
||||||
from_shasum = sha.sha(open(from_filename).read()).hexdigest()
|
from_shasum = sha.sha(open(from_filename).read()).hexdigest()
|
||||||
from_size = str(os.path.getsize(to_filename))
|
from_size = str(os.path.getsize(to_filename))
|
||||||
|
|
||||||
|
@ -484,13 +476,13 @@ def create_partial_patches(patches):
|
||||||
os.mkdir(work_dir_to)
|
os.mkdir(work_dir_to)
|
||||||
extract_mar(to_filename, work_dir_to)
|
extract_mar(to_filename, work_dir_to)
|
||||||
to_decoded = decode_filename(from_filename)
|
to_decoded = decode_filename(from_filename)
|
||||||
to_buildid = get_buildid(work_dir_to, to_decoded['platform'])
|
to_buildid = get_buildid(work_dir_to)
|
||||||
to_shasum = sha.sha(open(to_filename).read()).hexdigest()
|
to_shasum = sha.sha(open(to_filename).read()).hexdigest()
|
||||||
to_size = str(os.path.getsize(to_filename))
|
to_size = str(os.path.getsize(to_filename))
|
||||||
|
|
||||||
mar_extract_time = time.time()
|
mar_extract_time = time.time()
|
||||||
|
|
||||||
partial_filename = create_partial_patch(work_dir_from, work_dir_to, patch_filename, shas, PatchInfo(work_dir, ['update.manifest','updatev2.manifest','updatev3.manifest','removed-files'],['/readme.txt']),forced_updates,['channel-prefs.js','update-settings.ini'])
|
partial_filename = create_partial_patch(work_dir_from, work_dir_to, patch_filename, shas, PatchInfo(work_dir, ['update.manifest','updatev2.manifest','updatev3.manifest'],[]),forced_updates,['channel-prefs.js','update-settings.ini'])
|
||||||
partial_buildid = to_buildid
|
partial_buildid = to_buildid
|
||||||
partial_shasum = sha.sha(open(partial_filename).read()).hexdigest()
|
partial_shasum = sha.sha(open(partial_filename).read()).hexdigest()
|
||||||
partial_size = str(os.path.getsize(partial_filename))
|
partial_size = str(os.path.getsize(partial_filename))
|
||||||
|
@ -499,11 +491,11 @@ def create_partial_patches(patches):
|
||||||
'to_filename': os.path.basename(to_filename),
|
'to_filename': os.path.basename(to_filename),
|
||||||
'from_filename': os.path.basename(from_filename),
|
'from_filename': os.path.basename(from_filename),
|
||||||
'partial_filename': os.path.basename(partial_filename),
|
'partial_filename': os.path.basename(partial_filename),
|
||||||
'to_buildid':to_buildid,
|
'to_buildid':to_buildid,
|
||||||
'from_buildid':from_buildid,
|
'from_buildid':from_buildid,
|
||||||
'to_sha1sum':to_shasum,
|
'to_sha1sum':to_shasum,
|
||||||
'from_sha1sum':from_shasum,
|
'from_sha1sum':from_shasum,
|
||||||
'partial_sha1sum':partial_shasum,
|
'partial_sha1sum':partial_shasum,
|
||||||
'to_size':to_size,
|
'to_size':to_size,
|
||||||
'from_size':from_size,
|
'from_size':from_size,
|
||||||
'partial_size':partial_size,
|
'partial_size':partial_size,
|
||||||
|
|
|
@ -131,11 +131,9 @@ append_remove_instructions() {
|
||||||
filev3="$3"
|
filev3="$3"
|
||||||
|
|
||||||
if [ -f "$dir/removed-files" ]; then
|
if [ -f "$dir/removed-files" ]; then
|
||||||
prefix=
|
|
||||||
listfile="$dir/removed-files"
|
listfile="$dir/removed-files"
|
||||||
elif [ -f "$dir/Contents/MacOS/removed-files" ]; then
|
elif [ -f "$dir/Contents/Resources/removed-files" ]; then
|
||||||
prefix=Contents/MacOS/
|
listfile="$dir/Contents/Resources/removed-files"
|
||||||
listfile="$dir/Contents/MacOS/removed-files"
|
|
||||||
fi
|
fi
|
||||||
if [ -n "$listfile" ]; then
|
if [ -n "$listfile" ]; then
|
||||||
# Map spaces to pipes so that we correctly handle filenames with spaces.
|
# Map spaces to pipes so that we correctly handle filenames with spaces.
|
||||||
|
@ -150,33 +148,20 @@ append_remove_instructions() {
|
||||||
if [ -n "$f" ]; then
|
if [ -n "$f" ]; then
|
||||||
# Exclude comments
|
# Exclude comments
|
||||||
if [ ! $(echo "$f" | grep -c '^#') = 1 ]; then
|
if [ ! $(echo "$f" | grep -c '^#') = 1 ]; then
|
||||||
# Normalize the path to the root of the Mac OS X bundle if necessary
|
|
||||||
fixedprefix="$prefix"
|
|
||||||
if [ $prefix ]; then
|
|
||||||
if [ $(echo "$f" | grep -c '^\.\./') = 1 ]; then
|
|
||||||
if [ $(echo "$f" | grep -c '^\.\./\.\./') = 1 ]; then
|
|
||||||
f=$(echo $f | sed -e 's:^\.\.\/\.\.\/::')
|
|
||||||
fixedprefix=""
|
|
||||||
else
|
|
||||||
f=$(echo $f | sed -e 's:^\.\.\/::')
|
|
||||||
fixedprefix=$(echo "$prefix" | sed -e 's:[^\/]*\/$::')
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ $(echo "$f" | grep -c '\/$') = 1 ]; then
|
if [ $(echo "$f" | grep -c '\/$') = 1 ]; then
|
||||||
notice " rmdir \"$fixedprefix$f\""
|
notice " rmdir \"$f\""
|
||||||
echo "rmdir \"$fixedprefix$f\"" >> $filev2
|
echo "rmdir \"$f\"" >> $filev2
|
||||||
echo "rmdir \"$fixedprefix$f\"" >> $filev3
|
echo "rmdir \"$f\"" >> $filev3
|
||||||
elif [ $(echo "$f" | grep -c '\/\*$') = 1 ]; then
|
elif [ $(echo "$f" | grep -c '\/\*$') = 1 ]; then
|
||||||
# Remove the *
|
# Remove the *
|
||||||
f=$(echo "$f" | sed -e 's:\*$::')
|
f=$(echo "$f" | sed -e 's:\*$::')
|
||||||
notice " rmrfdir \"$fixedprefix$f\""
|
notice " rmrfdir \"$f\""
|
||||||
echo "rmrfdir \"$fixedprefix$f\"" >> $filev2
|
echo "rmrfdir \"$f\"" >> $filev2
|
||||||
echo "rmrfdir \"$fixedprefix$f\"" >> $filev3
|
echo "rmrfdir \"$f\"" >> $filev3
|
||||||
else
|
else
|
||||||
notice " remove \"$fixedprefix$f\""
|
notice " remove \"$f\""
|
||||||
echo "remove \"$fixedprefix$f\"" >> $filev2
|
echo "remove \"$f\"" >> $filev2
|
||||||
echo "remove \"$fixedprefix$f\"" >> $filev3
|
echo "remove \"$f\"" >> $filev3
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Contents/Resources/removed1.txt
|
||||||
|
Contents/MacOS/removed2.bin
|
||||||
|
Contents/MacOS/recursivedir/meh/*
|
||||||
|
Contents/Resources/dir/
|
||||||
|
Contents/MacOS/this file has spaces
|
||||||
|
|
||||||
|
|
||||||
|
Contents/MacOS/extra-spaces
|
|
@ -0,0 +1 @@
|
||||||
|
removed
|
|
@ -1,14 +1,8 @@
|
||||||
removed1.txt
|
removed1.txt
|
||||||
removed2.bin
|
removed2.bin
|
||||||
recursivedir/meh/*
|
recursivedir/meh/*
|
||||||
removed3-foo.txt
|
|
||||||
dir/
|
dir/
|
||||||
this file has spaces
|
this file has spaces
|
||||||
notherdir/
|
|
||||||
|
|
||||||
|
|
||||||
extra-spaces
|
extra-spaces
|
||||||
|
|
||||||
lastFile
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
Contents/Resources/removed1.txt
|
||||||
|
Contents/MacOS/removed2.bin
|
||||||
|
Contents/MacOS/recursivedir/meh/*
|
||||||
|
Contents/MacOS/removed3-foo.txt
|
||||||
|
Contents/Resources/dir/
|
||||||
|
Contents/MacOS/this file has spaces
|
||||||
|
Contents/MacOS/notherdir/
|
||||||
|
|
||||||
|
|
||||||
|
Contents/Resources/extra-spaces
|
||||||
|
|
||||||
|
Contents/MacOS/lastFile
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ from make_incremental_updates import PatchInfo, MarFileEntry
|
||||||
class TestPatchInfo(unittest.TestCase):
|
class TestPatchInfo(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.work_dir = 'work_dir'
|
self.work_dir = 'work_dir'
|
||||||
self.file_exclusion_list = ['update.manifest','updatev2.manifest','updatev3.manifest','removed-files']
|
self.file_exclusion_list = ['update.manifest','updatev2.manifest','updatev3.manifest']
|
||||||
self.path_exclusion_list = ['/readme.txt']
|
self.path_exclusion_list = ['/readme.txt']
|
||||||
self.patch_info = PatchInfo(self.work_dir, self.file_exclusion_list, self.path_exclusion_list)
|
self.patch_info = PatchInfo(self.work_dir, self.file_exclusion_list, self.path_exclusion_list)
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class TestMarFileEntry(unittest.TestCase):
|
||||||
class TestMakeIncrementalUpdates(unittest.TestCase):
|
class TestMakeIncrementalUpdates(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
work_dir = '.'
|
work_dir = '.'
|
||||||
self.patch_info = PatchInfo(work_dir, ['update.manifest','updatev2.manifest','updatev3.manifest','removed-files'],['/readme.txt'])
|
self.patch_info = PatchInfo(work_dir, ['update.manifest','updatev2.manifest','updatev3.manifest'],['/readme.txt'])
|
||||||
root_path = '/'
|
root_path = '/'
|
||||||
filename = 'test.file'
|
filename = 'test.file'
|
||||||
self.mar_file_entry = MarFileEntry(root_path, filename)
|
self.mar_file_entry = MarFileEntry(root_path, filename)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче