From 64d2bc4203f3c0881b14a86e1a88c908bd11063d Mon Sep 17 00:00:00 2001 From: Niels Thykier <niels@thykier.net> Date: Sun, 22 Jul 2018 10:23:27 +0000 Subject: [PATCH] builder.py: Make the code suite agnostic Signed-off-by: Niels Thykier <niels@thykier.net> --- britney.py | 2 +- britney2/installability/builder.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/britney.py b/britney.py index 111c7b4..e337354 100755 --- a/britney.py +++ b/britney.py @@ -361,7 +361,7 @@ class Britney(object): } self.logger.info("Compiling Installability tester") - self._inst_tester = build_installability_tester(self.binaries, self.options.architectures) + self._inst_tester = build_installability_tester(self.suite_info, self.options.architectures) if not self.options.nuninst_cache: self.logger.info("Building the list of non-installable packages for the full archive") diff --git a/britney2/installability/builder.py b/britney2/installability/builder.py index 034a18f..189f46d 100644 --- a/britney2/installability/builder.py +++ b/britney2/installability/builder.py @@ -21,20 +21,20 @@ from britney2.utils import ifilter_except, iter_except, get_dependency_solvers from britney2.installability.solver import InstallabilitySolver -def build_installability_tester(binaries, archs): +def build_installability_tester(suite_info, archs): """Create the installability tester""" solvers = get_dependency_solvers builder = InstallabilityTesterBuilder() - for (dist, arch) in product(binaries, archs): - testing = (dist == 'testing') - for pkgname in binaries[dist][arch][0]: - pkgdata = binaries[dist][arch][0][pkgname] + for (suite, arch) in product(suite_info, archs): + packages_s_a = suite.binaries[arch][0] + for pkgname in packages_s_a: + pkgdata = packages_s_a[pkgname] pkg_id = pkgdata.pkg_id if not builder.add_binary(pkg_id, essential=pkgdata.is_essential, - in_testing=testing): + in_testing=suite.suite_class.is_target): continue depends = [] @@ -55,8 +55,8 @@ def build_installability_tester(binaries, archs): for block in al: sat = set() - for dep_dist in binaries: - dep_binaries_s_a, dep_provides_s_a = binaries[dep_dist][arch] + 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