Optimize xmatch match-all-cpv-only for repo deps.
authorZac Medico <zmedico@gentoo.org>
Wed, 6 Oct 2010 01:46:06 +0000 (18:46 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 6 Oct 2010 01:46:06 +0000 (18:46 -0700)
pym/portage/dbapi/porttree.py

index 2d515e07cf59f53e32aa6d67942b87c7287e88a2..4f700b1bdacac6d75ea48cd10eb92463495fd0dc 100644 (file)
@@ -787,13 +787,23 @@ class portdbapi(dbapi):
                        # match *all* packages, only against the cpv, in order
                        # to bypass unecessary cache access for things like IUSE
                        # and SLOT.
-                       if mydep == mykey:
-                               # Share cache with match-all/cp_list
-                               # when the result is the same.
-                               level = "match-all"
-                               myval = self.cp_list(mykey)
-                       else:
-                               myval = match_from_list(mydep, self.cp_list(mykey))
+                       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,
+                                               self.cp_list(mykey, mytree=mytree))
+
                elif level == "list-visible":
                        #a list of all visible packages, not called directly (just by xmatch())
                        #myval = self.visible(self.cp_list(mykey))