Runs host_init_verifier on merged target files packages.
This verifies the init rc files in the merged result.
Bug: 163089173
Test: test_common.py
Test: Run merge_target_files.py to merge two target-files packages where
one has init_rc errors. Observe script failure.
Test: Run merge_target_files.py on two good target-files packages,
observe no failure.
Change-Id: I86c8e5a2bc07c2c1896ac40afd32bc1d055447ee
diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py
index b1b4a16..9360d7b 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -951,18 +951,15 @@
if not check_target_files_vintf.CheckVintf(output_target_files_temp_dir):
raise RuntimeError('Incompatible VINTF metadata')
+ partition_map = common.PartitionMapFromTargetFiles(
+ output_target_files_temp_dir)
+
# Generate and check for cross-partition violations of sharedUserId
# values in APKs. This requires the input target-files packages to contain
# *.apk files.
shareduid_violation_modules = os.path.join(
output_target_files_temp_dir, 'META', 'shareduid_violation_modules.json')
with open(shareduid_violation_modules, 'w') as f:
- framework_partitions = item_list_to_partition_set(framework_item_list)
- vendor_partitions = item_list_to_partition_set(vendor_item_list)
-
- partition_map = {}
- for partition in (framework_partitions.union(vendor_partitions)):
- partition_map[partition.lower()] = partition.upper()
violation = find_shareduid_violation.FindShareduidViolation(
output_target_files_temp_dir, partition_map)
@@ -970,6 +967,8 @@
f.write(violation)
# Check for violations across the input builds' partition groups.
+ framework_partitions = item_list_to_partition_set(framework_item_list)
+ vendor_partitions = item_list_to_partition_set(vendor_item_list)
shareduid_errors = common.SharedUidPartitionViolations(
json.loads(violation), [framework_partitions, vendor_partitions])
if shareduid_errors:
@@ -978,6 +977,17 @@
raise ValueError('sharedUserId APK error. See %s' %
shareduid_violation_modules)
+ # Run host_init_verifier on the combined init rc files.
+ filtered_partitions = {
+ partition: path
+ for partition, path in partition_map.items()
+ # host_init_verifier checks only the following partitions:
+ if partition in ['system', 'system_ext', 'product', 'vendor', 'odm']
+ }
+ common.RunHostInitVerifier(
+ product_out=output_target_files_temp_dir,
+ partition_map=filtered_partitions)
+
generate_images(output_target_files_temp_dir, rebuild_recovery)
generate_super_empty_image(output_target_files_temp_dir, output_super_empty)