summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/depgraph.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-10-02 13:49:08 -0700
committerZac Medico <zmedico@gentoo.org>2010-10-02 13:49:08 -0700
commit3bfe3980538b814b5a1dda1ca512f0f7f4770a09 (patch)
treed37c14e04c184d25224995e116b4ff2db661f2dd /pym/_emerge/depgraph.py
parentba8749938a870e85bf82a18916493d44eb9a4517 (diff)
downloadportage-3bfe3980538b814b5a1dda1ca512f0f7f4770a09.tar.gz
portage-3bfe3980538b814b5a1dda1ca512f0f7f4770a09.tar.bz2
portage-3bfe3980538b814b5a1dda1ca512f0f7f4770a09.zip
Prune circular nested sets from the digraph.
This prevents the following traceback which was reported in forum thread 847007: File "pym/_emerge/depgraph.py", line 3694, in _merge_order_bias mygraph.order.sort(key=cmp_sort_key(cmp_merge_preference)) File "pym/portage/util/__init__.py", line 808, in __lt__ return self._cmp_func(self._obj, other._obj) < 0 File "pym/_emerge/depgraph.py", line 3675, in cmp_merge_preference if node1.operation == 'uninstall': AttributeError: 'SetArg' object has no attribute 'operation'
Diffstat (limited to 'pym/_emerge/depgraph.py')
-rw-r--r--pym/_emerge/depgraph.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 045e57184..7f5d16864 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -3800,11 +3800,26 @@ class depgraph(object):
and node.operation == 'merge'], scheduler_graph)
mygraph=self._dynamic_config.digraph.copy()
+
+ removed_nodes = set()
+
+ # Prune off all DependencyArg instances since they aren't
+ # needed, and because of nested sets this is faster than doing
+ # it with multiple digraph.root_nodes() calls below. This also
+ # takes care of nested sets that have circular references,
+ # which wouldn't be matched by digraph.root_nodes().
+ for node in mygraph:
+ if isinstance(node, DependencyArg):
+ removed_nodes.add(node)
+ if removed_nodes:
+ mygraph.difference_update(removed_nodes)
+ removed_nodes.clear()
+
# Prune "nomerge" root nodes if nothing depends on them, since
# otherwise they slow down merge order calculation. Don't remove
# non-root nodes since they help optimize merge order in some cases
# such as revdep-rebuild.
- removed_nodes = set()
+
while True:
for node in mygraph.root_nodes():
if not isinstance(node, Package) or \