diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-04-20 23:38:17 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-04-20 23:45:31 -0700 |
commit | d603f1440c814377fbc1965729fd9b6b008cf76d (patch) | |
tree | 83ba90cc2bb3a37768cc6263fd8db5d39b5b7e4a /pym/portage/dbapi/porttree.py | |
parent | 92a8357ca98d4a42e7747abd2cf4b390381fc6bc (diff) | |
download | portage-d603f1440c814377fbc1965729fd9b6b008cf76d.tar.gz portage-d603f1440c814377fbc1965729fd9b6b008cf76d.tar.bz2 portage-d603f1440c814377fbc1965729fd9b6b008cf76d.zip |
dbapi: account for unevaluated_atom in caches
This will fix bug 412391. This is analogous to the bug fixed in
commit 5438bb29c996d777b6343515995176912a7c137f.
Diffstat (limited to 'pym/portage/dbapi/porttree.py')
-rw-r--r-- | pym/portage/dbapi/porttree.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 382bcda43..f9d78dcdb 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -1,4 +1,4 @@ -# Copyright 1998-2011 Gentoo Foundation +# Copyright 1998-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = [ @@ -731,7 +731,7 @@ class portdbapi(dbapi): # profile (due to old-style virtuals). Do not propagate # old-style virtuals since cp_list() doesn't expand them. if not (not cachelist and mycp.startswith("virtual/")): - self.xcache["match-all"][mycp] = cachelist + self.xcache["match-all"][(mycp, mycp)] = cachelist return cachelist[:] mysplit = mycp.split("/") invalid_category = mysplit[0] not in self._categories @@ -786,7 +786,7 @@ class portdbapi(dbapi): # Do not propagate old-style virtuals since # cp_list() doesn't expand them. if not (not cachelist and mycp.startswith("virtual/")): - self.xcache["match-all"][mycp] = cachelist + self.xcache["match-all"][(mycp, mycp)] = cachelist return mylist def freeze(self): @@ -809,19 +809,21 @@ class portdbapi(dbapi): "has been renamed to match-visible", DeprecationWarning, stacklevel=2) - #if no updates are being made to the tree, we can consult our xcache... - if self.frozen: - try: - return self.xcache[level][origdep][:] - except KeyError: - pass - if mydep is None: #this stuff only runs on first call of xmatch() #create mydep, mykey from origdep mydep = dep_expand(origdep, mydb=self, settings=self.settings) mykey = mydep.cp + #if no updates are being made to the tree, we can consult our xcache... + cache_key = None + if self.frozen: + cache_key = (mydep, mydep.unevaluated_atom) + try: + return self.xcache[level][cache_key][:] + except KeyError: + pass + myval = None mytree = None if mydep.repo is not None: @@ -930,9 +932,7 @@ class portdbapi(dbapi): if self.frozen: xcache_this_level = self.xcache.get(level) if xcache_this_level is not None: - xcache_this_level[mydep] = myval - if origdep and origdep != mydep: - xcache_this_level[origdep] = myval + xcache_this_level[cache_key] = myval myval = myval[:] return myval |