commit:     31edfe62541d8b55c64584b056ce64ad759f6a8e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 15 21:38:30 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jul 15 21:38:30 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=31edfe62

portdbapi.xmatch: return separate items for each repo

Since xmatch match-all shares cache with the cp_list method, it needs
to return separate items when the same package version is found in
multiple repos.

Fixes: 27eeeb6e4fc8 ("portdbapi.cp_list: cache repo associations (bug 650814)")
Bug: https://bugs.gentoo.org/650814

 pym/portage/dbapi/porttree.py | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index f6076ee2b..2e271ea76 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -1108,20 +1108,10 @@ class portdbapi(dbapi):
                        else:
                                iterfunc = iter
 
-                       if mydep.repo is not None:
-                               repos = [mydep.repo]
-                       else:
-                               # We iterate over self.porttrees, since it's 
common to
-                               # tweak this attribute in order to adjust match 
behavior.
-                               repos = []
-                               for tree in reversed(self.porttrees):
-                                       
repos.append(self.repositories.get_name_for_location(tree))
-
                        for cpv in iterfunc(mylist):
-                               for repo in repos:
                                        try:
                                                metadata = dict(zip(aux_keys,
-                                                       self.aux_get(cpv, 
aux_keys, myrepo=repo)))
+                                                       self.aux_get(cpv, 
aux_keys, myrepo=cpv.repo)))
                                        except KeyError:
                                                # ebuild not in this repo, or 
masked by corruption
                                                continue
@@ -1145,11 +1135,8 @@ class portdbapi(dbapi):
                                                continue
 
                                        myval.append(pkg_str)
-                                       # only yield a given cpv once
-                                       break
-
-                               if myval and single_match:
-                                       break
+                                       if single_match:
+                                               break
 
                        if single_match:
                                if myval:

Reply via email to