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

Commit 8c61c301 authored by Doug Zongker's avatar Doug Zongker Committed by The Android Open Source Project
Browse files

AI 146193: Fix signing script so keys specified in -e options get passed

  through the key map.  Clarify the help for the -e option to
  make clear this should happen.
  (This change doesn't affect device code.)

Automated import of CL 146193
parent a7bfb4f3
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -26,8 +26,10 @@ Usage: sign_target_files_apks [flags] input_target_files output_target_files


  -e  (--extra_apks)  <name,name,...=key>
  -e  (--extra_apks)  <name,name,...=key>
      Add extra APK name/key pairs as though they appeared in
      Add extra APK name/key pairs as though they appeared in
      apkcerts.zip.  Option may be repeated to give multiple extra
      apkcerts.txt (so mappings specified by -k and -d are applied).
      packages.
      Keys specified in -e override any value for that app contained
      in the apkcerts.txt file.  Option may be repeated to give
      multiple extra packages.


  -k  (--key_mapping)  <src_key=dest_key>
  -k  (--key_mapping)  <src_key=dest_key>
      Add a mapping from the key name as specified in apkcerts.txt (the
      Add a mapping from the key name as specified in apkcerts.txt (the
@@ -68,7 +70,7 @@ OPTIONS.key_map = {}




def GetApkCerts(tf_zip):
def GetApkCerts(tf_zip):
  certmap = OPTIONS.extra_apks.copy()
  certmap = {}
  for line in tf_zip.read("META/apkcerts.txt").split("\n"):
  for line in tf_zip.read("META/apkcerts.txt").split("\n"):
    line = line.strip()
    line = line.strip()
    if not line: continue
    if not line: continue
@@ -77,6 +79,8 @@ def GetApkCerts(tf_zip):
    if not m:
    if not m:
      raise SigningError("failed to parse line from apkcerts.txt:\n" + line)
      raise SigningError("failed to parse line from apkcerts.txt:\n" + line)
    certmap[m.group(1)] = OPTIONS.key_map.get(m.group(2), m.group(2))
    certmap[m.group(1)] = OPTIONS.key_map.get(m.group(2), m.group(2))
  for apk, cert in OPTIONS.extra_apks.iteritems():
    certmap[apk] = OPTIONS.key_map.get(cert, cert)
  return certmap
  return certmap