diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-09-06 00:04:12 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-06 00:04:12 -0700 |
commit | 16cd42f25994f53359679c0fbc02474259815ffc (patch) | |
tree | fe02b5723196adc9742eeaac9f9928d5d53e3512 /pym/_emerge/depgraph.py | |
parent | af9cfb26ada1dbc46d3db7e07996c1ed03768904 (diff) | |
download | portage-16cd42f25994f53359679c0fbc02474259815ffc.tar.gz portage-16cd42f25994f53359679c0fbc02474259815ffc.tar.bz2 portage-16cd42f25994f53359679c0fbc02474259815ffc.zip |
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.
Diffstat (limited to 'pym/_emerge/depgraph.py')
-rw-r--r-- | pym/_emerge/depgraph.py | 24 |
1 files changed, 23 insertions, 1 deletions
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): """ |