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:
@@ -44,14 +44,17 @@ def generate_precomplete(root_path):
|
|||||||
application update instructions. The given directory is used
|
application update instructions. The given directory is used
|
||||||
for the location to enumerate and to create the precomplete file.
|
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 inside a Mac bundle use the root of the bundle for the path.
|
||||||
if os.path.basename(root_path) == "Resources":
|
if os.path.basename(root_path) == "Resources":
|
||||||
root_path = os.path.abspath(os.path.join(root_path, '../../'))
|
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,rel_path_precomplete)
|
||||||
precomplete_file_path = os.path.join(root_path,"precomplete")
|
# Open the file so it exists before building the list of files and open it
|
||||||
# open in binary mode to prevent OS specific line endings.
|
# in binary mode to prevent OS specific line endings.
|
||||||
precomplete_file = open(precomplete_file_path, "wb")
|
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:
|
for rel_file_path in rel_file_path_list:
|
||||||
precomplete_file.writelines("remove \""+rel_file_path+"\"\n")
|
precomplete_file.writelines("remove \""+rel_file_path+"\"\n")
|
||||||
|
|
||||||
|
|||||||
@@ -2090,43 +2090,8 @@ ProcessReplaceRequest()
|
|||||||
LOG(("Updated.app dir can't be found: " LOG_S ", err: %d",
|
LOG(("Updated.app dir can't be found: " LOG_S ", err: %d",
|
||||||
updatedAppDir, errno));
|
updatedAppDir, errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_remove_recursive(updatedAppDir);
|
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
|
#endif
|
||||||
|
|
||||||
gSucceeded = true;
|
gSucceeded = true;
|
||||||
@@ -3639,7 +3604,11 @@ int AddPreCompleteActions(ActionList *list)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
NS_tchar *rb = GetManifestContents(NS_T("Contents/Resources/precomplete"));
|
||||||
|
#else
|
||||||
NS_tchar *rb = GetManifestContents(NS_T("precomplete"));
|
NS_tchar *rb = GetManifestContents(NS_T("precomplete"));
|
||||||
|
#endif
|
||||||
if (rb == nullptr) {
|
if (rb == nullptr) {
|
||||||
LOG(("AddPreCompleteActions: error getting contents of precomplete " \
|
LOG(("AddPreCompleteActions: error getting contents of precomplete " \
|
||||||
"manifest"));
|
"manifest"));
|
||||||
|
|||||||
@@ -49,9 +49,6 @@ targetfiles="updatev2.manifest updatev3.manifest"
|
|||||||
|
|
||||||
mkdir -p "$workdir"
|
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.
|
# Generate a list of all files in the target directory.
|
||||||
pushd "$targetdir"
|
pushd "$targetdir"
|
||||||
if test $? -ne 0 ; then
|
if test $? -ne 0 ; then
|
||||||
@@ -59,8 +56,10 @@ if test $? -ne 0 ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "precomplete" ]; then
|
if [ ! -f "precomplete" ]; then
|
||||||
notice "precomplete file is missing!"
|
if [ ! -f "Contents/Resources/precomplete" ]; then
|
||||||
exit 1
|
notice "precomplete file is missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
list_files files
|
list_files files
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ check_for_forced_update() {
|
|||||||
return 0;
|
return 0;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$forced_file_chk" = "Contents/Resources/precomplete" ]; then
|
||||||
|
## "true" *giggle*
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${forced_file_chk##*.}" = "chk" ]
|
if [ "${forced_file_chk##*.}" = "chk" ]
|
||||||
then
|
then
|
||||||
## "true" *giggle*
|
## "true" *giggle*
|
||||||
@@ -92,9 +97,6 @@ archivefiles="updatev2.manifest updatev3.manifest"
|
|||||||
|
|
||||||
mkdir -p "$workdir"
|
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.
|
# Generate a list of all files in the target directory.
|
||||||
pushd "$olddir"
|
pushd "$olddir"
|
||||||
if test $? -ne 0 ; then
|
if test $? -ne 0 ; then
|
||||||
@@ -112,8 +114,10 @@ if test $? -ne 0 ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "precomplete" ]; then
|
if [ ! -f "precomplete" ]; then
|
||||||
notice "precomplete file is missing!"
|
if [ ! -f "Contents/Resources/precomplete" ]; then
|
||||||
exit 1
|
notice "precomplete file is missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
list_dirs newdirs
|
list_dirs newdirs
|
||||||
|
|||||||
@@ -336,12 +336,20 @@ 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)
|
||||||
# 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
|
# Create a list of the forced updates
|
||||||
forced_list = forced_updates.strip().split('|')
|
forced_list = forced_updates.strip().split('|')
|
||||||
forced_list.append("precomplete")
|
# 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
|
# Files which exist in both sets need to be patched
|
||||||
patch_filenames = list(from_file_set.intersection(to_file_set))
|
patch_filenames = list(from_file_set.intersection(to_file_set))
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
remove "precomplete"
|
|
||||||
remove "Contents/MacOS/{foodir/update.manifest"
|
remove "Contents/MacOS/{foodir/update.manifest"
|
||||||
remove "Contents/MacOS/{foodir/same.txt"
|
remove "Contents/MacOS/{foodir/same.txt"
|
||||||
remove "Contents/MacOS/{foodir/same.bin"
|
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/extensions/diff/diff-patch-larger-than-file.txt"
|
||||||
remove "Contents/MacOS/diff-patch-larger-than-file.txt"
|
remove "Contents/MacOS/diff-patch-larger-than-file.txt"
|
||||||
remove "Contents/MacOS/application.ini"
|
remove "Contents/MacOS/application.ini"
|
||||||
|
remove "Contents/Resources/precomplete"
|
||||||
rmdir "Contents/MacOS/{foodir/"
|
rmdir "Contents/MacOS/{foodir/"
|
||||||
rmdir "Contents/MacOS/searchplugins/diff/"
|
rmdir "Contents/MacOS/searchplugins/diff/"
|
||||||
rmdir "Contents/MacOS/searchplugins/"
|
rmdir "Contents/MacOS/searchplugins/"
|
||||||
rmdir "Contents/MacOS/extensions/diff/"
|
rmdir "Contents/MacOS/extensions/diff/"
|
||||||
rmdir "Contents/MacOS/extensions/"
|
rmdir "Contents/MacOS/extensions/"
|
||||||
rmdir "Contents/MacOS/"
|
rmdir "Contents/MacOS/"
|
||||||
|
rmdir "Contents/Resources/"
|
||||||
rmdir "Contents/"
|
rmdir "Contents/"
|
||||||
@@ -50,9 +50,6 @@ targetfiles="updatev2.manifest updatev3.manifest"
|
|||||||
|
|
||||||
mkdir -p "$workdir"
|
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.
|
# Generate a list of all files in the target directory.
|
||||||
pushd "$targetdir"
|
pushd "$targetdir"
|
||||||
if test $? -ne 0 ; then
|
if test $? -ne 0 ; then
|
||||||
@@ -60,8 +57,10 @@ if test $? -ne 0 ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "precomplete" ]; then
|
if [ ! -f "precomplete" ]; then
|
||||||
notice "precomplete file is missing!"
|
if [ ! -f "Contents/Resources/precomplete" ]; then
|
||||||
exit 1
|
notice "precomplete file is missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
list_files files
|
list_files files
|
||||||
|
|||||||
@@ -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/"
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
remove "precomplete"
|
|
||||||
remove "Contents/MacOS/{foodir/update.manifest"
|
remove "Contents/MacOS/{foodir/update.manifest"
|
||||||
remove "Contents/MacOS/{foodir/same.txt"
|
remove "Contents/MacOS/{foodir/same.txt"
|
||||||
remove "Contents/MacOS/{foodir/same.bin"
|
remove "Contents/MacOS/{foodir/same.bin"
|
||||||
@@ -13,7 +12,6 @@ remove "Contents/MacOS/same.txt"
|
|||||||
remove "Contents/MacOS/same.bin"
|
remove "Contents/MacOS/same.bin"
|
||||||
remove "Contents/MacOS/removed-files"
|
remove "Contents/MacOS/removed-files"
|
||||||
remove "Contents/MacOS/readme.txt"
|
remove "Contents/MacOS/readme.txt"
|
||||||
remove "Contents/MacOS/precomplete"
|
|
||||||
remove "Contents/MacOS/force.txt"
|
remove "Contents/MacOS/force.txt"
|
||||||
remove "Contents/MacOS/extensions/diff/diff-patch-larger-than-file.txt"
|
remove "Contents/MacOS/extensions/diff/diff-patch-larger-than-file.txt"
|
||||||
remove "Contents/MacOS/extensions/added/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/application.ini"
|
||||||
remove "Contents/MacOS/added.txt"
|
remove "Contents/MacOS/added.txt"
|
||||||
remove "Contents/MacOS/addFeedPrefs.js"
|
remove "Contents/MacOS/addFeedPrefs.js"
|
||||||
|
remove "Contents/Resources/precomplete"
|
||||||
rmdir "Contents/MacOS/{foodir/"
|
rmdir "Contents/MacOS/{foodir/"
|
||||||
rmdir "Contents/MacOS/searchplugins/diff/"
|
rmdir "Contents/MacOS/searchplugins/diff/"
|
||||||
rmdir "Contents/MacOS/searchplugins/added/"
|
rmdir "Contents/MacOS/searchplugins/added/"
|
||||||
@@ -30,4 +29,5 @@ rmdir "Contents/MacOS/extensions/diff/"
|
|||||||
rmdir "Contents/MacOS/extensions/added/"
|
rmdir "Contents/MacOS/extensions/added/"
|
||||||
rmdir "Contents/MacOS/extensions/"
|
rmdir "Contents/MacOS/extensions/"
|
||||||
rmdir "Contents/MacOS/"
|
rmdir "Contents/MacOS/"
|
||||||
|
rmdir "Contents/Resources/"
|
||||||
rmdir "Contents/"
|
rmdir "Contents/"
|
||||||
Reference in New Issue
Block a user