From 5057b95572428ee59922431017a37f119c9b006a Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 7 Jan 2021 14:09:57 -0800 Subject: [PATCH] Split PARTITIONS_WITH_BUILD_PROP from *_WITH_CARE_MAP Right now they are the same content. In the future, boot will be added to PARTITIONS_WITH_BUILD_PROP, but it is not added to PARTITIONS_WITH_CARE_MAP. Boot partition has a cpio filesystem in the ramdisk, so it contains a build.prop file, but it doesn't make sense to create care map from it. Test: TH Bug: 162623577 Change-Id: I9b5a20fe2d774b52cf7d5eae9deecbc75122a3dd --- tools/releasetools/common.py | 11 +++++++---- tools/releasetools/ota_utils.py | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index c4240c485..a32c710f0 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -128,6 +128,9 @@ PARTITIONS_WITH_CARE_MAP = [ 'odm_dlkm', ] +# Partitions with a build.prop file +PARTITIONS_WITH_BUILD_PROP = PARTITIONS_WITH_CARE_MAP + # See sysprop.mk. If file is moved, add new search paths here; don't remove # existing search paths. RAMDISK_BUILD_PROP_REL_PATHS = ['system/etc/ramdisk/build.prop'] @@ -420,7 +423,7 @@ class BuildInfo(object): "3.2.2. Build Parameters.".format(fingerprint)) self._partition_fingerprints = {} - for partition in PARTITIONS_WITH_CARE_MAP: + for partition in PARTITIONS_WITH_BUILD_PROP: try: fingerprint = self.CalculatePartitionFingerprint(partition) check_fingerprint(fingerprint) @@ -428,7 +431,7 @@ class BuildInfo(object): except ExternalError: continue if "system" in self._partition_fingerprints: - # system_other is not included in PARTITIONS_WITH_CARE_MAP, but does + # system_other is not included in PARTITIONS_WITH_BUILD_PROP, but does # need a fingerprint when creating the image. self._partition_fingerprints[ "system_other"] = self._partition_fingerprints["system"] @@ -756,7 +759,7 @@ def LoadInfoDict(input_file, repacking=False): # Tries to load the build props for all partitions with care_map, including # system and vendor. - for partition in PARTITIONS_WITH_CARE_MAP: + for partition in PARTITIONS_WITH_BUILD_PROP: partition_prop = "{}.build.prop".format(partition) d[partition_prop] = PartitionBuildProps.FromInputFile( input_file, partition) @@ -766,7 +769,7 @@ def LoadInfoDict(input_file, repacking=False): # hash / hashtree footers. if d.get("avb_enable") == "true": build_info = BuildInfo(d) - for partition in PARTITIONS_WITH_CARE_MAP: + for partition in PARTITIONS_WITH_BUILD_PROP: fingerprint = build_info.GetPartitionFingerprint(partition) if fingerprint: d["avb_{}_salt".format(partition)] = sha256(fingerprint.encode()).hexdigest() diff --git a/tools/releasetools/ota_utils.py b/tools/releasetools/ota_utils.py index be6a13495..6bbcc923b 100644 --- a/tools/releasetools/ota_utils.py +++ b/tools/releasetools/ota_utils.py @@ -21,7 +21,7 @@ import zipfile import ota_metadata_pb2 from common import (ZipDelete, ZipClose, OPTIONS, MakeTempFile, ZipWriteStr, BuildInfo, LoadDictionaryFromFile, - SignFile, PARTITIONS_WITH_CARE_MAP, PartitionBuildProps) + SignFile, PARTITIONS_WITH_BUILD_PROP, PartitionBuildProps) logger = logging.getLogger(__name__) @@ -174,7 +174,7 @@ def UpdateDeviceState(device_state, build_info, boot_variable_values, # delta_generator will error out on unused timestamps, # so only generate timestamps for dynamic partitions # used in OTA update. - for partition in sorted(set(PARTITIONS_WITH_CARE_MAP) & ab_partitions): + for partition in sorted(set(PARTITIONS_WITH_BUILD_PROP) & ab_partitions): partition_prop = build_info.info_dict.get( '{}.build.prop'.format(partition)) # Skip if the partition is missing, or it doesn't have a build.prop @@ -360,7 +360,7 @@ def ComputeRuntimeBuildInfos(default_build_info, boot_variable_values): # Reload the info_dict as some build properties may change their values # based on the value of ro.boot* properties. info_dict = copy.deepcopy(default_build_info.info_dict) - for partition in PARTITIONS_WITH_CARE_MAP: + for partition in PARTITIONS_WITH_BUILD_PROP: partition_prop_key = "{}.build.prop".format(partition) input_file = info_dict[partition_prop_key].input_file if isinstance(input_file, zipfile.ZipFile):