diff --git a/config/createprecomplete.py b/config/createprecomplete.py index 560677623e42..3241d526b281 100644 --- a/config/createprecomplete.py +++ b/config/createprecomplete.py @@ -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") diff --git a/toolkit/mozapps/update/updater/updater.cpp b/toolkit/mozapps/update/updater/updater.cpp index ce6af32b9f3b..8a6e107545a5 100644 --- a/toolkit/mozapps/update/updater/updater.cpp +++ b/toolkit/mozapps/update/updater/updater.cpp @@ -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")); diff --git a/tools/update-packaging/make_full_update.sh b/tools/update-packaging/make_full_update.sh index 0ab09a6746c9..f0466144dfc6 100755 --- a/tools/update-packaging/make_full_update.sh +++ b/tools/update-packaging/make_full_update.sh @@ -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,8 +56,10 @@ if test $? -ne 0 ; then fi if [ ! -f "precomplete" ]; then - notice "precomplete file is missing!" - exit 1 + if [ ! -f "Contents/Resources/precomplete" ]; then + notice "precomplete file is missing!" + exit 1 + fi fi list_files files diff --git a/tools/update-packaging/make_incremental_update.sh b/tools/update-packaging/make_incremental_update.sh index 507627b8fd8d..cd170cd0dbd8 100755 --- a/tools/update-packaging/make_incremental_update.sh +++ b/tools/update-packaging/make_incremental_update.sh @@ -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,8 +114,10 @@ if test $? -ne 0 ; then fi if [ ! -f "precomplete" ]; then - notice "precomplete file is missing!" - exit 1 + if [ ! -f "Contents/Resources/precomplete" ]; then + notice "precomplete file is missing!" + exit 1 + fi fi list_dirs newdirs diff --git a/tools/update-packaging/make_incremental_updates.py b/tools/update-packaging/make_incremental_updates.py index b06904a66811..0867434aeaf4 100755 --- a/tools/update-packaging/make_incremental_updates.py +++ b/tools/update-packaging/make_incremental_updates.py @@ -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 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('|') - 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 patch_filenames = list(from_file_set.intersection(to_file_set)) diff --git a/tools/update-packaging/test/from-mac/precomplete b/tools/update-packaging/test/from-mac/Contents/Resources/precomplete similarity index 93% rename from tools/update-packaging/test/from-mac/precomplete rename to tools/update-packaging/test/from-mac/Contents/Resources/precomplete index 5dd59ea913e9..2d9068d3723b 100644 --- a/tools/update-packaging/test/from-mac/precomplete +++ b/tools/update-packaging/test/from-mac/Contents/Resources/precomplete @@ -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/" diff --git a/tools/update-packaging/test/make_full_update.sh b/tools/update-packaging/test/make_full_update.sh index 84d997312913..f2907da9ee47 100755 --- a/tools/update-packaging/test/make_full_update.sh +++ b/tools/update-packaging/test/make_full_update.sh @@ -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,8 +57,10 @@ if test $? -ne 0 ; then fi if [ ! -f "precomplete" ]; then - notice "precomplete file is missing!" - exit 1 + if [ ! -f "Contents/Resources/precomplete" ]; then + notice "precomplete file is missing!" + exit 1 + fi fi list_files files diff --git a/tools/update-packaging/test/to-mac/Contents/MacOS/precomplete b/tools/update-packaging/test/to-mac/Contents/MacOS/precomplete deleted file mode 100644 index dd64d4d6f27b..000000000000 --- a/tools/update-packaging/test/to-mac/Contents/MacOS/precomplete +++ /dev/null @@ -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/" diff --git a/tools/update-packaging/test/to-mac/precomplete b/tools/update-packaging/test/to-mac/Contents/Resources/precomplete similarity index 95% rename from tools/update-packaging/test/to-mac/precomplete rename to tools/update-packaging/test/to-mac/Contents/Resources/precomplete index 0549035754a3..7af8bfd76953 100644 --- a/tools/update-packaging/test/to-mac/precomplete +++ b/tools/update-packaging/test/to-mac/Contents/Resources/precomplete @@ -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/"