mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-03-09 18:21:09 +00:00
Replace the use of inst_tester with new suite functionality
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
03df891b7e
commit
65b67e763c
14
britney.py
14
britney.py
@ -360,8 +360,7 @@ class Britney(object):
|
||||
if not self.options.nuninst_cache:
|
||||
self.logger.info("Building the list of non-installable packages for the full archive")
|
||||
self._inst_tester.compute_testing_installability()
|
||||
nuninst = compile_nuninst(self.suite_info.target_suite.binaries,
|
||||
self._inst_tester,
|
||||
nuninst = compile_nuninst(target_suite,
|
||||
self.options.architectures,
|
||||
self.options.nobreakall_arches)
|
||||
self.nuninst_orig = nuninst
|
||||
@ -1459,13 +1458,12 @@ class Britney(object):
|
||||
# handled everything for us correctly. However, arch:all have some special-casing IRT
|
||||
# nobreakall that we deal with ourselves here.
|
||||
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
|
||||
# (e.g. we sometimes force-hint in arch:all packages that are only installable on
|
||||
# on a subset of all nobreak architectures).
|
||||
# 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
|
||||
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.
|
||||
excuse.policy_verdict = PolicyVerdict.REJECTED_PERMANENTLY
|
||||
|
||||
@ -1834,7 +1832,6 @@ class Britney(object):
|
||||
target_suite = self.suite_info.target_suite
|
||||
binaries_s = source_suite.binaries
|
||||
binaries_t = target_suite.binaries
|
||||
inst_tester = self._inst_tester
|
||||
pkg_universe = self.pkg_universe
|
||||
|
||||
adds = set()
|
||||
@ -1870,7 +1867,7 @@ class Britney(object):
|
||||
smoothbins = find_smooth_updateable_binaries(bins,
|
||||
source_suite.sources[source_name],
|
||||
pkg_universe,
|
||||
inst_tester,
|
||||
target_suite,
|
||||
binaries_t,
|
||||
binaries_s,
|
||||
removals,
|
||||
@ -2173,7 +2170,7 @@ class Britney(object):
|
||||
for arch in affected_architectures:
|
||||
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)
|
||||
|
||||
# if the uninstallability counter is worse than before, break the loop
|
||||
@ -2415,8 +2412,7 @@ class Britney(object):
|
||||
|
||||
cached_nuninst = self.nuninst_orig
|
||||
self._inst_tester.compute_testing_installability()
|
||||
computed_nuninst = compile_nuninst(self.suite_info.target_suite.binaries,
|
||||
self._inst_tester,
|
||||
computed_nuninst = compile_nuninst(self.suite_info.target_suite,
|
||||
self.options.architectures,
|
||||
self.options.nobreakall_arches)
|
||||
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):
|
||||
pkg_universe = self.britney.pkg_universe
|
||||
inst_tester = self.britney._inst_tester
|
||||
suite_info = self.suite_info
|
||||
target_suite = suite_info.target_suite
|
||||
sources_s = suite_info[suite].sources
|
||||
binaries_info = sources_s[source_name]
|
||||
packages_s_a = suite_info[suite].binaries[arch]
|
||||
@ -444,7 +444,7 @@ class AutopkgtestPolicy(BasePolicy):
|
||||
# depends is a frozenset{frozenset{BinaryPackageId, ..}}
|
||||
for deps_of_bin in depends:
|
||||
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)
|
||||
else:
|
||||
names_unstable.add(dep.package_name)
|
||||
@ -466,7 +466,7 @@ class AutopkgtestPolicy(BasePolicy):
|
||||
names_testing = set()
|
||||
names_unstable = set()
|
||||
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)
|
||||
else:
|
||||
names_unstable.add(broken_bin.package_name)
|
||||
|
@ -561,7 +561,7 @@ def clone_nuninst(nuninst, *, packages_s=None, architectures=None):
|
||||
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
|
||||
|
||||
(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.
|
||||
"""
|
||||
c = 0
|
||||
r = inst_tester.is_installable(pkg_id)
|
||||
r = target_suite.is_installable(pkg_id)
|
||||
if not r:
|
||||
# not installable
|
||||
if pkg_name not in broken:
|
||||
@ -593,7 +593,7 @@ def test_installability(inst_tester, pkg_name, pkg_id, broken, nuninst_arch):
|
||||
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"]
|
||||
packages_t_a = binaries[arch]
|
||||
improvement = 0
|
||||
@ -614,7 +614,7 @@ def check_installability(inst_tester, binaries, arch, updates, affected, check_a
|
||||
nuninst_arch = nuninst[parch]
|
||||
else:
|
||||
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:
|
||||
# Any improvement could in theory fix all of its rdeps, so
|
||||
# stop updating "improvement" after that.
|
||||
@ -648,7 +648,7 @@ def check_installability(inst_tester, binaries, arch, updates, affected, check_a
|
||||
nuninst_arch = nuninst[parch]
|
||||
elif actual_arch == 'all':
|
||||
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):
|
||||
@ -911,15 +911,16 @@ def invalidate_excuses(excuses, valid, invalid):
|
||||
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
|
||||
|
||||
:param binaries_t: Britney's binaries data structure for testing
|
||||
:param suite: The target suite
|
||||
:param inst_tester: Britney's installability tester
|
||||
:param architectures: List of architectures
|
||||
:param nobreakall_arches: List of architectures where arch:all packages must be installable
|
||||
"""
|
||||
nuninst = {}
|
||||
binaries_t = target_suite.binaries
|
||||
|
||||
# for all the architectures
|
||||
for arch in architectures:
|
||||
@ -930,7 +931,7 @@ def compile_nuninst(binaries_t, inst_tester, architectures, nobreakall_arches):
|
||||
nuninst[arch] = set()
|
||||
packages_t_a = binaries_t[arch]
|
||||
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:
|
||||
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,
|
||||
source_data,
|
||||
pkg_universe,
|
||||
inst_tester,
|
||||
target_suite,
|
||||
binaries_t,
|
||||
binaries_s,
|
||||
removals,
|
||||
@ -981,7 +982,7 @@ def find_smooth_updateable_binaries(binaries_to_check,
|
||||
rdeps.difference_update(removals, binaries_to_check)
|
||||
|
||||
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.add(pkg_id)
|
||||
for rdep in rdeps:
|
||||
|
Loading…
x
Reference in New Issue
Block a user