target-files: Support erofs_compress_hints

erofs_compress_hints files should be copied into target-files and then
sign_target_files_apks should use them from the target-files.

Bug: 357721652
Test: m target-files-package (with aosp/3204257)
Test: sign_target_files_apks <target_file> signed-target-files.zip
Change-Id: Id55000004ecb72ea8fec19bfbe144c9b4d3f06cb
This commit is contained in:
Jooyung Han
2024-08-08 17:17:53 +09:00
parent fa47605191
commit 67911682c2
2 changed files with 49 additions and 2 deletions

View File

@@ -907,9 +907,10 @@ def LoadInfoDict(input_file, repacking=False):
d["root_fs_config"] = os.path.join(
input_file, "META", "root_filesystem_config.txt")
partitions = ["system", "vendor", "system_ext", "product", "odm",
"vendor_dlkm", "odm_dlkm", "system_dlkm"]
# Redirect {partition}_base_fs_file for each of the named partitions.
for part_name in ["system", "vendor", "system_ext", "product", "odm",
"vendor_dlkm", "odm_dlkm", "system_dlkm"]:
for part_name in partitions:
key_name = part_name + "_base_fs_file"
if key_name not in d:
continue
@@ -922,6 +923,25 @@ def LoadInfoDict(input_file, repacking=False):
"Failed to find %s base fs file: %s", part_name, base_fs_file)
del d[key_name]
# Redirecting helper for optional properties like erofs_compress_hints
def redirect_file(prop, filename):
if prop not in d:
return
config_file = os.path.join(input_file, "META/" + filename)
if os.path.exists(config_file):
d[prop] = config_file
else:
logger.warning(
"Failed to find %s fro %s", filename, prop)
del d[key_name]
# Redirect erofs_[default_]compress_hints files
redirect_file("erofs_default_compress_hints",
"erofs_default_compress_hints.txt")
for part in partitions:
redirect_file(part + "_erofs_compress_hints",
part + "_erofs_compress_hints.txt")
def makeint(key):
if key in d:
d[key] = int(d[key], 0)