forked from openkylin/platform_build
am 1623f79c: Merge from ics-mr0
* commit '1623f79c7561b19f57c10ac303f6246deee7c634': use frozensets to represent APK cert sets
This commit is contained in:
commit
02f5e8df68
|
@ -187,15 +187,15 @@ def CertFromPKCS7(data, filename):
|
||||||
class APK(object):
|
class APK(object):
|
||||||
def __init__(self, full_filename, filename):
|
def __init__(self, full_filename, filename):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.certs = set()
|
|
||||||
Push(filename+":")
|
Push(filename+":")
|
||||||
try:
|
try:
|
||||||
self.RecordCert(full_filename)
|
self.RecordCerts(full_filename)
|
||||||
self.ReadManifest(full_filename)
|
self.ReadManifest(full_filename)
|
||||||
finally:
|
finally:
|
||||||
Pop()
|
Pop()
|
||||||
|
|
||||||
def RecordCert(self, full_filename):
|
def RecordCerts(self, full_filename):
|
||||||
|
out = set()
|
||||||
try:
|
try:
|
||||||
f = open(full_filename)
|
f = open(full_filename)
|
||||||
apk = zipfile.ZipFile(f, "r")
|
apk = zipfile.ZipFile(f, "r")
|
||||||
|
@ -205,12 +205,13 @@ class APK(object):
|
||||||
(info.filename.endswith(".DSA") or info.filename.endswith(".RSA")):
|
(info.filename.endswith(".DSA") or info.filename.endswith(".RSA")):
|
||||||
pkcs7 = apk.read(info.filename)
|
pkcs7 = apk.read(info.filename)
|
||||||
cert = CertFromPKCS7(pkcs7, info.filename)
|
cert = CertFromPKCS7(pkcs7, info.filename)
|
||||||
self.certs.add(cert)
|
out.add(cert)
|
||||||
ALL_CERTS.Add(cert)
|
ALL_CERTS.Add(cert)
|
||||||
if not pkcs7:
|
if not pkcs7:
|
||||||
AddProblem("no signature")
|
AddProblem("no signature")
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
|
self.certs = frozenset(out)
|
||||||
|
|
||||||
def ReadManifest(self, full_filename):
|
def ReadManifest(self, full_filename):
|
||||||
p = common.Run(["aapt", "dump", "xmltree", full_filename,
|
p = common.Run(["aapt", "dump", "xmltree", full_filename,
|
||||||
|
|
Loading…
Reference in New Issue