From d6b799a6271c0da185b1859446612703d49fb717 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Wed, 19 Aug 2020 14:54:42 -0400 Subject: [PATCH] Searches for debugfs_static in search path When signing APks on build server, there might not be an android repo. Usually deapexer.py will be run from otatools.zip after exctration. So we should look for debugfs_static in search path Bug: 165347497 Test: Sign using self-service Change-Id: I608870b0184bd8f5f07afa53355b39de47a97e1c --- tools/releasetools/apex_utils.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py index afebc40f1b..3d24310039 100644 --- a/tools/releasetools/apex_utils.py +++ b/tools/releasetools/apex_utils.py @@ -61,7 +61,14 @@ class ApexApkSigner(object): Returns: The repacked apex file containing the signed apk files. """ - list_cmd = ['deapexer', 'list', self.apex_path] + debugfs_path = os.path.join(OPTIONS.search_path, "bin", "debugfs_static") + if not os.path.exists(debugfs_path): + raise ApexSigningError( + "Couldn't find location of debugfs_static: " + + "Path {} does not exist. ".format(debugfs_path) + + "Make sure bin/debugfs_static can be found in -p ") + list_cmd = ['deapexer', '--debugfs_path', + debugfs_path, 'list', self.apex_path] entries_names = common.RunAndCheckOutput(list_cmd).split() apk_entries = [name for name in entries_names if name.endswith('.apk')] @@ -149,7 +156,8 @@ class ApexApkSigner(object): # Add quote to the signing_args as we will pass # --signing_args "--signing_helper_with_files=%path" to apexer if signing_args: - generate_image_cmd.extend(['--signing_args', '"{}"'.format(signing_args)]) + generate_image_cmd.extend( + ['--signing_args', '"{}"'.format(signing_args)]) # optional arguments for apex repacking manifest_json = os.path.join(apex_dir, 'apex_manifest.json')