diff options
Diffstat (limited to 'pym')
-rw-r--r-- | pym/_emerge/FakeVartree.py | 6 | ||||
-rw-r--r-- | pym/_emerge/Package.py | 26 | ||||
-rw-r--r-- | pym/_emerge/Scheduler.py | 11 | ||||
-rw-r--r-- | pym/_emerge/depgraph.py | 12 |
4 files changed, 39 insertions, 16 deletions
diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py index db31535a6..61dd54061 100644 --- a/pym/_emerge/FakeVartree.py +++ b/pym/_emerge/FakeVartree.py @@ -150,11 +150,13 @@ class FakeVartree(vartree): # Validate counters and timestamps. slot_counters = {} - root = self.root + root_config = self._pkg_root_config validation_keys = ["COUNTER", "_mtime_"] for cpv in current_cpv_set: - pkg_hash_key = ("installed", root, cpv, "nomerge") + pkg_hash_key = Package._gen_hash_key(cpv=cpv, + installed=True, root_config=root_config, + type_name="installed") pkg = pkg_vardb.get(pkg_hash_key) if pkg is not None: counter, mtime = real_vardb.aux_get(cpv, validation_keys) diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index a7d8e26f5..90425a718 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -73,10 +73,32 @@ class Package(Task): else: self.operation = "merge" - self._hash_key = \ - (self.type_name, self.root, self.cpv, self.operation) + self._hash_key = Package._gen_hash_key(cpv=self.cpv, + installed=self.installed, onlydeps=self.onlydeps, + operation=self.operation, + root_config=self.root_config, + type_name=self.type_name) self._hash_value = hash(self._hash_key) + @classmethod + def _gen_hash_key(cls, cpv=None, installed=None, onlydeps=None, + operation=None, repo_name=None, root_config=None, + type_name=None, **kwargs): + + if operation is None: + if installed or onlydeps: + operation = "nomerge" + else: + operation = "merge" + + root = None + if root_config is not None: + root = root_config.root + else: + raise TypeError("root_config argument is required") + + return (type_name, root, cpv, operation) + def _validate_deps(self): """ Validate deps. This does not trigger USE calculation since that diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 14b89a852..46aa11d9e 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -2002,15 +2002,12 @@ class Scheduler(PollScheduler): failures for some reason (package does not exist or is corrupt). """ - if operation is None: - if installed: - operation = "nomerge" - else: - operation = "merge" # Reuse existing instance when available. - pkg = self._pkg_cache.get( - (type_name, root_config.root, cpv, operation)) + pkg = self._pkg_cache.get(Package._gen_hash_key(cpv=cpv, + type_name=type_name, root_config=root_config, + installed=installed, operation=operation)) + if pkg is not None: return pkg diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index d0409a416..6c126e1d6 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -3744,18 +3744,20 @@ class depgraph(object): failures for some reason (package does not exist or is corrupt). """ - operation = "merge" - if installed or onlydeps: - operation = "nomerge" + # Ensure that we use the specially optimized RootConfig instance # that refers to FakeVartree instead of the real vartree. root_config = self._frozen_config.roots[root_config.root] pkg = self._frozen_config._pkg_cache.get( - (type_name, root_config.root, cpv, operation)) + Package._gen_hash_key(cpv=cpv, type_name=type_name, + root_config=root_config, + installed=installed, onlydeps=onlydeps)) if pkg is None and onlydeps and not installed: # Maybe it already got pulled in as a "merge" node. pkg = self._dynamic_config.mydbapi[root_config.root].get( - (type_name, root_config.root, cpv, 'merge')) + Package._gen_hash_key(cpv=cpv, type_name=type_name, + root_config=root_config, + installed=installed, onlydeps=False)) if pkg is None: tree_type = self.pkg_tree_map[type_name] |