From 2c9e0b9b972bcca917b0ef4dd2f57923a1f4ea29 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Mon, 21 Jan 2019 20:12:46 +0000 Subject: [PATCH] do_all: Prune cruft after non-recursive hints (e.g. "easy") Signed-off-by: Niels Thykier --- britney.py | 12 ++++++++++++ britney2/migration.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/britney.py b/britney.py index 834a8a6..4966d61 100755 --- a/britney.py +++ b/britney.py @@ -1615,6 +1615,18 @@ class Britney(object): # Ensure upgrade_me and selected do not overlap, if we # follow-up with a recurse ("hint"-hint). upgrade_me = [x for x in upgrade_me if x not in set(selected)] + else: + # On non-recursive hints check for cruft and purge it proactively in case it "fixes" the hint. + cruft = [x for x in upgrade_me if x.is_cruft_removal] + cruft.extend(new_cruft) + if cruft: + output_logger.info("Checking if changes enables cruft removal") + (nuninst_end, remaining_cruft) = self.iter_packages(cruft, + selected, + nuninst=nuninst_end) + output_logger.info("Removed %d of %d cruft item(s) after the changes", + len(cruft) - len(remaining_cruft), len(cruft)) + new_cruft.difference_update(remaining_cruft) # Add new cruft items regardless of whether we recurse. A future run might clean # them for us. diff --git a/britney2/migration.py b/britney2/migration.py index a648e24..436d219 100644 --- a/britney2/migration.py +++ b/britney2/migration.py @@ -451,7 +451,7 @@ class MigrationManager(object): is_accepted = False break - new_cruft = [self._migration_item_factory.generate_removal_for_cruft_item(x) for x in smooth_updates] + new_cruft = {self._migration_item_factory.generate_removal_for_cruft_item(x) for x in smooth_updates} return (is_accepted, nuninst_after, arch, new_cruft)