Replace the use of inst_tester with new suite functionality

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 6 years ago
parent 03df891b7e
commit 65b67e763c
No known key found for this signature in database
GPG Key ID: A65B78DBE67C7AAC

@ -360,8 +360,7 @@ class Britney(object):
if not self.options.nuninst_cache: if not self.options.nuninst_cache:
self.logger.info("Building the list of non-installable packages for the full archive") self.logger.info("Building the list of non-installable packages for the full archive")
self._inst_tester.compute_testing_installability() self._inst_tester.compute_testing_installability()
nuninst = compile_nuninst(self.suite_info.target_suite.binaries, nuninst = compile_nuninst(target_suite,
self._inst_tester,
self.options.architectures, self.options.architectures,
self.options.nobreakall_arches) self.options.nobreakall_arches)
self.nuninst_orig = nuninst self.nuninst_orig = nuninst
@ -1459,13 +1458,12 @@ class Britney(object):
# handled everything for us correctly. However, arch:all have some special-casing IRT # handled everything for us correctly. However, arch:all have some special-casing IRT
# nobreakall that we deal with ourselves here. # nobreakall that we deal with ourselves here.
if binary_u.architecture == 'all' and pkg_id.architecture in self.options.nobreakall_arches: if binary_u.architecture == 'all' and pkg_id.architecture in self.options.nobreakall_arches:
inst_tester = self._inst_tester
# We sometimes forgive uninstallable arch:all packages on nobreakall architectures # We sometimes forgive uninstallable arch:all packages on nobreakall architectures
# (e.g. we sometimes force-hint in arch:all packages that are only installable on # (e.g. we sometimes force-hint in arch:all packages that are only installable on
# on a subset of all nobreak architectures). # on a subset of all nobreak architectures).
# This forgivness is only done if the package is already in testing AND it is broken # This forgivness is only done if the package is already in testing AND it is broken
# in testing on this architecture already. Anything else would be a regression # in testing on this architecture already. Anything else would be a regression
if inst_tester.is_pkg_in_testing(pkg_id) and not inst_tester.is_installable(pkg_id): if target_suite.is_pkg_in_the_suite(pkg_id) and not target_suite.is_installable(pkg_id):
# It is a regression. # It is a regression.
excuse.policy_verdict = PolicyVerdict.REJECTED_PERMANENTLY excuse.policy_verdict = PolicyVerdict.REJECTED_PERMANENTLY
@ -1834,7 +1832,6 @@ class Britney(object):
target_suite = self.suite_info.target_suite target_suite = self.suite_info.target_suite
binaries_s = source_suite.binaries binaries_s = source_suite.binaries
binaries_t = target_suite.binaries binaries_t = target_suite.binaries
inst_tester = self._inst_tester
pkg_universe = self.pkg_universe pkg_universe = self.pkg_universe
adds = set() adds = set()
@ -1870,7 +1867,7 @@ class Britney(object):
smoothbins = find_smooth_updateable_binaries(bins, smoothbins = find_smooth_updateable_binaries(bins,
source_suite.sources[source_name], source_suite.sources[source_name],
pkg_universe, pkg_universe,
inst_tester, target_suite,
binaries_t, binaries_t,
binaries_s, binaries_s,
removals, removals,
@ -2173,7 +2170,7 @@ class Britney(object):
for arch in affected_architectures: for arch in affected_architectures:
check_archall = arch in nobreakall_arches check_archall = arch in nobreakall_arches
check_installability(self._inst_tester, packages_t, arch, affected_direct, affected_all, check_installability(target_suite, packages_t, arch, affected_direct, affected_all,
check_archall, nuninst_after) check_archall, nuninst_after)
# if the uninstallability counter is worse than before, break the loop # if the uninstallability counter is worse than before, break the loop
@ -2415,8 +2412,7 @@ class Britney(object):
cached_nuninst = self.nuninst_orig cached_nuninst = self.nuninst_orig
self._inst_tester.compute_testing_installability() self._inst_tester.compute_testing_installability()
computed_nuninst = compile_nuninst(self.suite_info.target_suite.binaries, computed_nuninst = compile_nuninst(self.suite_info.target_suite,
self._inst_tester,
self.options.architectures, self.options.architectures,
self.options.nobreakall_arches) self.options.nobreakall_arches)
if cached_nuninst != computed_nuninst: # pragma: no cover if cached_nuninst != computed_nuninst: # pragma: no cover

@ -390,8 +390,8 @@ class AutopkgtestPolicy(BasePolicy):
def request_tests_for_source(self, suite, arch, source_name, source_version, pkg_arch_result): def request_tests_for_source(self, suite, arch, source_name, source_version, pkg_arch_result):
pkg_universe = self.britney.pkg_universe pkg_universe = self.britney.pkg_universe
inst_tester = self.britney._inst_tester
suite_info = self.suite_info suite_info = self.suite_info
target_suite = suite_info.target_suite
sources_s = suite_info[suite].sources sources_s = suite_info[suite].sources
binaries_info = sources_s[source_name] binaries_info = sources_s[source_name]
packages_s_a = suite_info[suite].binaries[arch] packages_s_a = suite_info[suite].binaries[arch]
@ -444,7 +444,7 @@ class AutopkgtestPolicy(BasePolicy):
# depends is a frozenset{frozenset{BinaryPackageId, ..}} # depends is a frozenset{frozenset{BinaryPackageId, ..}}
for deps_of_bin in depends: for deps_of_bin in depends:
for dep in deps_of_bin: for dep in deps_of_bin:
if inst_tester.is_pkg_in_testing(dep): if target_suite.is_pkg_in_the_suite(dep):
names_testing.add(dep.package_name) names_testing.add(dep.package_name)
else: else:
names_unstable.add(dep.package_name) names_unstable.add(dep.package_name)
@ -466,7 +466,7 @@ class AutopkgtestPolicy(BasePolicy):
names_testing = set() names_testing = set()
names_unstable = set() names_unstable = set()
for broken_bin in broken: for broken_bin in broken:
if inst_tester.is_pkg_in_testing(broken_bin): if target_suite.is_pkg_in_the_suite(broken_bin):
names_testing.add(broken_bin.package_name) names_testing.add(broken_bin.package_name)
else: else:
names_unstable.add(broken_bin.package_name) names_unstable.add(broken_bin.package_name)

@ -561,7 +561,7 @@ def clone_nuninst(nuninst, *, packages_s=None, architectures=None):
return clone return clone
def test_installability(inst_tester, pkg_name, pkg_id, broken, nuninst_arch): def test_installability(target_suite, pkg_name, pkg_id, broken, nuninst_arch):
"""Test for installability of a package on an architecture """Test for installability of a package on an architecture
(pkg_name, pkg_version, pkg_arch) is the package to check. (pkg_name, pkg_version, pkg_arch) is the package to check.
@ -574,7 +574,7 @@ def test_installability(inst_tester, pkg_name, pkg_id, broken, nuninst_arch):
way as broken is. way as broken is.
""" """
c = 0 c = 0
r = inst_tester.is_installable(pkg_id) r = target_suite.is_installable(pkg_id)
if not r: if not r:
# not installable # not installable
if pkg_name not in broken: if pkg_name not in broken:
@ -593,7 +593,7 @@ def test_installability(inst_tester, pkg_name, pkg_id, broken, nuninst_arch):
return c return c
def check_installability(inst_tester, binaries, arch, updates, affected, check_archall, nuninst): def check_installability(target_suite, binaries, arch, updates, affected, check_archall, nuninst):
broken = nuninst[arch + "+all"] broken = nuninst[arch + "+all"]
packages_t_a = binaries[arch] packages_t_a = binaries[arch]
improvement = 0 improvement = 0
@ -614,7 +614,7 @@ def check_installability(inst_tester, binaries, arch, updates, affected, check_a
nuninst_arch = nuninst[parch] nuninst_arch = nuninst[parch]
else: else:
nuninst[parch].discard(name) nuninst[parch].discard(name)
result = test_installability(inst_tester, name, pkg_id, broken, nuninst_arch) result = test_installability(target_suite, name, pkg_id, broken, nuninst_arch)
if improvement > 0 or not result: if improvement > 0 or not result:
# Any improvement could in theory fix all of its rdeps, so # Any improvement could in theory fix all of its rdeps, so
# stop updating "improvement" after that. # stop updating "improvement" after that.
@ -648,7 +648,7 @@ def check_installability(inst_tester, binaries, arch, updates, affected, check_a
nuninst_arch = nuninst[parch] nuninst_arch = nuninst[parch]
elif actual_arch == 'all': elif actual_arch == 'all':
nuninst[parch].discard(name) nuninst[parch].discard(name)
test_installability(inst_tester, name, pkg_id, broken, nuninst_arch) test_installability(target_suite, name, pkg_id, broken, nuninst_arch)
def possibly_compressed(path, *, permitted_compressions=None): def possibly_compressed(path, *, permitted_compressions=None):
@ -911,15 +911,16 @@ def invalidate_excuses(excuses, valid, invalid):
excuses[x].policy_verdict = rdep_verdict excuses[x].policy_verdict = rdep_verdict
def compile_nuninst(binaries_t, inst_tester, architectures, nobreakall_arches): def compile_nuninst(target_suite, architectures, nobreakall_arches):
"""Compile a nuninst dict from the current testing """Compile a nuninst dict from the current testing
:param binaries_t: Britney's binaries data structure for testing :param suite: The target suite
:param inst_tester: Britney's installability tester :param inst_tester: Britney's installability tester
:param architectures: List of architectures :param architectures: List of architectures
:param nobreakall_arches: List of architectures where arch:all packages must be installable :param nobreakall_arches: List of architectures where arch:all packages must be installable
""" """
nuninst = {} nuninst = {}
binaries_t = target_suite.binaries
# for all the architectures # for all the architectures
for arch in architectures: for arch in architectures:
@ -930,7 +931,7 @@ def compile_nuninst(binaries_t, inst_tester, architectures, nobreakall_arches):
nuninst[arch] = set() nuninst[arch] = set()
packages_t_a = binaries_t[arch] packages_t_a = binaries_t[arch]
for pkg_name, pkg_data in packages_t_a.items(): for pkg_name, pkg_data in packages_t_a.items():
r = inst_tester.is_installable(pkg_data.pkg_id) r = target_suite.is_installable(pkg_data.pkg_id)
if not r: if not r:
nuninst[arch].add(pkg_name) nuninst[arch].add(pkg_name)
@ -948,7 +949,7 @@ def compile_nuninst(binaries_t, inst_tester, architectures, nobreakall_arches):
def find_smooth_updateable_binaries(binaries_to_check, def find_smooth_updateable_binaries(binaries_to_check,
source_data, source_data,
pkg_universe, pkg_universe,
inst_tester, target_suite,
binaries_t, binaries_t,
binaries_s, binaries_s,
removals, removals,
@ -981,7 +982,7 @@ def find_smooth_updateable_binaries(binaries_to_check,
rdeps.difference_update(removals, binaries_to_check) rdeps.difference_update(removals, binaries_to_check)
smooth_update_it = False smooth_update_it = False
if inst_tester.any_of_these_are_in_testing(rdeps): if target_suite.any_of_these_are_in_the_suite(rdeps):
combined = set(smoothbins) combined = set(smoothbins)
combined.add(pkg_id) combined.add(pkg_id)
for rdep in rdeps: for rdep in rdeps:

Loading…
Cancel
Save