inst-tester: Fix bug "choices" would not be updated

In some scenarios, it was possible to trigger a bug in the
installability tester, where it would fail to update the "choices" set.
The requirements for triggering this seems to be something like:

 * Obtain a choice that is possible to solve.
 * Resolve the choice without recursing (with a backtrack point)
 * Obtain a second choice that is impossible to solve.

After the two first steps, the installability tester would fail to
update the "choices" set (or, rather, changes would be invisible to
the "_pick_choice" function).  Fortunately, most packages are either
trivially installable or trivially uninstallable, so the bug seems to
be rather rare if triggred at all.

Signed-off-by: Niels Thykier <niels@thykier.net>
debian
Niels Thykier 10 years ago
parent b4e4ba4681
commit 6047875953

@ -274,8 +274,7 @@ class InstallabilityTester(object):
# curry check_loop # curry check_loop
check_loop = partial(self._check_loop, universe, testing, check_loop = partial(self._check_loop, universe, testing,
eqv_table, stats, musts, never, choices, eqv_table, stats, musts, never, cbroken)
cbroken)
# Useful things to remember: # Useful things to remember:
# #
@ -310,7 +309,7 @@ class InstallabilityTester(object):
rebuild. rebuild.
""" """
# We already satisfied/chosen at least one of the litterals # We already satisfied/chosen at least one of the literals
# in the choice, so the choice is gone # in the choice, so the choice is gone
for choice in filter(musts.isdisjoint, choices): for choice in filter(musts.isdisjoint, choices):
# cbroken is needed here because (in theory) it could # cbroken is needed here because (in theory) it could
@ -363,7 +362,7 @@ class InstallabilityTester(object):
check_tmp = set([p]) check_tmp = set([p])
if not self._check_loop(universe, testing, eqv_table, if not self._check_loop(universe, testing, eqv_table,
stats, musts_copy, never_tmp, stats, musts_copy, never_tmp,
choices_tmp, cbroken, cbroken, choices_tmp,
check_tmp): check_tmp):
# p cannot be chosen/is broken (unlikely, but ...) # p cannot be chosen/is broken (unlikely, but ...)
continue continue
@ -417,7 +416,7 @@ class InstallabilityTester(object):
# END _pick_choice # END _pick_choice
while check: while check:
if not check_loop(check): if not check_loop(choices, check):
verdict = False verdict = False
break break
@ -444,7 +443,7 @@ class InstallabilityTester(object):
return verdict return verdict
def _check_loop(self, universe, testing, eqv_table, stats, musts, never, def _check_loop(self, universe, testing, eqv_table, stats, musts, never,
choices, cbroken, check, len=len, cbroken, choices, check, len=len,
frozenset=frozenset): frozenset=frozenset):
"""Finds all guaranteed dependencies via "check". """Finds all guaranteed dependencies via "check".
@ -475,7 +474,7 @@ class InstallabilityTester(object):
# so "obviously" we can never choose any of its conflicts # so "obviously" we can never choose any of its conflicts
never.update(cons & testing) never.update(cons & testing)
# depgroup can be satisifed by picking something that is # depgroup can be satisfied by picking something that is
# already in musts - lets pick that (again). :) # already in musts - lets pick that (again). :)
for depgroup in not_satisfied(deps): for depgroup in not_satisfied(deps):
@ -552,8 +551,8 @@ class InstallabilityTester(object):
while ess_base: while ess_base:
self._check_loop(universe, testing, eqv_table, stats, self._check_loop(universe, testing, eqv_table, stats,
start, ess_never, ess_choices, start, ess_never, cbroken,
cbroken, ess_base) ess_choices, ess_base)
if ess_choices: if ess_choices:
# Try to break choices where possible # Try to break choices where possible
nchoice = set() nchoice = set()

Loading…
Cancel
Save