Add a Scheduler._frozen_config attribute that will be useful for
authorZac Medico <zmedico@gentoo.org>
Sat, 4 Sep 2010 23:00:36 +0000 (16:00 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 4 Sep 2010 23:00:36 +0000 (16:00 -0700)
dependency calculations related to aggressive parallelization
(bug #279623). The FakeVartree instances are shared with the
existing BlockerDB instances.

pym/_emerge/BlockerDB.py
pym/_emerge/Scheduler.py

index f671a58a796a0c0b5d9f8a73258b23745ce24dd8..53a48bf81c3057ed8b2fcec2fee4e6d1355b8570 100644 (file)
@@ -9,7 +9,6 @@ from portage import digraph
 from portage._sets.base import InternalPackageSet
 
 from _emerge.BlockerCache import BlockerCache
-from _emerge.FakeVartree import FakeVartree
 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
 
 if sys.hexversion >= 0x3000000:
@@ -17,23 +16,22 @@ if sys.hexversion >= 0x3000000:
 
 class BlockerDB(object):
 
-       def __init__(self, root_config):
+       def __init__(self, fake_vartree):
+               root_config = fake_vartree._root_config
                self._root_config = root_config
                self._vartree = root_config.trees["vartree"]
                self._portdb = root_config.trees["porttree"].dbapi
 
                self._dep_check_trees = None
-               self._fake_vartree = None
+               self._fake_vartree = fake_vartree
+               self._dep_check_trees = {
+                       self._vartree.root : {
+                               "porttree"    :  fake_vartree,
+                               "vartree"     :  fake_vartree,
+               }}
 
        def _get_fake_vartree(self, acquire_lock=0):
                fake_vartree = self._fake_vartree
-               if fake_vartree is None:
-                       fake_vartree = FakeVartree(self._root_config)
-                       self._fake_vartree = fake_vartree
-                       self._dep_check_trees = { self._vartree.root : {
-                               "porttree"    :  fake_vartree,
-                               "vartree"     :  fake_vartree,
-                       }}
                fake_vartree.sync(acquire_lock=acquire_lock)
                return fake_vartree
 
index b78be89f9292426dc59ac719ed1233c256447dca..86d815c8cc0c38ba0d70df0fe4238d87d44fa04c 100644 (file)
@@ -38,7 +38,8 @@ from _emerge.clear_caches import clear_caches
 from _emerge.create_depgraph_params import create_depgraph_params
 from _emerge.create_world_atom import create_world_atom
 from _emerge.DepPriority import DepPriority
-from _emerge.depgraph import depgraph, resume_depgraph
+from _emerge.depgraph import depgraph, resume_depgraph, \
+       _frozen_depgraph_config
 from _emerge.EbuildFetcher import EbuildFetcher
 from _emerge.EbuildPhase import EbuildPhase
 from _emerge.emergelog import emergelog, _emerge_log_dir
@@ -196,17 +197,23 @@ class Scheduler(PollScheduler):
                self.edebug = 0
                if settings.get("PORTAGE_DEBUG", "") == "1":
                        self.edebug = 1
-               self.pkgsettings = {}
                self._config_pool = {}
 
                # TODO: Replace the BlockerDB with a depgraph of installed packages
                # that's updated incrementally with each upgrade/uninstall operation
                # This will be useful for making quick and safe decisions with respect
                # to aggressive parallelization discussed in bug #279623.
+               frozen_config = None
+               if frozen_config is None:
+                       frozen_config = _frozen_depgraph_config(settings, trees,
+                               myopts, None)
+               self._frozen_config = frozen_config
+               self.pkgsettings = frozen_config.pkgsettings
                self._blocker_db = {}
                for root in trees:
                        self._config_pool[root] = []
-                       self._blocker_db[root] = BlockerDB(trees[root]["root_config"])
+                       self._blocker_db[root] = BlockerDB(
+                               frozen_config.trees[root]["vartree"])
 
                fetch_iface = self._fetch_iface_class(log_file=self._fetch_log,
                        schedule=self._schedule_fetch)