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
This commit is contained in:
Kelvin Zhang
2020-08-19 14:54:42 -04:00
parent 2e80113ad2
commit d6b799a627

View File

@@ -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 <path>")
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')