Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6173371c authored by Kelvin Zhang's avatar Kelvin Zhang Committed by Automerger Merge Worker
Browse files

Merge "Searches for debugfs_static in search path" am: d073e3c8 am: 97c6cf5a am: 4ec6b159

Original change: https://android-review.googlesource.com/c/platform/build/+/1405908

Change-Id: I1046f3f8cec1473972641eaeb34b795fce5b8990
parents 18279046 4ec6b159
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ class ApexApkSigner(object):
    self.apex_path = apex_path
    self.key_passwords = key_passwords
    self.codename_to_api_level_map = codename_to_api_level_map
    self.debugfs_path = os.path.join(
        OPTIONS.search_path, "bin", "debugfs_static")

  def ProcessApexFile(self, apk_keys, payload_key, signing_args=None):
    """Scans and signs the apk files and repack the apex
@@ -61,14 +63,13 @@ class ApexApkSigner(object):
    Returns:
      The repacked apex file containing the signed apk files.
    """
    debugfs_path = os.path.join(OPTIONS.search_path, "bin", "debugfs_static")
    if not os.path.exists(debugfs_path):
    if not os.path.exists(self.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]
                self.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')]

@@ -98,8 +99,14 @@ class ApexApkSigner(object):

  def ExtractApexPayloadAndSignApks(self, apk_entries, apk_keys):
    """Extracts the payload image and signs the containing apk files."""
    if not os.path.exists(self.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>")
    payload_dir = common.MakeTempDir()
    extract_cmd = ['deapexer', 'extract', self.apex_path, payload_dir]
    extract_cmd = ['deapexer', '--debugfs_path',
                   self.debugfs_path, 'extract', self.apex_path, payload_dir]
    common.RunAndCheckOutput(extract_cmd)

    has_signed_apk = False