From 3d07f74a2fb2e0480e126335f6981218f60da824 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 23 Sep 2011 11:19:13 -0700 Subject: [PATCH] portdbapi.xmatch: fix match-all for multi-repo --- pym/portage/dbapi/porttree.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index eb7e36a96..e3fe9a911 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -853,6 +853,25 @@ class portdbapi(dbapi): myval = match_from_list(mydep, self.cp_list(mykey, mytree=mytree)) + elif level == "match-all": + # match *all* visible *and* masked packages + if mydep == mykey: + myval = self.cp_list(mykey, mytree=mytree) + elif mydep.repo is not None or len(self.porttrees) == 1: + myval = list(self._iter_match(mydep, + self.cp_list(mykey, mytree=mytree))) + else: + myval = set() + # We iterate over self.porttrees, since it's common to + # tweak this attribute in order to adjust match behavior. + for tree in self.porttrees: + repo = self.repositories.get_name_for_location(tree) + myval.update(self._iter_match(mydep.with_repo(repo), + self.cp_list(mykey, mytree=mytree))) + myval = list(myval) + if len(myval) > 1: + self._cpv_sort_ascending(myval) + elif level == "match-visible": # find all visible matches if mydep.repo is not None or len(self.porttrees) == 1: @@ -969,13 +988,6 @@ class portdbapi(dbapi): myval = list(self._iter_match(mydep, mylist)) - elif level == "match-all": - #match *all* visible *and* masked packages - if mydep == mykey: - myval = self.cp_list(mykey, mytree=mytree) - else: - myval = list(self._iter_match(mydep, - self.cp_list(mykey, mytree=mytree))) else: raise AssertionError( "Invalid level argument: '%s'" % level) -- 2.26.2