Optimize some hash lookups

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 7 years ago
parent 499f7d993c
commit 77ec8a34f9

@ -362,7 +362,7 @@ class AutopkgtestPolicy(BasePolicy):
if re.match('gcc-\d$', src): if re.match('gcc-\d$', src):
for test in ['binutils', 'fglrx-installer', 'libreoffice', 'linux']: for test in ['binutils', 'fglrx-installer', 'libreoffice', 'linux']:
try: try:
tests.append((test, self.britney.sources['testing'][test].version)) tests.append((test, sources_info[test].version))
except KeyError: except KeyError:
# no package in that series? *shrug*, then not (mostly for testing) # no package in that series? *shrug*, then not (mostly for testing)
pass pass
@ -376,7 +376,7 @@ class AutopkgtestPolicy(BasePolicy):
# all come from linux-meta*. A new kernel ABI without a corresponding # all come from linux-meta*. A new kernel ABI without a corresponding
# -meta won't be installed and thus we can't sensibly run tests against # -meta won't be installed and thus we can't sensibly run tests against
# it. # it.
if src.startswith('linux') and src.replace('linux', 'linux-meta') in self.britney.sources['testing']: if src.startswith('linux') and src.replace('linux', 'linux-meta') in sources_info:
return [] return []
# we want to test the package itself, if it still has a test in unstable # we want to test the package itself, if it still has a test in unstable
@ -444,7 +444,7 @@ class AutopkgtestPolicy(BasePolicy):
tests.append((pkg, self.britney.sources['unstable'][pkg].version)) tests.append((pkg, self.britney.sources['unstable'][pkg].version))
except KeyError: except KeyError:
try: try:
tests.append((pkg, self.britney.sources['testing'][pkg].version)) tests.append((pkg, sources_info[pkg].version))
except KeyError: except KeyError:
# package not in that series? *shrug*, then not # package not in that series? *shrug*, then not
pass pass

Loading…
Cancel
Save