summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/Scheduler.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index cbb52448a..0de01756e 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -1164,13 +1164,23 @@ class Scheduler(PollScheduler):
self._prune_digraph()
chosen_pkg = None
- later = set(self._pkg_queue)
+
+ # Prefer uninstall operations when available.
+ graph = self._digraph
for pkg in self._pkg_queue:
- later.remove(pkg)
- if not self._dependent_on_scheduled_merges(pkg, later):
+ if pkg.operation == 'uninstall' and \
+ not graph.child_nodes(pkg):
chosen_pkg = pkg
break
+ if chosen_pkg is None:
+ later = set(self._pkg_queue)
+ for pkg in self._pkg_queue:
+ later.remove(pkg)
+ if not self._dependent_on_scheduled_merges(pkg, later):
+ chosen_pkg = pkg
+ break
+
if chosen_pkg is not None:
self._pkg_queue.remove(chosen_pkg)