From 2f5358d38bcf21266ed02bbcd052329c20a5d2c1 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Wed, 20 Dec 2017 22:48:19 -0800 Subject: [PATCH] releasetools: Fix the bug that skips loading OEM dict. The CL in [1] unintentionally breaks the OEM dict loading logic in the incremental BBOTA path. We should always require and load the OEM property dict if _either_ of the source and target builds uses OEM properties. Otherwise with the current "and" operator, it skips loading the OEM property dict and thus fails to generate an OTA package that has OEM property changes (e.g. updating from build with fingerprint to another one using thumbprint). The CL in [1] actually makes the right change in the file-based OTA path, but introduces the bug in the block-based OTA path. This CL also cleans up the line that reads recovery_mount_options. [1] commit 7f804ba71fd5fa32e6d9735ec2544075a63b9684 ("releasetools: allow for multiple OEM property values."). Test: Genearte an OTA that has OEM property changes successfully. Change-Id: Idce4ad59825d432618535ce09ab22bd7ddc524f2 --- tools/releasetools/ota_from_target_files.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index 60e2e5ce31..c39deb120e 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -409,10 +409,10 @@ def WriteFullOTAPackage(input_zip, output_zip): # in the target build. script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict) - recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options") oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties") oem_dicts = None if oem_props: + recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options") oem_dicts = _LoadOemDicts(script, recovery_mount_options) target_fp = CalculateFingerprint(oem_props, oem_dicts and oem_dicts[0], @@ -503,8 +503,6 @@ else if get_stage("%(bcb_dev)s") == "3/3" then if HasVendorPartition(input_zip): system_progress -= 0.1 - recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options") - script.ShowProgress(system_progress, 0) # Full OTA is done as an "incremental" against an empty source image. This @@ -632,12 +630,12 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip): source_version, OPTIONS.target_info_dict, fstab=OPTIONS.source_info_dict["fstab"]) - recovery_mount_options = OPTIONS.source_info_dict.get( - "recovery_mount_options") source_oem_props = OPTIONS.source_info_dict.get("oem_fingerprint_properties") target_oem_props = OPTIONS.target_info_dict.get("oem_fingerprint_properties") oem_dicts = None - if source_oem_props and target_oem_props: + if source_oem_props or target_oem_props: + recovery_mount_options = OPTIONS.source_info_dict.get( + "recovery_mount_options") oem_dicts = _LoadOemDicts(script, recovery_mount_options) metadata = {