Misc fixes to release tools.

- Remove vendor_dlkm and odm_dlkm from the default list of items that
need to be merged
- Allow a prebuilt system.img to be used when adding images to the
target files archive

Test: Built Pixel 3a and inspected the output
Change-Id: If5291fff559ed9517133f6b476d8dee2500c5b4c
This commit is contained in:
Chris Gross 2020-09-15 09:53:44 -07:00
parent 9f5b7aa9b2
commit 435b8fe7ba
2 changed files with 22 additions and 45 deletions

View File

@ -739,6 +739,18 @@ def ReplaceUpdatedFiles(zip_filename, files_list):
common.ZipClose(output_zip)
def HasPartition(partition_name):
"""Determines if the target files archive should build a given partition."""
return ((os.path.isdir(
os.path.join(OPTIONS.input_tmp, partition_name.upper())) and
OPTIONS.info_dict.get(
"building_{}_image".format(partition_name)) == "true") or
os.path.exists(
os.path.join(OPTIONS.input_tmp, "IMAGES",
"{}.img".format(partition_name))))
def AddImagesToTargetFiles(filename):
"""Creates and adds images (boot/recovery/system/...) to a target_files.zip.
@ -767,49 +779,16 @@ def AddImagesToTargetFiles(filename):
has_boot = OPTIONS.info_dict.get("no_boot") != "true"
has_vendor_boot = OPTIONS.info_dict.get("vendor_boot") == "true"
# {vendor,odm,product,system_ext,vendor_dlkm,odm_dlkm}.img
# are unlike system.img or
# system_other.img, because it could be built from source, or dropped into
# target_files.zip as a prebuilt blob. We consider either of them as
# {vendor,product,system_ext}.img being available, which could be
# used when generating vbmeta.img for AVB.
has_vendor = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, "VENDOR")) and
OPTIONS.info_dict.get("building_vendor_image") == "true") or
os.path.exists(
os.path.join(OPTIONS.input_tmp, "IMAGES", "vendor.img")))
has_odm = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, "ODM")) and
OPTIONS.info_dict.get("building_odm_image") == "true") or
os.path.exists(
os.path.join(OPTIONS.input_tmp, "IMAGES", "odm.img")))
has_vendor_dlkm = ((os.path.isdir(os.path.join(OPTIONS.input_tmp,
"VENDOR_DLKM")) and
OPTIONS.info_dict.get("building_vendor_dlkm_image")
== "true") or
os.path.exists(
os.path.join(OPTIONS.input_tmp, "IMAGES",
"vendor_dlkm.img")))
has_odm_dlkm = ((os.path.isdir(os.path.join(OPTIONS.input_tmp,
"ODM_DLKM")) and
OPTIONS.info_dict.get("building_odm_dlkm_image")
== "true") or
os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
"odm_dlkm.img")))
has_product = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, "PRODUCT")) and
OPTIONS.info_dict.get("building_product_image") == "true") or
os.path.exists(
os.path.join(OPTIONS.input_tmp, "IMAGES", "product.img")))
has_system_ext = (
(os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM_EXT")) and
OPTIONS.info_dict.get("building_system_ext_image") == "true") or
os.path.exists(
os.path.join(OPTIONS.input_tmp, "IMAGES", "system_ext.img")))
has_system = (
os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM")) and
OPTIONS.info_dict.get("building_system_image") == "true")
has_system_other = (
os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM_OTHER")) and
OPTIONS.info_dict.get("building_system_other_image") == "true")
# {vendor,odm,product,system_ext,vendor_dlkm,odm_dlkm, system, system_other}.img
# can be built from source, or dropped into target_files.zip as a prebuilt blob.
has_vendor = HasPartition("vendor")
has_odm = HasPartition("odm")
has_vendor_dlkm = HasPartition("vendor_dlkm")
has_odm_dlkm = HasPartition("odm_dlkm")
has_product = HasPartition("product")
has_system_ext = HasPartition("system_ext")
has_system = HasPartition("system")
has_system_other = HasPartition("system_other")
has_userdata = OPTIONS.info_dict.get("building_userdata_image") == "true"
has_cache = OPTIONS.info_dict.get("building_cache_image") == "true"

View File

@ -197,8 +197,6 @@ DEFAULT_VENDOR_ITEM_LIST = (
'PREBUILT_IMAGES/*',
'RADIO/*',
'VENDOR/*',
'VENDOR_DLKM/*',
'ODM_DLKM/*',
)
# VENDOR_EXTRACT_SPECIAL_ITEM_LIST is a list of items to extract from the