summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-07-01 00:27:38 +0000
committerZac Medico <zmedico@gentoo.org>2009-07-01 00:27:38 +0000
commit38d16678a5e31519adc200b6b002104effd5be92 (patch)
tree22205b07aeec6f065c8a0624b8f80e81253671d1
parentea92be10c650ba2b743b76728479145e6c566685 (diff)
downloadportage-38d16678a5e31519adc200b6b002104effd5be92.tar.gz
portage-38d16678a5e31519adc200b6b002104effd5be92.tar.bz2
portage-38d16678a5e31519adc200b6b002104effd5be92.zip
Fix depgraph._serialize_tasks so it never performa a needless uninstall task
when a package in the same slot is scheduled to replace it. svn path=/main/trunk/; revision=13752
-rw-r--r--pym/_emerge/depgraph.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index ee02417d9..4f64ec9c7 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2877,28 +2877,16 @@ class depgraph(object):
ignore_priority = priority_range.ignore_priority[i]
nodes = get_nodes(ignore_priority=ignore_priority)
if nodes:
- # If there is a mix of uninstall nodes with other
- # types, save the uninstall nodes for later since
- # sometimes a merge node will render an uninstall
- # node unnecessary (due to occupying the same slot),
- # and we want to avoid executing a separate uninstall
- # task in that case.
+ # If there is a mixuture of merges and uninstalls,
+ # do the uninstalls first.
if len(nodes) > 1:
good_uninstalls = []
- with_some_uninstalls_excluded = []
for node in nodes:
if node.operation == "uninstall":
- slot_node = self._dynamic_config.mydbapi[node.root
- ].match_pkgs(node.slot_atom)
- if slot_node and \
- slot_node[0].operation == "merge":
- continue
good_uninstalls.append(node)
- with_some_uninstalls_excluded.append(node)
+
if good_uninstalls:
nodes = good_uninstalls
- elif with_some_uninstalls_excluded:
- nodes = with_some_uninstalls_excluded
else:
nodes = nodes
@@ -3151,6 +3139,17 @@ class depgraph(object):
scheduler_graph.add(blocked_pkg, uninst_task,
priority=BlockerDepPriority.instance)
+ # Sometimes a merge node will render an uninstall
+ # node unnecessary (due to occupying the same SLOT),
+ # and we want to avoid executing a separate uninstall
+ # task in that case.
+ slot_node = self._dynamic_config.mydbapi[uninst_task.root
+ ].match_pkgs(uninst_task.slot_atom)
+ if slot_node and \
+ slot_node[0].operation == "merge":
+ mygraph.add(slot_node[0], uninst_task,
+ priority=BlockerDepPriority.instance)
+
# Reset the state variables for leaf node selection and
# continue trying to select leaf nodes.
prefer_asap = True