Autopkgtest: Make has_autodep8 a class method

So that we can use it without having to instantiate a full AutoPackageTest
object.
bzr-import-20160707
Martin Pitt 9 years ago
parent 327361bd04
commit 0e3434ddbd

@ -121,16 +121,18 @@ class AutoPackageTest(object):
def log_error(self, msg): def log_error(self, msg):
print('E: [%s] - %s' % (time.asctime(), msg)) print('E: [%s] - %s' % (time.asctime(), msg))
def has_autodep8(self, srcinfo): @classmethod
def has_autodep8(kls, srcinfo, binaries):
'''Check if package is covered by autodep8 '''Check if package is covered by autodep8
srcinfo is an item from self.britney.sources srcinfo is an item from self.britney.sources
binaries is self.britney.binaries['unstable'][arch][0]
''' '''
# DKMS: some binary depends on "dkms" # DKMS: some binary depends on "dkms"
for bin_arch in srcinfo[BINARIES]: for bin_arch in srcinfo[BINARIES]:
binpkg = bin_arch.split('/')[0] # chop off arch binpkg = bin_arch.split('/')[0] # chop off arch
try: try:
bininfo = self.britney.binaries['unstable']['amd64'][0][binpkg] bininfo = binaries[binpkg]
except KeyError: except KeyError:
continue continue
if 'dkms' in (bininfo[DEPENDS] or ''): if 'dkms' in (bininfo[DEPENDS] or ''):
@ -186,7 +188,7 @@ class AutoPackageTest(object):
srcinfo = sources_info[src] srcinfo = sources_info[src]
# we want to test the package itself, if it still has a test in # we want to test the package itself, if it still has a test in
# unstable # unstable
if srcinfo[AUTOPKGTEST] or self.has_autodep8(srcinfo): if srcinfo[AUTOPKGTEST] or self.has_autodep8(srcinfo, binaries_info):
reported_pkgs.add(src) reported_pkgs.add(src)
tests.append((src, ver)) tests.append((src, ver))
@ -227,7 +229,7 @@ class AutoPackageTest(object):
continue continue
else: else:
rdep_src_info = sources_info[rdep_src] rdep_src_info = sources_info[rdep_src]
if rdep_src_info[AUTOPKGTEST] or self.has_autodep8(rdep_src_info): if rdep_src_info[AUTOPKGTEST] or self.has_autodep8(rdep_src_info, binaries_info):
if rdep_src not in reported_pkgs: if rdep_src not in reported_pkgs:
tests.append((rdep_src, rdep_src_info[VERSION])) tests.append((rdep_src, rdep_src_info[VERSION]))
reported_pkgs.add(rdep_src) reported_pkgs.add(rdep_src)

Loading…
Cancel
Save