From 16cd42f25994f53359679c0fbc02474259815ffc Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 6 Sep 2010 00:04:12 -0700 Subject: Make depgraph.schedulerGraph() return an instance of _scheduler_graph_config instead of just a digraph. This new object includes instances of FakeVartree and a package cache that is pruned to contain only installed packages or those in the digraph. --- pym/_emerge/depgraph.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'pym/_emerge/depgraph.py') diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 3230d9a73..2a4d6eecd 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -63,6 +63,12 @@ if sys.hexversion >= 0x3000000: basestring = str long = int +class _scheduler_graph_config(object): + def __init__(self, trees, pkg_cache, graph): + self.trees = trees + self.pkg_cache = pkg_cache + self.graph = graph + class _frozen_depgraph_config(object): def __init__(self, settings, trees, myopts, spinner): @@ -3486,7 +3492,23 @@ class depgraph(object): if priority.satisfied: priority.satisfied = True - return self._dynamic_config._scheduler_graph + pkg_cache = self._frozen_config._pkg_cache + graph = self._dynamic_config._scheduler_graph + trees = self._frozen_config.trees + pruned_pkg_cache = {} + for pkg in pkg_cache: + if pkg in graph or \ + (pkg.installed and pkg in trees[pkg.root]['vartree'].dbapi): + pruned_pkg_cache[pkg] = pkg + + for root in trees: + trees[root]['vartree']._pkg_cache = pruned_pkg_cache + + self.break_refs(pruned_pkg_cache) + sched_config = \ + _scheduler_graph_config(trees, pruned_pkg_cache, graph) + + return sched_config def break_refs(self, nodes): """ -- cgit v1.2.3-1-g7c22