From: Zac Medico Date: Fri, 23 Sep 2011 20:00:57 +0000 (-0700) Subject: portdbapi.xmatch: fix minimum-all for multi-repo X-Git-Tag: v2.2.0_alpha60~31 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8be9e967be8e0c038245f55ec927da5b1caa5d54;p=portage.git portdbapi.xmatch: fix minimum-all for multi-repo --- diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 135412430..d42e41e65 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -895,15 +895,24 @@ class portdbapi(dbapi): # 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). + myval = "" if mydep == mykey: - cpv_iter = iter(self.cp_list(mykey, mytree=mytree)) + for myval in self.cp_list(mykey, mytree=mytree): + break + elif mydep.repo is not None or len(self.porttrees) == 1: + for myval in self._iter_match(mydep, + self.cp_list(mykey, mytree=mytree)): + break else: - cpv_iter = self._iter_match(mydep, - self.cp_list(mykey, mytree=mytree)) - try: - myval = next(cpv_iter) - except StopIteration: - myval = "" + # 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) + for myval in self._iter_match(mydep.with_repo(repo), + self.cp_list(mykey, mytree=tree)): + break + if myval: + break elif level in ("minimum-visible", "bestmatch-visible"): # Find the minimum matching visible version. This is optimized to