Lines Matching defs:self

62   def _decodeExtra(self):
104 def __init__(self):
105 self.certs = {}
107 def Add(self, cert, name=None):
108 if cert in self.certs:
110 self.certs[cert] = self.certs[cert] + "," + name
115 self.certs[cert] = name
117 def Get(self, cert):
119 return self.certs.get(cert, None)
121 def FindLocalCerts(self):
136 self.Add(cert, name)
167 def __init__(self, full_filename, filename):
168 self.filename = filename
169 self.certs = None
170 self.shared_uid = None
171 self.package = None
175 self.RecordCerts(full_filename)
176 self.ReadManifest(full_filename)
180 def RecordCerts(self, full_filename):
197 self.certs = frozenset(out)
199 def ReadManifest(self, full_filename):
208 self.shared_uid = None
209 self.package = None
217 if self.shared_uid is not None:
219 self.shared_uid = m.group(2)
221 if self.package is not None:
223 self.package = m.group(2)
225 if self.package is None:
230 def __init__(self):
231 self.max_pkg_len = 30
232 self.max_fn_len = 20
233 self.apks = None
234 self.apks_by_basename = None
235 self.certmap = None
237 def LoadZipFile(self, filename):
240 self.apks = {}
241 self.apks_by_basename = {}
248 self.apks[apk.package] = apk
249 self.apks_by_basename[os.path.basename(apk.filename)] = apk
251 self.max_pkg_len = max(self.max_pkg_len, len(apk.package))
252 self.max_fn_len = max(self.max_fn_len, len(apk.filename))
256 self.certmap = common.ReadApkCerts(z)
259 def CheckSharedUids(self):
263 for apk in self.apks.itervalues():
280 print "%-*s [%s]" % (self.max_pkg_len, apk.package, apk.filename)
285 def CheckExternalSignatures(self):
286 for apk_filename, certname in self.certmap.iteritems():
292 apk = self.apks_by_basename[apk_filename]
299 def PrintCerts(self):
302 for apk in self.apks.itervalues():
315 print " %-*s %-*s [%s]" % (self.max_fn_len, apk.filename,
316 self.max_pkg_len, apk.package,
319 print " %-*s %-*s" % (self.max_fn_len, apk.filename,
320 self.max_pkg_len, apk.package)
323 def CompareWith(self, other):
325 self and other have different certs."""
327 all_apks = set(self.apks.keys())
330 max_pkg_len = max(self.max_pkg_len, other.max_pkg_len)
335 if i in self.apks:
338 if self.apks[i].certs != other.apks[i].certs:
340 self.apks[i].certs), []).append(i)
343 i, self.apks[i].filename)
365 new_fn = self.apks[i].filename