Merge "Fix the read on a closed zipfile" am: b5b25409b9 am: 916b0cc0bc

Original change: https://android-review.googlesource.com/c/platform/build/+/1332612

Change-Id: Ice5c9ff31052ad32fe66d3ac42c02e72bda6e315
This commit is contained in:
Tianjie Xu 2020-06-13 02:51:47 +00:00 committed by Automerger Merge Worker
commit 31f2d57129
1 changed files with 10 additions and 3 deletions

View File

@ -2012,9 +2012,16 @@ def CalculateRuntimeDevicesAndFingerprints(build_info, boot_variable_values):
info_dict = copy.deepcopy(build_info.info_dict)
for partition in common.PARTITIONS_WITH_CARE_MAP:
partition_prop_key = "{}.build.prop".format(partition)
old_props = info_dict[partition_prop_key]
info_dict[partition_prop_key] = common.PartitionBuildProps.FromInputFile(
old_props.input_file, partition, placeholder_values)
input_file = info_dict[partition_prop_key].input_file
if isinstance(input_file, zipfile.ZipFile):
with zipfile.ZipFile(input_file.filename) as input_zip:
info_dict[partition_prop_key] = \
common.PartitionBuildProps.FromInputFile(input_zip, partition,
placeholder_values)
else:
info_dict[partition_prop_key] = \
common.PartitionBuildProps.FromInputFile(input_file, partition,
placeholder_values)
info_dict["build.prop"] = info_dict["system.build.prop"]
new_build_info = common.BuildInfo(info_dict, build_info.oem_dicts)