From 6f0b219ac551710c724e3f344023943178cdc217 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 13 Oct 2015 16:37:12 -0700 Subject: [PATCH] Pass source's info_dict to vendor's releasetools.py. When building incremental packages, the info_dict from the source build should be the one in use. We have done that for most of the partitions (system and etc.), and should pass that to vendor's script as well. Bug: 24898607 Change-Id: Ie2973d41b905637862616286663baf80df83bd88 --- tools/releasetools/common.py | 7 ++++++- tools/releasetools/ota_from_target_files.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 372ec9383..7bb96a936 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -59,6 +59,8 @@ class Options(object): self.device_specific = None self.extras = {} self.info_dict = None + self.source_info_dict = None + self.target_info_dict = None self.worker_threads = None # Stash size cannot exceed cache_size * threshold. self.cache_size = None @@ -1257,7 +1259,8 @@ class BlockDifference(object): self.path = os.path.join(tmpdir, partition) b.Compute(self.path) - _, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict) + _, self.device = GetTypeAndDevice("/" + partition, + OPTIONS.source_info_dict) def WriteScript(self, script, output_zip, progress=None): if not self.src: @@ -1462,6 +1465,8 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, output_sink("recovery-from-boot.p", patch) try: + # The following GetTypeAndDevice()s need to use the path in the target + # info_dict instead of source_info_dict. boot_type, boot_device = GetTypeAndDevice("/boot", info_dict) recovery_type, recovery_device = GetTypeAndDevice("/recovery", info_dict) except KeyError: diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index d686004a9..354b9ad43 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -770,7 +770,7 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip): output_zip=output_zip, script=script, metadata=metadata, - info_dict=OPTIONS.info_dict) + info_dict=OPTIONS.source_info_dict) source_fp = CalculateFingerprint(oem_props, oem_dict, OPTIONS.source_info_dict) @@ -1158,7 +1158,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): output_zip=output_zip, script=script, metadata=metadata, - info_dict=OPTIONS.info_dict) + info_dict=OPTIONS.source_info_dict) system_diff = FileDifference("system", source_zip, target_zip, output_zip) script.Mount("/system", recovery_mount_options)