Build merged apexkeys.txt/apkcerts.txt by partition.

Propagate partition tag data to apexkeys.txt and
apkcerts.txt so that merge_target_files.py can build
merged versions of these files by filtering the
framework files for framework partitions and filtering
the vendor files for vendor partitions.

Bug: 138942268
Change-Id: Ic3226728e97dae84d38ec230ccc86d1b124bea94
Merged-In: Ic3226728e97dae84d38ec230ccc86d1b124bea94
This commit is contained in:
Bill Peckham
2020-03-20 18:31:43 -07:00
parent 1524571ff3
commit 8676f639f3
17 changed files with 241 additions and 31 deletions

View File

@@ -22,6 +22,7 @@ from merge_target_files import (validate_config_lists,
DEFAULT_FRAMEWORK_ITEM_LIST,
DEFAULT_VENDOR_ITEM_LIST,
DEFAULT_FRAMEWORK_MISC_INFO_KEYS, copy_items,
item_list_to_partition_set,
process_apex_keys_apk_certs_common)
@@ -142,6 +143,8 @@ class MergeTargetFilesTest(test_utils.ReleaseToolsTestCase):
os.path.join(vendor_dir, 'META', 'apexkeys.txt'))
process_apex_keys_apk_certs_common(framework_dir, vendor_dir, output_dir,
set(['product', 'system', 'system_ext']),
set(['odm', 'vendor']),
'apexkeys.txt')
merged_entries = []
@@ -175,4 +178,54 @@ class MergeTargetFilesTest(test_utils.ReleaseToolsTestCase):
os.path.join(conflict_dir, 'META', 'apexkeys.txt'))
self.assertRaises(ValueError, process_apex_keys_apk_certs_common,
framework_dir, conflict_dir, output_dir, 'apexkeys.txt')
framework_dir, conflict_dir, output_dir,
set(['product', 'system', 'system_ext']),
set(['odm', 'vendor']),
'apexkeys.txt')
def test_process_apex_keys_apk_certs_HandlesApkCertsSyntax(self):
output_dir = common.MakeTempDir()
os.makedirs(os.path.join(output_dir, 'META'))
framework_dir = common.MakeTempDir()
os.makedirs(os.path.join(framework_dir, 'META'))
os.symlink(
os.path.join(self.testdata_dir, 'apkcerts_framework.txt'),
os.path.join(framework_dir, 'META', 'apkcerts.txt'))
vendor_dir = common.MakeTempDir()
os.makedirs(os.path.join(vendor_dir, 'META'))
os.symlink(
os.path.join(self.testdata_dir, 'apkcerts_vendor.txt'),
os.path.join(vendor_dir, 'META', 'apkcerts.txt'))
process_apex_keys_apk_certs_common(framework_dir, vendor_dir, output_dir,
set(['product', 'system', 'system_ext']),
set(['odm', 'vendor']),
'apkcerts.txt')
merged_entries = []
merged_path = os.path.join(self.testdata_dir, 'apkcerts_merge.txt')
with open(merged_path) as f:
merged_entries = f.read().split('\n')
output_entries = []
output_path = os.path.join(output_dir, 'META', 'apkcerts.txt')
with open(output_path) as f:
output_entries = f.read().split('\n')
return self.assertEqual(merged_entries, output_entries)
def test_item_list_to_partition_set(self):
item_list = [
'META/apexkeys.txt',
'META/apkcerts.txt',
'META/filesystem_config.txt',
'PRODUCT/*',
'SYSTEM/*',
'SYSTEM_EXT/*',
]
partition_set = item_list_to_partition_set(item_list)
self.assertEqual(set(['product', 'system', 'system_ext']), partition_set)