add signing checker script to releasetools
The check_target_files_signatures determines what key was used to sign
every .apk in a given target_files. It can compare that signature to
that of another target_files (eg, the previous release for that
device) and flag any problems such as .apks signed with a different
key.
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 26f216d..0e17a5f 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -141,12 +141,15 @@
BuildAndAddBootableImage(os.path.join(OPTIONS.input_tmp, "BOOT"),
"boot.img", output_zip)
-def UnzipTemp(filename):
+def UnzipTemp(filename, pattern=None):
"""Unzip the given archive into a temporary directory and return the name."""
tmp = tempfile.mkdtemp(prefix="targetfiles-")
OPTIONS.tempfiles.append(tmp)
- p = Run(["unzip", "-o", "-q", filename, "-d", tmp], stdout=subprocess.PIPE)
+ cmd = ["unzip", "-o", "-q", filename, "-d", tmp]
+ if pattern is not None:
+ cmd.append(pattern)
+ p = Run(cmd, stdout=subprocess.PIPE)
p.communicate()
if p.returncode != 0:
raise ExternalError("failed to unzip input target-files \"%s\"" %