diff options
author | Dave Langemak <dlangemak@google.com> | 2013-11-22 01:08:52 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-11-22 01:08:53 +0000 |
commit | 96f56b6fcbe21c2786ec985bee252e5cd5c3190b (patch) | |
tree | 6f5515cb619606239e93e10d518adac52be71e2d | |
parent | 221fcf3183978d7ec6d482e09602312485f6652f (diff) | |
parent | 90c60d3b922924cf65d26b478d8baef142a25023 (diff) | |
download | build-96f56b6fcbe21c2786ec985bee252e5cd5c3190b.tar.gz |
Merge "Revert "Enable incremental builder to find files that moved, and try to process them via patch + rename, instead of delete + add."" into klp-dev
-rw-r--r-- | core/Makefile | 1 | ||||
-rw-r--r-- | tools/releasetools/edify_generator.py | 5 | ||||
-rwxr-xr-x | tools/releasetools/ota_from_target_files | 59 |
3 files changed, 5 insertions, 60 deletions
diff --git a/core/Makefile b/core/Makefile index f118cea2b5..298eef1c8e 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1262,7 +1262,6 @@ ifdef PRODUCT_EXTRA_RECOVERY_KEYS endif $(hide) echo "mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)" >> $(zip_root)/META/misc_info.txt $(hide) echo "use_set_metadata=1" >> $(zip_root)/META/misc_info.txt - $(hide) echo "update_rename_support=1" >> $(zip_root)/META/misc_info.txt $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt) @# Zip everything up, preserving symlinks $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py index 189672c32b..2c3b9e7564 100644 --- a/tools/releasetools/edify_generator.py +++ b/tools/releasetools/edify_generator.py @@ -184,11 +184,6 @@ class EdifyGenerator(object): cmd = "delete(" + ",\0".join(['"%s"' % (i,) for i in file_list]) + ");" self.script.append(self._WordWrap(cmd)) - def RenameFile(self, srcfile, tgtfile): - """Moves a file from one location to another.""" - if self.info.get("update_rename_support", False): - self.script.append('rename("%s", "%s");' % (srcfile, tgtfile)) - def ApplyPatch(self, srcfile, tgtfile, tgtsize, tgtsha1, *patchpairs): """Apply binary patches (in *patchpairs) to the given srcfile to produce tgtfile (which may be "-" to indicate overwriting the diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index 2ef896f17e..a6b9b69399 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -108,31 +108,6 @@ def IsRegular(info): symlink.""" return (info.external_attr >> 28) == 010 -def ClosestFileMatch(src, tgtfiles, existing): - """Returns the closest file match between a source file and list - of potential matches. The exact filename match is preferred, - then the sha1 is searched for, and finally a file with the same - basename is evaluated. Rename support in the updater-binary is - required for the latter checks to be used.""" - - result = tgtfiles.get("path:" + src.name) - if result is not None: - return result - - if not OPTIONS.target_info_dict.get("update_rename_support", False): - return None - - if src.size < 1000: - return None - - result = tgtfiles.get("sha1:" + src.sha1) - if result is not None and existing.get(result.name) is None: - return result - result = tgtfiles.get("file:" + src.name.split("/")[-1]) - if result is not None and existing.get(result.name) is None: - return result - return None - class Item: """Items represent the metadata (user, group, mode) of files and directories in the system image.""" @@ -539,27 +514,11 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): verbatim_targets = [] patch_list = [] diffs = [] - renames = {} largest_source_size = 0 - - matching_file_cache = {} - for fn in source_data.keys(): - sf = source_data[fn] - assert fn == sf.name - matching_file_cache["path:" + fn] = sf - # Only allow eligability for filename/sha matching - # if there isn't a perfect path match. - if target_data.get(sf.name) is None: - matching_file_cache["file:" + fn.split("/")[-1]] = sf - matching_file_cache["sha:" + sf.sha1] = sf - for fn in sorted(target_data.keys()): tf = target_data[fn] assert fn == tf.name - sf = ClosestFileMatch(tf, matching_file_cache, renames) - if sf is not None and sf.name != tf.name: - print "File has moved from " + sf.name + " to " + tf.name - renames[sf.name] = tf + sf = source_data.get(fn, None) if sf is None or fn in OPTIONS.require_verbatim: # This file should be included verbatim @@ -572,7 +531,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): # File is different; consider sending as a patch diffs.append(common.Difference(tf, sf)) else: - # Target file data identical to source (may still be renamed) + # Target file identical to source. pass common.ComputeDifferences(diffs) @@ -584,8 +543,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): tf.AddToZip(output_zip) verbatim_targets.append((tf.name, tf.size)) else: - common.ZipWriteStr(output_zip, "patch/" + sf.name + ".p", d) - patch_list.append((sf.name, tf, sf, tf.size, common.sha1(d).hexdigest())) + common.ZipWriteStr(output_zip, "patch/" + tf.name + ".p", d) + patch_list.append((tf.name, tf, sf, tf.size, common.sha1(d).hexdigest())) largest_source_size = max(largest_source_size, sf.size) source_fp = GetBuildProp("ro.build.fingerprint", OPTIONS.source_info_dict) @@ -667,8 +626,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): script.Print("Removing unneeded files...") script.DeleteFiles(["/"+i[0] for i in verbatim_targets] + ["/"+i for i in sorted(source_data) - if i not in target_data and - i not in renames] + + if i not in target_data] + ["/system/recovery.img"]) script.ShowProgress(0.8, 0) @@ -755,13 +713,6 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): script.Print("Unpacking new recovery...") script.UnpackPackageDir("recovery", "/system") - if len(renames) > 0: - script.Print("Renaming files...") - - for src in renames: - print "Renaming " + src + " to " + renames[src].name - script.RenameFile(src, renames[src].name) - script.Print("Symlinks and permissions...") # Create all the symlinks that don't already exist, or point to |