summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/depgraph.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-05 10:21:43 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-05 11:10:17 -0700
commitc603773283a5288c702a742a0eb2b10f49915809 (patch)
tree1fd47548d590865d19fb8cb6b339f1cd215850a6 /pym/_emerge/depgraph.py
parent62e95606f6000ff133d95d7369de65ad0de25168 (diff)
downloadportage-c603773283a5288c702a742a0eb2b10f49915809.tar.gz
portage-c603773283a5288c702a742a0eb2b10f49915809.tar.bz2
portage-c603773283a5288c702a742a0eb2b10f49915809.zip
depgraph: simplify break_refsv2.1.9.47
Diffstat (limited to 'pym/_emerge/depgraph.py')
-rw-r--r--pym/_emerge/depgraph.py34
1 files changed, 14 insertions, 20 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 9e7b0bbfc..23197db36 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -4217,8 +4217,6 @@ class depgraph(object):
mergelist = self.altlist()
self._implicit_libc_deps(mergelist,
self._dynamic_config._scheduler_graph)
- self.break_refs(mergelist)
- self.break_refs(self._dynamic_config._scheduler_graph.order)
# Break DepPriority.satisfied attributes which reference
# installed Package instances.
@@ -4240,31 +4238,27 @@ class depgraph(object):
for root in trees:
trees[root]['vartree']._pkg_cache = pruned_pkg_cache
- self.break_refs(trees[root]['vartree'].dbapi)
- self.break_refs(pruned_pkg_cache)
+ self.break_refs()
sched_config = \
_scheduler_graph_config(trees, pruned_pkg_cache, graph, mergelist)
return sched_config
- def break_refs(self, nodes):
+ def break_refs(self):
"""
- Take a mergelist like that returned from self.altlist() and
- break any references that lead back to the depgraph. This is
- useful if you want to hold references to packages without
- also holding the depgraph on the heap.
+ Break any references in Package instances that lead back to the depgraph.
+ This is useful if you want to hold references to packages without also
+ holding the depgraph on the heap. It should only be called after the
+ depgraph will not be used for any more calculations.
"""
- for node in nodes:
- if hasattr(node, "root_config"):
- # The FakeVartree references the _package_cache which
- # references the depgraph. So that Package instances don't
- # hold the depgraph and FakeVartree on the heap, replace
- # the RootConfig that references the FakeVartree with the
- # original RootConfig instance which references the actual
- # vartree.
- node.root_config = \
- self._frozen_config._trees_orig[node.root_config.root]["root_config"]
+ for root_config in self._frozen_config.roots.values():
+ root_config.update(self._frozen_config._trees_orig[
+ root_config.root]["root_config"])
+ # Both instances are now identical, so discard the
+ # original which should have no other references.
+ self._frozen_config._trees_orig[
+ root_config.root]["root_config"] = root_config
def _resolve_conflicts(self):
if not self._complete_graph():
@@ -6029,7 +6023,7 @@ def _resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner):
# package has already been installed.
dropped_tasks.update(pkg for pkg in \
unsatisfied_parents if pkg.operation != "nomerge")
- mydepgraph.break_refs(unsatisfied_parents)
+ mydepgraph.break_refs()
del e, graph, traversed_nodes, \
unsatisfied_parents, unsatisfied_stack