mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-06-12 18:21:40 +00:00
inst/builder.py: Split function in three to reduce indentation levels
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
dd5211d55a
commit
1e46965924
@ -23,13 +23,19 @@ from britney2.installability.solver import InstallabilitySolver
|
||||
def build_installability_tester(suite_info, archs):
|
||||
"""Create the installability tester"""
|
||||
|
||||
solvers = get_dependency_solvers
|
||||
builder = InstallabilityTesterBuilder()
|
||||
|
||||
for (suite, arch) in product(suite_info, archs):
|
||||
_build_inst_tester_on_suite_arch(builder, suite_info, suite, arch)
|
||||
|
||||
return builder.build()
|
||||
|
||||
|
||||
def _build_inst_tester_on_suite_arch(builder, suite_info, suite, arch):
|
||||
packages_s_a = suite.binaries[arch][0]
|
||||
is_target = suite.suite_class.is_target
|
||||
bin_prov = [s.binaries[arch] for s in suite_info]
|
||||
solvers = get_dependency_solvers
|
||||
for pkgdata in packages_s_a.values():
|
||||
pkg_id = pkgdata.pkg_id
|
||||
if not builder.add_binary(pkg_id,
|
||||
@ -51,6 +57,14 @@ def build_installability_tester(suite_info, archs):
|
||||
conflicts = None
|
||||
|
||||
if pkgdata.depends:
|
||||
depends = _compute_depends(pkgdata, bin_prov, solvers)
|
||||
else:
|
||||
depends = None
|
||||
|
||||
builder.set_relations(pkg_id, depends, conflicts)
|
||||
|
||||
|
||||
def _compute_depends(pkgdata, bin_prov, solvers):
|
||||
depends = []
|
||||
possible_dep_ranges = {}
|
||||
for block in apt_pkg.parse_depends(pkgdata.depends, False):
|
||||
@ -87,12 +101,8 @@ def build_installability_tester(suite_info, archs):
|
||||
|
||||
if possible_dep_ranges:
|
||||
depends.extend(possible_dep_ranges.values())
|
||||
else:
|
||||
depends = None
|
||||
|
||||
builder.set_relations(pkg_id, depends, conflicts)
|
||||
|
||||
return builder.build()
|
||||
return depends
|
||||
|
||||
|
||||
class InstallabilityTesterBuilder(object):
|
||||
|
Loading…
x
Reference in New Issue
Block a user