summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-06-05 01:55:27 -0700
committerZac Medico <zmedico@gentoo.org>2011-06-05 01:55:27 -0700
commiteab68e779802691733838f04f99ef71bdaa09e1f (patch)
tree05420ced7fc8a0fe4703128ec9e5e09a131fa3c6
parentd51baaba0d5cad0fc7941bd593915b1fc7f42f94 (diff)
downloadportage-eab68e779802691733838f04f99ef71bdaa09e1f.tar.gz
portage-eab68e779802691733838f04f99ef71bdaa09e1f.tar.bz2
portage-eab68e779802691733838f04f99ef71bdaa09e1f.zip
portdbapi.xmatch: always pass mytree to cp_list
-rw-r--r--pym/portage/dbapi/porttree.py47
1 files changed, 26 insertions, 21 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index f971468a6..4c02cbe30 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -793,28 +793,29 @@ class portdbapi(dbapi):
except KeyError:
pass
- if not mydep:
+ 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 level == "match-all-cpv-only":
+ myval = None
+ mytree = None
+ if mydep.repo is not None:
+ mytree = self.treemap.get(mydep.repo)
+ if mytree is None:
+ myval = []
+
+ if myval is not None:
+ # Unknown repo, empty result.
+ pass
+ elif level == "match-all-cpv-only":
# match *all* packages, only against the cpv, in order
# to bypass unnecessary cache access for things like IUSE
# and SLOT.
- myval = None
- mytree = None
- if mydep.repo is not None:
- mytree = self.treemap.get(mydep.repo)
- if mytree is None:
- myval = []
if myval is None:
if mydep == mykey:
- # Share cache with match-all/cp_list
- # when the result is the same.
- level = "match-all"
myval = self.cp_list(mykey, mytree=mytree)
else:
myval = match_from_list(mydep,
@@ -824,14 +825,17 @@ class portdbapi(dbapi):
#a list of all visible packages, not called directly (just by xmatch())
#myval = self.visible(self.cp_list(mykey))
- myval = self.gvisible(self.visible(self.cp_list(mykey)))
+ myval = self.gvisible(self.visible(
+ self.cp_list(mykey, mytree=mytree)))
elif level == "minimum-all":
# Find the minimum matching version. This is optimized to
# minimize the number of metadata accesses (improves performance
# especially in cases where metadata needs to be generated).
- cpv_iter = iter(self.cp_list(mykey))
- if mydep != mykey:
- cpv_iter = self._iter_match(mydep, cpv_iter)
+ if mydep == mykey:
+ cpv_iter = iter(self.cp_list(mykey, mytree=mytree))
+ else:
+ cpv_iter = self._iter_match(mydep,
+ self.cp_list(mykey, mytree=mytree))
try:
myval = next(cpv_iter)
except StopIteration:
@@ -842,10 +846,10 @@ class portdbapi(dbapi):
# minimize the number of metadata accesses (improves performance
# especially in cases where metadata needs to be generated).
if mydep == mykey:
- mylist = self.cp_list(mykey)
+ mylist = self.cp_list(mykey, mytree=mytree)
else:
- mylist = match_from_list(mydep, self.cp_list(mykey,
- mytree=self.repositories.get_location_for_name(mydep.repo)))
+ mylist = match_from_list(mydep,
+ self.cp_list(mykey, mytree=mytree))
myval = ""
settings = self.settings
local_config = settings.local_config
@@ -904,13 +908,14 @@ class portdbapi(dbapi):
#dep match -- find all visible matches
#get all visible packages, then get the matching ones
myval = list(self._iter_match(mydep,
- self.xmatch("list-visible", mykey, mydep=mykey, mykey=mykey)))
+ self.xmatch("list-visible", mykey, mydep=Atom(mykey), mykey=mykey)))
elif level == "match-all":
#match *all* visible *and* masked packages
if mydep == mykey:
- myval = self.cp_list(mykey)
+ myval = self.cp_list(mykey, mytree=mytree)
else:
- myval = list(self._iter_match(mydep, self.cp_list(mykey)))
+ myval = list(self._iter_match(mydep,
+ self.cp_list(mykey, mytree=mytree)))
else:
raise AssertionError(
"Invalid level argument: '%s'" % level)