Avoid some unnecessary hash look ups

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

@ -1068,14 +1068,14 @@ class Britney(object):
packages = get_dependency_solvers(block, binaries_t_a, provides_t_a) packages = get_dependency_solvers(block, binaries_t_a, provides_t_a)
if packages: if packages:
for p in packages: for p in packages:
if p not in binaries_s_a: if p.pkg_id.package_name not in binaries_s_a:
continue continue
excuse.add_sane_dep(binaries_s_a[p].source) excuse.add_sane_dep(p.source)
continue continue
# check if the block can be satisfied in the source suite, and list the solving packages # 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 = 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: # if the dependency can be satisfied by the same source package, skip the block:
# obviously both binary packages will enter testing together # 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: for dep_suite in suite_info:
dep_binaries_s_a, dep_provides_s_a = dep_suite.binaries[arch] dep_binaries_s_a, dep_provides_s_a = dep_suite.binaries[arch]
pkgs = solvers(block, dep_binaries_s_a, dep_provides_s_a) pkgs = solvers(block, dep_binaries_s_a, dep_provides_s_a)
for p in pkgs: for pdata 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]
dep_pkg_id = pdata.pkg_id dep_pkg_id = pdata.pkg_id
if dep: if dep:
sat.add(dep_pkg_id) 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 # 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 = 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: # if the dependency can be satisfied by the same source package, skip the block:
# obviously both binary packages will enter the target suite together # 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 present)
if (op == '' and version == '') or apt_pkg.check_dep(package.version, op, version): if (op == '' and version == '') or apt_pkg.check_dep(package.version, op, version):
if archqual is None: if archqual is None:
packages.append(name) packages.append(package)
elif build_depends: elif build_depends:
# Multi-arch handling for build-dependencies # Multi-arch handling for build-dependencies
# - :native is ok iff the target is arch:any # - :native is ok iff the target is arch:any
if archqual == 'native' and package.architecture != 'all': if archqual == 'native' and package.architecture != 'all':
packages.append(name) packages.append(package)
# Multi-arch handling for both build-dependencies and regular dependencies # Multi-arch handling for both build-dependencies and regular dependencies
# - :any is ok iff the target has "M-A: allowed" # - :any is ok iff the target has "M-A: allowed"
if archqual == 'any' and package.multi_arch == '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 # 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): 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 continue
if (op == '' and version == '') or \ if (op == '' and version == '') or \
(prov_version != '' and apt_pkg.check_dep(prov_version, op, version)): (prov_version != '' and apt_pkg.check_dep(prov_version, op, version)):
packages.append(prov) packages.append(binaries_s_a[prov])
return packages return packages

Loading…
Cancel
Save