Rename care map in pb format to care_map.pb

The new suffix distinguishes the new care_map from the ones in plain
text format; and thus the old update_verifier won't report an error
upon parsing failures.

Bug: 115740187
Test: Generate OTA files for Pixels
Change-Id: Ia782afd8cbb0f4bb8c363edaa00e92ab302d5d1b
This commit is contained in:
Tianjie Xu
2018-09-14 16:24:41 -07:00
parent 15f4979639
commit 4c05f4a41e
5 changed files with 63 additions and 56 deletions

View File

@@ -72,7 +72,7 @@ OPTIONS.replace_verity_public_key = False
OPTIONS.replace_verity_private_key = False
OPTIONS.is_signing = False
# Partitions that should have their care_map added to META/care_map.txt.
# Partitions that should have their care_map added to META/care_map.pb
PARTITIONS_WITH_CARE_MAP = ('system', 'vendor', 'product', 'product_services',
'odm')
# Use a fixed timestamp (01/01/2009 00:00:00 UTC) for files when packaging
@@ -542,12 +542,12 @@ def CheckAbOtaImages(output_zip, ab_partitions):
assert available, "Failed to find " + img_name
def AddCareMapTxtForAbOta(output_zip, ab_partitions, image_paths):
"""Generates and adds care_map.txt for system and vendor partitions.
def AddCareMapForAbOta(output_zip, ab_partitions, image_paths):
"""Generates and adds care_map.pb for system and vendor partitions.
Args:
output_zip: The output zip file (needs to be already open), or None to
write care_map.txt to OPTIONS.input_tmp/.
write care_map.pb to OPTIONS.input_tmp/.
ab_partitions: The list of A/B partitions.
image_paths: A map from the partition name to the image path.
"""
@@ -580,11 +580,11 @@ def AddCareMapTxtForAbOta(output_zip, ab_partitions, image_paths):
p = common.Run(care_map_gen_cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
output, _ = p.communicate()
assert p.returncode == 0, "Failed to generate the care_map proto message."
assert p.returncode == 0, "Failed to generate the care_map.pb message."
if OPTIONS.verbose:
print(output.rstrip())
care_map_path = "META/care_map.txt"
care_map_path = "META/care_map.pb"
if output_zip and care_map_path not in output_zip.namelist():
common.ZipWrite(output_zip, temp_care_map, arcname=care_map_path)
else:
@@ -644,7 +644,7 @@ def AddSuperEmpty(output_zip):
def ReplaceUpdatedFiles(zip_filename, files_list):
"""Updates all the ZIP entries listed in files_list.
For now the list includes META/care_map.txt, and the related files under
For now the list includes META/care_map.pb, and the related files under
SYSTEM/ after rebuilding recovery.
"""
common.ZipDelete(zip_filename, files_list)
@@ -693,8 +693,8 @@ def AddImagesToTargetFiles(filename):
os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
"vendor.img")))
has_odm = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "ODM")) or
os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
"odm.img")))
os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
"odm.img")))
has_product = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "PRODUCT")) or
os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
"product.img")))
@@ -824,9 +824,9 @@ def AddImagesToTargetFiles(filename):
# ready under IMAGES/ or RADIO/.
CheckAbOtaImages(output_zip, ab_partitions)
# Generate care_map.txt for system and vendor partitions (if present), then
# write this file to target_files package.
AddCareMapTxtForAbOta(output_zip, ab_partitions, partitions)
# Generate care_map.pb for system and vendor partitions (if present),
# then write this file to target_files package.
AddCareMapForAbOta(output_zip, ab_partitions, partitions)
# Radio images that need to be packed into IMAGES/, and product-img.zip.
pack_radioimages_txt = os.path.join(