From c72718c7c54e33a8a0f21688d028257486b9226f Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Wed, 27 Jan 2021 14:17:14 -0500 Subject: [PATCH] Only add apex_info for compressed apexes Test: mm -j dist, then make sure apex_info.pb doesn't contain non-compressed apex Change-Id: I6262eb97ec53de28953257d8b3b77e32ac0259be --- tools/releasetools/apex_utils.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py index 7ccc95cb9..8ebfb4bb4 100644 --- a/tools/releasetools/apex_utils.py +++ b/tools/releasetools/apex_utils.py @@ -458,6 +458,15 @@ def GetApexInfoFromTargetFiles(input_file): target_dir = os.path.join(tmp_dir, "SYSTEM/apex/") apex_infos = [] + + debugfs_path = "debugfs" + if OPTIONS.search_path: + debugfs_path = os.path.join(OPTIONS.search_path, "bin", "debugfs_static") + deapexer = 'deapexer' + if OPTIONS.search_path: + deapexer_path = os.path.join(OPTIONS.search_path, "deapexer") + if os.path.isfile(deapexer_path): + deapexer = deapexer_path for apex_filename in os.listdir(target_dir): apex_filepath = os.path.join(target_dir, apex_filename) if not os.path.isfile(apex_filepath) or \ @@ -470,14 +479,6 @@ def GetApexInfoFromTargetFiles(input_file): apex_info.package_name = manifest.name apex_info.version = manifest.version # Check if the file is compressed or not - debugfs_path = "debugfs" - if OPTIONS.search_path: - debugfs_path = os.path.join(OPTIONS.search_path, "bin", "debugfs_static") - deapexer = 'deapexer' - if OPTIONS.search_path: - deapexer_path = os.path.join(OPTIONS.search_path, "deapexer") - if os.path.isfile(deapexer_path): - deapexer = deapexer_path apex_type = RunAndCheckOutput([ deapexer, "--debugfs_path", debugfs_path, 'info', '--print-type', apex_filepath]).rstrip() @@ -498,6 +499,6 @@ def GetApexInfoFromTargetFiles(input_file): '--output', decompressed_file_path]) apex_info.decompressed_size = os.path.getsize(decompressed_file_path) - apex_infos.append(apex_info) + apex_infos.append(apex_info) return apex_infos