Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge bug 414560 to hg repositories (force file support for patcher f…

…astmode), originally p=rhelmer, r=bsmedberg,bhearsum NPOTB
  • Loading branch information...
commit 5bd191387a65052316b792a8123811b45fc1c144 1 parent f1b1a53
Nick Thomas nthomas-mozilla authored
Showing with 12 additions and 5 deletions.
  1. +12 −5 tools/update-packaging/make_incremental_updates.py
17 tools/update-packaging/make_incremental_updates.py
View
@@ -256,7 +256,7 @@ def process_explicit_remove_files(dir_path, patch_info):
if line and not line.endswith("/"):
patch_info.append_remove_instruction(os.path.join(prefix,line))
-def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch_info):
+def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch_info, forced_updates):
""" Builds a partial patch by comparing the files in from_dir_path to thoes of to_dir_path"""
# Cannocolize the paths for safey
from_dir_path = os.path.abspath(from_dir_path)
@@ -264,6 +264,8 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
# First create a hashtable of the from and to directories
from_dir_hash,from_dir_set = patch_info.build_marfile_entry_hash(from_dir_path)
to_dir_hash,to_dir_set = patch_info.build_marfile_entry_hash(to_dir_path)
+ # Create a list of the forced updates
+ forced_list = forced_updates.strip().split('|')
# Files which exist in both sets need to be patched
patch_filenames = list(from_dir_set.intersection(to_dir_set))
@@ -271,9 +273,14 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
for filename in patch_filenames:
from_marfile_entry = from_dir_hash[filename]
to_marfile_entry = to_dir_hash[filename]
- if from_marfile_entry.sha() != to_marfile_entry.sha():
- # Not the same - calculate a patch
- create_partial_patch_for_file(from_marfile_entry, to_marfile_entry, shas, patch_info)
+ if filename in forced_list:
+ print "Forcing "+ filename
+ # This filename is in the forced list, explicitly add
+ create_add_patch_for_file(to_dir_hash[filename], patch_info)
+ else:
+ if from_marfile_entry.sha() != to_marfile_entry.sha():
+ # Not the same - calculate a patch
+ create_partial_patch_for_file(from_marfile_entry, to_marfile_entry, shas, patch_info)
# files in from_dir not in to_dir need to be removed
remove_filenames = list(from_dir_set - to_dir_set)
@@ -387,7 +394,7 @@ def create_partial_patches(patches):
mar_extract_time = time.time()
- partial_filename = create_partial_patch(work_dir_from, work_dir_to, patch_filename, shas, PatchInfo(work_dir, ['channel-prefs.js','update.manifest','removed-files'],['/readme.txt']))
+ partial_filename = create_partial_patch(work_dir_from, work_dir_to, patch_filename, shas, PatchInfo(work_dir, ['channel-prefs.js','update.manifest','removed-files'],['/readme.txt']),forced_updates)
partial_buildid = to_buildid
partial_shasum = sha.sha(open(partial_filename).read()).hexdigest()
partial_size = str(os.path.getsize(partial_filename))
Please sign in to comment.
Something went wrong with that request. Please try again.