Mac v2 signing - Bug 1059467 - Move precomplete file from the root of the Mac bundle to Contents/Resources. r=bbondy, r=nthomas

This commit is contained in:
Robert Strong
2014-09-29 11:51:55 -07:00
parent 0d82b5f691
commit e2938e9434
9 changed files with 44 additions and 80 deletions

View File

@@ -44,14 +44,17 @@ def generate_precomplete(root_path):
application update instructions. The given directory is used
for the location to enumerate and to create the precomplete file.
"""
rel_path_precomplete = "precomplete"
# If inside a Mac bundle use the root of the bundle for the path.
if os.path.basename(root_path) == "Resources":
root_path = os.path.abspath(os.path.join(root_path, '../../'))
rel_path_precomplete = "Contents/Resources/precomplete"
rel_file_path_list, rel_dir_path_list = get_build_entries(root_path)
precomplete_file_path = os.path.join(root_path,"precomplete")
# open in binary mode to prevent OS specific line endings.
precomplete_file_path = os.path.join(root_path,rel_path_precomplete)
# Open the file so it exists before building the list of files and open it
# in binary mode to prevent OS specific line endings.
precomplete_file = open(precomplete_file_path, "wb")
rel_file_path_list, rel_dir_path_list = get_build_entries(root_path)
for rel_file_path in rel_file_path_list:
precomplete_file.writelines("remove \""+rel_file_path+"\"\n")

View File

@@ -2090,43 +2090,8 @@ ProcessReplaceRequest()
LOG(("Updated.app dir can't be found: " LOG_S ", err: %d",
updatedAppDir, errno));
}
ensure_remove_recursive(updatedAppDir);
LOG(("Moving the precomplete file"));
// We also need to move the precomplete file too.
NS_tchar precompleteSource[MAXPATHLEN];
NS_tsnprintf(precompleteSource, sizeof(precompleteSource)/sizeof(precompleteSource[0]),
NS_T("%s/precomplete"), installDir);
NS_tchar precompleteTmp[MAXPATHLEN];
NS_tsnprintf(precompleteTmp, sizeof(precompleteTmp)/sizeof(precompleteTmp[0]),
NS_T("%s/precomplete.bak"), installDir);
NS_tchar precompleteNew[MAXPATHLEN];
NS_tsnprintf(precompleteNew, sizeof(precompleteNew)/sizeof(precompleteNew[0]),
NS_T("%s/Updated.app/precomplete"), installDir);
ensure_remove(precompleteTmp);
LOG(("Begin moving precompleteSrc to precompleteTmp"));
rv = rename_file(precompleteSource, precompleteTmp);
LOG(("Moved precompleteSrc to precompleteTmp, err: %d", rv));
LOG(("Begin moving precompleteNew to precompleteSrc"));
int rv2 = rename_file(precompleteNew, precompleteSource);
LOG(("Moved precompleteNew to precompleteSrc, err: %d", rv2));
// If new could not be moved to source, we only want to restore tmp to source
// if the first step succeeded. Note that it is possible for the first
// rename to have failed as well, for example if the tmpFile exists and we
// race between the ensure_remove call and the first rename call, but there
// isn't too much that we can do about that, unfortunately.
if (!rv && rv2) {
LOG(("Begin trying to recover precompleteSrc"));
rv = rename_file(precompleteTmp, precompleteSource);
LOG(("Moved precompleteTmp to precompleteSrc, err: %d", rv));
}
LOG(("Finished moving the precomplete file"));
#endif
gSucceeded = true;
@@ -3639,7 +3604,11 @@ int AddPreCompleteActions(ActionList *list)
return OK;
}
#ifdef XP_MACOSX
NS_tchar *rb = GetManifestContents(NS_T("Contents/Resources/precomplete"));
#else
NS_tchar *rb = GetManifestContents(NS_T("precomplete"));
#endif
if (rb == nullptr) {
LOG(("AddPreCompleteActions: error getting contents of precomplete " \
"manifest"));

View File

@@ -49,9 +49,6 @@ targetfiles="updatev2.manifest updatev3.manifest"
mkdir -p "$workdir"
# On Mac, the precomplete file added by Bug 386760 will cause OS X to reload the
# Info.plist so it launches the right architecture, bug 600098
# Generate a list of all files in the target directory.
pushd "$targetdir"
if test $? -ne 0 ; then
@@ -59,9 +56,11 @@ if test $? -ne 0 ; then
fi
if [ ! -f "precomplete" ]; then
if [ ! -f "Contents/Resources/precomplete" ]; then
notice "precomplete file is missing!"
exit 1
fi
fi
list_files files

View File

@@ -35,6 +35,11 @@ check_for_forced_update() {
return 0;
fi
if [ "$forced_file_chk" = "Contents/Resources/precomplete" ]; then
## "true" *giggle*
return 0;
fi
if [ "${forced_file_chk##*.}" = "chk" ]
then
## "true" *giggle*
@@ -92,9 +97,6 @@ archivefiles="updatev2.manifest updatev3.manifest"
mkdir -p "$workdir"
# On Mac, the precomplete file added by Bug 386760 will cause OS X to reload the
# Info.plist so it launches the right architecture, bug 600098
# Generate a list of all files in the target directory.
pushd "$olddir"
if test $? -ne 0 ; then
@@ -112,9 +114,11 @@ if test $? -ne 0 ; then
fi
if [ ! -f "precomplete" ]; then
if [ ! -f "Contents/Resources/precomplete" ]; then
notice "precomplete file is missing!"
exit 1
fi
fi
list_dirs newdirs
list_files newfiles

View File

@@ -336,11 +336,19 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
# 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)
to_dir_hash,to_file_set,to_dir_set = patch_info.build_marfile_entry_hash(to_dir_path)
# Require that the precomplete file is included in the complete update
if "precomplete" not in to_file_set:
raise Exception, "missing precomplete file in: "+to_dir_path
# Create a list of the forced updates
forced_list = forced_updates.strip().split('|')
# Require that the precomplete file is included in the complete update
if "precomplete" not in to_file_set:
# The check with \ file separators allows tests for Mac to run on Windows
if "Contents/Resources/precomplete" not in to_file_set and "Contents\Resources\precomplete" not in to_file_set:
raise Exception, "missing precomplete file in: "+to_dir_path
else:
if "Contents/Resources/precomplete" in to_file_set:
forced_list.append("Contents/Resources/precomplete")
else:
forced_list.append("Contents\Resources\precomplete")
else:
forced_list.append("precomplete")
# Files which exist in both sets need to be patched

View File

@@ -1,4 +1,3 @@
remove "precomplete"
remove "Contents/MacOS/{foodir/update.manifest"
remove "Contents/MacOS/{foodir/same.txt"
remove "Contents/MacOS/{foodir/same.bin"
@@ -16,10 +15,12 @@ remove "Contents/MacOS/force.txt"
remove "Contents/MacOS/extensions/diff/diff-patch-larger-than-file.txt"
remove "Contents/MacOS/diff-patch-larger-than-file.txt"
remove "Contents/MacOS/application.ini"
remove "Contents/Resources/precomplete"
rmdir "Contents/MacOS/{foodir/"
rmdir "Contents/MacOS/searchplugins/diff/"
rmdir "Contents/MacOS/searchplugins/"
rmdir "Contents/MacOS/extensions/diff/"
rmdir "Contents/MacOS/extensions/"
rmdir "Contents/MacOS/"
rmdir "Contents/Resources/"
rmdir "Contents/"

View File

@@ -50,9 +50,6 @@ targetfiles="updatev2.manifest updatev3.manifest"
mkdir -p "$workdir"
# On Mac, the precomplete file added by Bug 386760 will cause OS X to reload the
# Info.plist so it launches the right architecture, bug 600098
# Generate a list of all files in the target directory.
pushd "$targetdir"
if test $? -ne 0 ; then
@@ -60,9 +57,11 @@ if test $? -ne 0 ; then
fi
if [ ! -f "precomplete" ]; then
if [ ! -f "Contents/Resources/precomplete" ]; then
notice "precomplete file is missing!"
exit 1
fi
fi
list_files files

View File

@@ -1,19 +0,0 @@
remove "Contents/MacOS/{foodir/update.manifest"
remove "Contents/MacOS/{foodir/same.txt"
remove "Contents/MacOS/{foodir/same.bin"
remove "Contents/MacOS/{foodir/readme.txt"
remove "Contents/MacOS/{foodir/force.txt"
remove "Contents/MacOS/{foodir/diff-patch-larger-than-file.txt"
remove "Contents/MacOS/update.manifest"
remove "Contents/MacOS/searchplugins/diff/diff-patch-larger-than-file.txt"
remove "Contents/MacOS/same.txt"
remove "Contents/MacOS/same.bin"
remove "Contents/MacOS/removed-files"
remove "Contents/MacOS/readme.txt"
remove "Contents/MacOS/precomplete"
remove "Contents/MacOS/force.txt"
remove "Contents/MacOS/diff-patch-larger-than-file.txt"
rmdir "Contents/MacOS/{foodir/"
rmdir "Contents/MacOS/searchplugins/diff/"
rmdir "Contents/MacOS/searchplugins/added/"
rmdir "Contents/MacOS/searchplugins/"

View File

@@ -1,4 +1,3 @@
remove "precomplete"
remove "Contents/MacOS/{foodir/update.manifest"
remove "Contents/MacOS/{foodir/same.txt"
remove "Contents/MacOS/{foodir/same.bin"
@@ -13,7 +12,6 @@ remove "Contents/MacOS/same.txt"
remove "Contents/MacOS/same.bin"
remove "Contents/MacOS/removed-files"
remove "Contents/MacOS/readme.txt"
remove "Contents/MacOS/precomplete"
remove "Contents/MacOS/force.txt"
remove "Contents/MacOS/extensions/diff/diff-patch-larger-than-file.txt"
remove "Contents/MacOS/extensions/added/file.txt"
@@ -22,6 +20,7 @@ remove "Contents/MacOS/diff-patch-larger-than-file.bin"
remove "Contents/MacOS/application.ini"
remove "Contents/MacOS/added.txt"
remove "Contents/MacOS/addFeedPrefs.js"
remove "Contents/Resources/precomplete"
rmdir "Contents/MacOS/{foodir/"
rmdir "Contents/MacOS/searchplugins/diff/"
rmdir "Contents/MacOS/searchplugins/added/"
@@ -30,4 +29,5 @@ rmdir "Contents/MacOS/extensions/diff/"
rmdir "Contents/MacOS/extensions/added/"
rmdir "Contents/MacOS/extensions/"
rmdir "Contents/MacOS/"
rmdir "Contents/Resources/"
rmdir "Contents/"