summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-22 23:11:23 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-22 23:11:23 +0000
commit989f3b0a16e7bd8fd3ec313755ebdd7d8e9c450e (patch)
tree2c1156a1a9e03d2af6904fa8c034d30d2740aaa8
parent82182a2b012edae9316bc6e8c67596bb2e98a181 (diff)
downloadportage-989f3b0a16e7bd8fd3ec313755ebdd7d8e9c450e.tar.gz
portage-989f3b0a16e7bd8fd3ec313755ebdd7d8e9c450e.tar.bz2
portage-989f3b0a16e7bd8fd3ec313755ebdd7d8e9c450e.zip
Make Scheduler._choose_pkg() prefer uninstall operations when available.
svn path=/main/trunk/; revision=14128
-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)