aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2016-09-29 19:53:56 -0500
committerTao Bao2016-09-30 17:29:09 -0500
commit9aa4b9b1b62a7e3914dfb8d58b4a10d30cfc60c2 (patch)
treedc54a6170ab16bb5441e7d71cb4715d699a75d48 /tools/releasetools/sign_target_files_apks.py
parent0a5b59e78b66d9afb28c491ffa50746b31ec749c (diff)
downloadplatform-build-9aa4b9b1b62a7e3914dfb8d58b4a10d30cfc60c2.tar.gz
platform-build-9aa4b9b1b62a7e3914dfb8d58b4a10d30cfc60c2.tar.xz
platform-build-9aa4b9b1b62a7e3914dfb8d58b4a10d30cfc60c2.zip
releasetools: Clean up sign_target_files_apks.py.
Remove the obsolete workaround for API 24. Also make it pylint clean. Test: 1. Sign a target_files.zip and get identical results. 2. `pylint --rcfile=pylintrc sign_target_files_apks.py` gives 10.00/10. Change-Id: I21736f959c5182486fd8ccebea9bbc594edef9fb
Diffstat (limited to 'tools/releasetools/sign_target_files_apks.py')
-rwxr-xr-xtools/releasetools/sign_target_files_apks.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 6d68be185..7f69a575e 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -280,7 +280,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info,
280 pass 280 pass
281 281
282 # Skip the care_map as we will regenerate the system/vendor images. 282 # Skip the care_map as we will regenerate the system/vendor images.
283 elif (info.filename == "META/care_map.txt"): 283 elif info.filename == "META/care_map.txt":
284 pass 284 pass
285 285
286 # Copy BOOT/, RECOVERY/, META/, ROOT/ to rebuild recovery patch. This case 286 # Copy BOOT/, RECOVERY/, META/, ROOT/ to rebuild recovery patch. This case
@@ -553,9 +553,12 @@ def ReplaceVerityKeyId(targetfile_input_zip, targetfile_output_zip, keypath):
553 for param in in_cmdline.split(): 553 for param in in_cmdline.split():
554 if "veritykeyid" in param: 554 if "veritykeyid" in param:
555 # extract keyid using openssl command 555 # extract keyid using openssl command
556 p = common.Run(["openssl", "x509", "-in", keypath, "-text"], stdout=subprocess.PIPE) 556 p = common.Run(
557 ["openssl", "x509", "-in", keypath, "-text"],
558 stdout=subprocess.PIPE)
557 keyid, stderr = p.communicate() 559 keyid, stderr = p.communicate()
558 keyid = re.search(r'keyid:([0-9a-fA-F:]*)', keyid).group(1).replace(':', '').lower() 560 keyid = re.search(
561 r'keyid:([0-9a-fA-F:]*)', keyid).group(1).replace(':', '').lower()
559 print "Replacing verity keyid with %s error=%s" % (keyid, stderr) 562 print "Replacing verity keyid with %s error=%s" % (keyid, stderr)
560 out_cmdline.append("veritykeyid=id:%s" % (keyid,)) 563 out_cmdline.append("veritykeyid=id:%s" % (keyid,))
561 else: 564 else:
@@ -592,7 +595,6 @@ def GetApiLevelAndCodename(input_tf_zip):
592 codename = None 595 codename = None
593 for line in data.split("\n"): 596 for line in data.split("\n"):
594 line = line.strip() 597 line = line.strip()
595 original_line = line
596 if line and line[0] != '#' and "=" in line: 598 if line and line[0] != '#' and "=" in line:
597 key, value = line.split("=", 1) 599 key, value = line.split("=", 1)
598 key = key.strip() 600 key = key.strip()
@@ -615,7 +617,6 @@ def GetCodenameToApiLevelMap(input_tf_zip):
615 codenames = None 617 codenames = None
616 for line in data.split("\n"): 618 for line in data.split("\n"):
617 line = line.strip() 619 line = line.strip()
618 original_line = line
619 if line and line[0] != '#' and "=" in line: 620 if line and line[0] != '#' and "=" in line:
620 key, value = line.split("=", 1) 621 key, value = line.split("=", 1)
621 key = key.strip() 622 key = key.strip()
@@ -698,12 +699,8 @@ def main(argv):
698 CheckAllApksSigned(input_zip, apk_key_map) 699 CheckAllApksSigned(input_zip, apk_key_map)
699 700
700 key_passwords = common.GetKeyPasswords(set(apk_key_map.values())) 701 key_passwords = common.GetKeyPasswords(set(apk_key_map.values()))
701 platform_api_level, platform_codename = GetApiLevelAndCodename(input_zip) 702 platform_api_level, _ = GetApiLevelAndCodename(input_zip)
702 codename_to_api_level_map = GetCodenameToApiLevelMap(input_zip) 703 codename_to_api_level_map = GetCodenameToApiLevelMap(input_zip)
703 # Android N will be API Level 24, but isn't yet.
704 # TODO: Remove this workaround once Android N is officially API Level 24.
705 if platform_api_level == 23 and platform_codename == "N":
706 platform_api_level = 24
707 704
708 ProcessTargetFiles(input_zip, output_zip, misc_info, 705 ProcessTargetFiles(input_zip, output_zip, misc_info,
709 apk_key_map, key_passwords, 706 apk_key_map, key_passwords,