From: Zac Medico Date: Sat, 4 Sep 2010 23:00:36 +0000 (-0700) Subject: Add a Scheduler._frozen_config attribute that will be useful for X-Git-Tag: v2.2_rc76~55 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3f901a5c683fb90ef69c33c8e8f1a8f65853b43a;p=portage.git Add a Scheduler._frozen_config attribute that will be useful for dependency calculations related to aggressive parallelization (bug #279623). The FakeVartree instances are shared with the existing BlockerDB instances. --- diff --git a/pym/_emerge/BlockerDB.py b/pym/_emerge/BlockerDB.py index f671a58a7..53a48bf81 100644 --- a/pym/_emerge/BlockerDB.py +++ b/pym/_emerge/BlockerDB.py @@ -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 diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index b78be89f9..86d815c8c 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -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)