OSDN Git Service

Handle multiple APKs from the same package in check_target_files_signatures.py.
authorTao Bao <tbao@google.com>
Thu, 28 Jul 2016 02:45:43 +0000 (19:45 -0700)
committerTao Bao <tbao@google.com>
Thu, 28 Jul 2016 02:52:28 +0000 (19:52 -0700)
We were using the package name as the key to index APKs. APKs from the
same package got messed up and gave wrong signature summary. Switch to
using the package filename as the key, which is identical in a given build.

Also fix the trailing space when printing the signature summary.

Bug: 30418268
Test: Run with a target_files.zip that has multiple APKs from the same package.

Change-Id: I6317e8c05e987c5690915e05c294153d10e2f0ab

tools/releasetools/check_target_files_signatures.py

index 5c541ab..3048488 100755 (executable)
@@ -245,7 +245,7 @@ class TargetFiles(object):
             fullname = os.path.join(dirpath, fn)
             displayname = fullname[len(d)+1:]
             apk = APK(fullname, displayname)
-            self.apks[apk.package] = apk
+            self.apks[apk.filename] = apk
             self.apks_by_basename[os.path.basename(apk.filename)] = apk
 
             self.max_pkg_len = max(self.max_pkg_len, len(apk.package))
@@ -316,8 +316,7 @@ class TargetFiles(object):
                                         self.max_pkg_len, apk.package,
                                         apk.shared_uid)
         else:
-          print "  %-*s  %-*s" % (self.max_fn_len, apk.filename,
-                                  self.max_pkg_len, apk.package)
+          print "  %-*s  %s" % (self.max_fn_len, apk.filename, apk.package)
       print
 
   def CompareWith(self, other):