Avoid some unnecessary hash look ups

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 6 years ago
parent 74c728bf91
commit fc834624fc

@ -1068,14 +1068,14 @@ class Britney(object):
packages = get_dependency_solvers(block, binaries_t_a, provides_t_a)
if packages:
for p in packages:
if p not in binaries_s_a:
if p.pkg_id.package_name not in binaries_s_a:
continue
excuse.add_sane_dep(binaries_s_a[p].source)
excuse.add_sane_dep(p.source)
continue
# check if the block can be satisfied in the source suite, and list the solving packages
packages = get_dependency_solvers(block, binaries_s_a, provides_s_a)
packages = [binaries_s_a[p].source for p in packages]
packages = [p.source for p in packages]
# if the dependency can be satisfied by the same source package, skip the block:
# obviously both binary packages will enter testing together

@ -58,11 +58,7 @@ def build_installability_tester(suite_info, archs):
for dep_suite in suite_info:
dep_binaries_s_a, dep_provides_s_a = dep_suite.binaries[arch]
pkgs = solvers(block, dep_binaries_s_a, dep_provides_s_a)
for p in pkgs:
# version and arch is already interned, but solvers use
# the package name extracted from the field and it is therefore
# not interned.
pdata = dep_binaries_s_a[p]
for pdata in pkgs:
dep_pkg_id = pdata.pkg_id
if dep:
sat.add(dep_pkg_id)

@ -712,7 +712,7 @@ class BuildDependsPolicy(BasePolicy):
# check if the block can be satisfied in the source suite, and list the solving packages
packages = get_dependency_solvers(block, binaries_s_a, provides_s_a, build_depends=True)
packages = [binaries_s_a[p].source for p in packages]
packages = [p.source for p in packages]
# if the dependency can be satisfied by the same source package, skip the block:
# obviously both binary packages will enter the target suite together

@ -793,17 +793,17 @@ def get_dependency_solvers(block, binaries_s_a, provides_s_a, *, build_depends=F
# (if present)
if (op == '' and version == '') or apt_pkg.check_dep(package.version, op, version):
if archqual is None:
packages.append(name)
packages.append(package)
elif build_depends:
# Multi-arch handling for build-dependencies
# - :native is ok iff the target is arch:any
if archqual == 'native' and package.architecture != 'all':
packages.append(name)
packages.append(package)
# Multi-arch handling for both build-dependencies and regular dependencies
# - :any is ok iff the target has "M-A: allowed"
if archqual == 'any' and package.multi_arch == 'allowed':
packages.append(name)
packages.append(package)
# look for the package in the virtual packages list and loop on them
for prov, prov_version in provides_s_a.get(name, empty_set):
@ -818,7 +818,7 @@ def get_dependency_solvers(block, binaries_s_a, provides_s_a, *, build_depends=F
continue
if (op == '' and version == '') or \
(prov_version != '' and apt_pkg.check_dep(prov_version, op, version)):
packages.append(prov)
packages.append(binaries_s_a[prov])
return packages

Loading…
Cancel
Save