validate list of valid excuses

ubuntu/rebased
Ivo De Decker 5 years ago
parent 8b6638c566
commit 2ccb056fa1

@ -651,8 +651,16 @@ class ExcuseFinder(object):
# extract the not considered packages, which are in the excuses but not in upgrade_me # extract the not considered packages, which are in the excuses but not in upgrade_me
unconsidered = {ename for ename in excuses if ename not in actionable_items} unconsidered = {ename for ename in excuses if ename not in actionable_items}
invalidated = set()
invalidate_excuses(excuses, actionable_items, unconsidered) invalidate_excuses(excuses, actionable_items, unconsidered, invalidated)
# check that the list of actionable items matches the list of valid
# excuses
assert actionable_items == {x for x in excuses if excuses[x].is_valid}
# check that the rdeps for all invalid excuses were invalidated
assert invalidated == {x for x in excuses if not excuses[x].is_valid}
mi_factory = self._migration_item_factory mi_factory = self._migration_item_factory
actionable_items = {mi_factory.parse_item(x, versioned=False, auto_correct=False) for x in actionable_items} actionable_items = {mi_factory.parse_item(x, versioned=False, auto_correct=False) for x in actionable_items}

@ -651,7 +651,7 @@ def get_dependency_solvers(block, binaries_s_a, provides_s_a, *, build_depends=F
return packages return packages
def invalidate_excuses(excuses, valid, invalid): def invalidate_excuses(excuses, valid, invalid, invalidated):
"""Invalidate impossible excuses """Invalidate impossible excuses
This method invalidates the impossible excuses, which depend This method invalidates the impossible excuses, which depend
@ -701,6 +701,7 @@ def invalidate_excuses(excuses, valid, invalid):
# loop on the invalid excuses # loop on the invalid excuses
for ename in iter_except(invalid.pop, KeyError): for ename in iter_except(invalid.pop, KeyError):
invalidated.add(ename)
# if there is no reverse dependency, skip the item # if there is no reverse dependency, skip the item
if ename not in excuses_rdeps: if ename not in excuses_rdeps:
continue continue

Loading…
Cancel
Save