summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/sign_target_files_apks
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2009-12-10 11:22:57 -0800
committerDoug Zongker <dougz@android.com>2009-12-10 11:22:57 -0800
commitbbfb96f46472c74e2dbdd190fb67cdda13347eb4 (patch)
tree08ebb9d6a56927d098edc3aa69d9a4cea2e2263e /tools/releasetools/sign_target_files_apks
parentfe8ff19a2a0698d43868c86b5cead0553bdef8ea (diff)
downloadbuild-bbfb96f46472c74e2dbdd190fb67cdda13347eb4.zip
build-bbfb96f46472c74e2dbdd190fb67cdda13347eb4.tar.gz
build-bbfb96f46472c74e2dbdd190fb67cdda13347eb4.tar.bz2
remove shared_uid cert check from sign_targt_file_apks
This check (and others) are now done by the separate script check_target_files_signatures; the one here is redundant.
Diffstat (limited to 'tools/releasetools/sign_target_files_apks')
-rwxr-xr-xtools/releasetools/sign_target_files_apks63
1 files changed, 0 insertions, 63 deletions
diff --git a/tools/releasetools/sign_target_files_apks b/tools/releasetools/sign_target_files_apks
index 9d296d8..c974026 100755
--- a/tools/releasetools/sign_target_files_apks
+++ b/tools/releasetools/sign_target_files_apks
@@ -114,68 +114,6 @@ def CheckAllApksSigned(input_tf_zip, apk_key_map):
sys.exit(1)
-def SharedUserForApk(data):
- tmp = tempfile.NamedTemporaryFile()
- tmp.write(data)
- tmp.flush()
-
- p = common.Run(["aapt", "dump", "xmltree", tmp.name, "AndroidManifest.xml"],
- stdout=subprocess.PIPE)
- data, _ = p.communicate()
- if p.returncode != 0:
- raise ExternalError("failed to run aapt dump")
- lines = data.split("\n")
- for i in lines:
- m = re.match(r'^\s*A: android:sharedUserId\([0-9a-fx]*\)="([^"]*)" .*$', i)
- if m:
- return m.group(1)
- return None
-
-
-def CheckSharedUserIdsConsistent(input_tf_zip, apk_key_map):
- """Check that all packages that request the same shared user id are
- going to be signed with the same key."""
-
- shared_user_apks = {}
- maxlen = len("(unknown key)")
-
- for info in input_tf_zip.infolist():
- if info.filename.endswith(".apk"):
- data = input_tf_zip.read(info.filename)
-
- name = os.path.basename(info.filename)
- shared_user = SharedUserForApk(data)
- key = apk_key_map[name]
- maxlen = max(maxlen, len(key))
-
- if shared_user is not None:
- shared_user_apks.setdefault(
- shared_user, {}).setdefault(key, []).append(name)
-
- errors = []
- for k, v in shared_user_apks.iteritems():
- # each shared user should have exactly one key used for all the
- # apks that want that user.
- if len(v) > 1:
- errors.append((k, v))
-
- if not errors: return
-
- print "ERROR: shared user inconsistency. All apks wanting to use"
- print " a given shared user must be signed with the same key."
- print
- errors.sort()
- for user, keys in errors:
- print 'shared user id "%s":' % (user,)
- for key, apps in keys.iteritems():
- print ' %-*s %s' % (maxlen, key or "(unknown key)", apps[0])
- for a in apps[1:]:
- print (' ' * (maxlen+5)) + a
- print
-
- sys.exit(1)
-
-
def SignApk(data, keyname, pw):
unsigned = tempfile.NamedTemporaryFile()
unsigned.write(data)
@@ -350,7 +288,6 @@ def main(argv):
apk_key_map = GetApkCerts(input_zip)
CheckAllApksSigned(input_zip, apk_key_map)
- CheckSharedUserIdsConsistent(input_zip, apk_key_map)
key_passwords = common.GetKeyPasswords(set(apk_key_map.values()))
SignApks(input_zip, output_zip, apk_key_map, key_passwords)