summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/PackageVirtualDbapi.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-04-20 23:38:17 -0700
committerZac Medico <zmedico@gentoo.org>2012-04-20 23:45:31 -0700
commitd603f1440c814377fbc1965729fd9b6b008cf76d (patch)
tree83ba90cc2bb3a37768cc6263fd8db5d39b5b7e4a /pym/_emerge/PackageVirtualDbapi.py
parent92a8357ca98d4a42e7747abd2cf4b390381fc6bc (diff)
downloadportage-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/_emerge/PackageVirtualDbapi.py')
-rw-r--r--pym/_emerge/PackageVirtualDbapi.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/pym/_emerge/PackageVirtualDbapi.py b/pym/_emerge/PackageVirtualDbapi.py
index a692bb602..a34d21c83 100644
--- a/pym/_emerge/PackageVirtualDbapi.py
+++ b/pym/_emerge/PackageVirtualDbapi.py
@@ -1,8 +1,9 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import sys
from portage.dbapi import dbapi
+from portage.dbapi.dep_expand import dep_expand
class PackageVirtualDbapi(dbapi):
"""
@@ -76,18 +77,21 @@ class PackageVirtualDbapi(dbapi):
self._match_cache = {}
def match(self, origdep, use_cache=1):
- result = self._match_cache.get(origdep)
+ atom = dep_expand(origdep, mydb=self, settings=self.settings)
+ cache_key = (atom, atom.unevaluated_atom)
+ result = self._match_cache.get(cache_key)
if result is not None:
return result[:]
- result = dbapi.match(self, origdep, use_cache=use_cache)
- self._match_cache[origdep] = result
+ result = list(self._iter_match(atom, self.cp_list(atom.cp)))
+ self._match_cache[cache_key] = result
return result[:]
def cpv_exists(self, cpv, myrepo=None):
return cpv in self._cpv_map
def cp_list(self, mycp, use_cache=1):
- cachelist = self._match_cache.get(mycp)
+ cache_key = (mycp, mycp)
+ cachelist = self._match_cache.get(cache_key)
# cp_list() doesn't expand old-style virtuals
if cachelist and cachelist[0].startswith(mycp):
return cachelist[:]
@@ -98,7 +102,7 @@ class PackageVirtualDbapi(dbapi):
cpv_list = [pkg.cpv for pkg in cpv_list]
self._cpv_sort_ascending(cpv_list)
if not (not cpv_list and mycp.startswith("virtual/")):
- self._match_cache[mycp] = cpv_list
+ self._match_cache[cache_key] = cpv_list
return cpv_list[:]
def cp_all(self):