Loading tools/releasetools/add_img_to_target_files.py +1 −2 Original line number Diff line number Diff line Loading @@ -835,8 +835,7 @@ def HasPartition(partition_name): def AddApexInfo(output_zip): apex_infos = GetApexInfoFromTargetFiles(OPTIONS.input_tmp, 'system', compressed_only=False) apex_infos = GetApexInfoFromTargetFiles(OPTIONS.input_tmp) apex_metadata_proto = ota_metadata_pb2.ApexMetadata() apex_metadata_proto.apex_info.extend(apex_infos) apex_info_bytes = apex_metadata_proto.SerializeToString() Loading tools/releasetools/apex_utils.py +10 −5 Original line number Diff line number Diff line Loading @@ -534,22 +534,28 @@ def SignApex(avbtool, apex_data, payload_key, container_key, container_pw, 'Failed to get type for {}:\n{}'.format(apex_file, e)) def GetApexInfoFromTargetFiles(input_file, partition, compressed_only=True): def GetApexInfoFromTargetFiles(input_file): """ Get information about system APEX stored in the input_file zip Get information about APEXes stored in the input_file zip Args: input_file: The filename of the target build target-files zip or directory. Return: A list of ota_metadata_pb2.ApexInfo() populated using the APEX stored in /system partition of the input_file each partition of the input_file """ # Extract the apex files so that we can run checks on them if not isinstance(input_file, str): raise RuntimeError("must pass filepath to target-files zip or directory") apex_infos = [] for partition in ['system', 'system_ext', 'product', 'vendor']: apex_infos.extend(GetApexInfoForPartition(input_file, partition)) return apex_infos def GetApexInfoForPartition(input_file, partition): apex_subdir = os.path.join(partition.upper(), 'apex') if os.path.isdir(input_file): tmp_dir = input_file Loading Loading @@ -607,7 +613,6 @@ def GetApexInfoFromTargetFiles(input_file, partition, compressed_only=True): '--output', decompressed_file_path]) apex_info.decompressed_size = os.path.getsize(decompressed_file_path) if not compressed_only or apex_info.is_compressed: apex_infos.append(apex_info) return apex_infos tools/releasetools/merge/merge_compatibility_checks.py +2 −2 Original line number Diff line number Diff line Loading @@ -190,8 +190,8 @@ def CheckApexDuplicatePackages(target_files_dir, partition_map): apex_packages = set() for partition in partition_map.keys(): try: apex_info = apex_utils.GetApexInfoFromTargetFiles( target_files_dir, partition, compressed_only=False) apex_info = apex_utils.GetApexInfoForPartition( target_files_dir, partition) except RuntimeError as err: errors.append(str(err)) apex_info = [] Loading tools/releasetools/test_ota_from_target_files.py +1 −1 Original line number Diff line number Diff line Loading @@ -299,7 +299,7 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): @test_utils.SkipIfExternalToolsUnavailable() def test_GetApexInfoFromTargetFiles(self): target_files = construct_target_files(compressedApex=True) apex_infos = GetApexInfoFromTargetFiles(target_files, 'system') apex_infos = GetApexInfoFromTargetFiles(target_files) self.assertEqual(len(apex_infos), 1) self.assertEqual(apex_infos[0].package_name, "com.android.apex.compressed") self.assertEqual(apex_infos[0].version, 1) Loading Loading
tools/releasetools/add_img_to_target_files.py +1 −2 Original line number Diff line number Diff line Loading @@ -835,8 +835,7 @@ def HasPartition(partition_name): def AddApexInfo(output_zip): apex_infos = GetApexInfoFromTargetFiles(OPTIONS.input_tmp, 'system', compressed_only=False) apex_infos = GetApexInfoFromTargetFiles(OPTIONS.input_tmp) apex_metadata_proto = ota_metadata_pb2.ApexMetadata() apex_metadata_proto.apex_info.extend(apex_infos) apex_info_bytes = apex_metadata_proto.SerializeToString() Loading
tools/releasetools/apex_utils.py +10 −5 Original line number Diff line number Diff line Loading @@ -534,22 +534,28 @@ def SignApex(avbtool, apex_data, payload_key, container_key, container_pw, 'Failed to get type for {}:\n{}'.format(apex_file, e)) def GetApexInfoFromTargetFiles(input_file, partition, compressed_only=True): def GetApexInfoFromTargetFiles(input_file): """ Get information about system APEX stored in the input_file zip Get information about APEXes stored in the input_file zip Args: input_file: The filename of the target build target-files zip or directory. Return: A list of ota_metadata_pb2.ApexInfo() populated using the APEX stored in /system partition of the input_file each partition of the input_file """ # Extract the apex files so that we can run checks on them if not isinstance(input_file, str): raise RuntimeError("must pass filepath to target-files zip or directory") apex_infos = [] for partition in ['system', 'system_ext', 'product', 'vendor']: apex_infos.extend(GetApexInfoForPartition(input_file, partition)) return apex_infos def GetApexInfoForPartition(input_file, partition): apex_subdir = os.path.join(partition.upper(), 'apex') if os.path.isdir(input_file): tmp_dir = input_file Loading Loading @@ -607,7 +613,6 @@ def GetApexInfoFromTargetFiles(input_file, partition, compressed_only=True): '--output', decompressed_file_path]) apex_info.decompressed_size = os.path.getsize(decompressed_file_path) if not compressed_only or apex_info.is_compressed: apex_infos.append(apex_info) return apex_infos
tools/releasetools/merge/merge_compatibility_checks.py +2 −2 Original line number Diff line number Diff line Loading @@ -190,8 +190,8 @@ def CheckApexDuplicatePackages(target_files_dir, partition_map): apex_packages = set() for partition in partition_map.keys(): try: apex_info = apex_utils.GetApexInfoFromTargetFiles( target_files_dir, partition, compressed_only=False) apex_info = apex_utils.GetApexInfoForPartition( target_files_dir, partition) except RuntimeError as err: errors.append(str(err)) apex_info = [] Loading
tools/releasetools/test_ota_from_target_files.py +1 −1 Original line number Diff line number Diff line Loading @@ -299,7 +299,7 @@ class OtaFromTargetFilesTest(test_utils.ReleaseToolsTestCase): @test_utils.SkipIfExternalToolsUnavailable() def test_GetApexInfoFromTargetFiles(self): target_files = construct_target_files(compressedApex=True) apex_infos = GetApexInfoFromTargetFiles(target_files, 'system') apex_infos = GetApexInfoFromTargetFiles(target_files) self.assertEqual(len(apex_infos), 1) self.assertEqual(apex_infos[0].package_name, "com.android.apex.compressed") self.assertEqual(apex_infos[0].version, 1) Loading