summaryrefslogtreecommitdiffstats
path: root/pym/portage/dbapi/porttree.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-09-24 14:44:36 -0700
committerZac Medico <zmedico@gentoo.org>2011-09-24 14:44:36 -0700
commit145d69342301e3a6372a172cfd2eb8069a6a0b3e (patch)
treed6cb090dd2a58befe79a91af661d4f4d58c7a56b /pym/portage/dbapi/porttree.py
parentc0e897575e41ec4b8367e05d5d53f658ed0fcf8a (diff)
downloadportage-145d69342301e3a6372a172cfd2eb8069a6a0b3e.tar.gz
portage-145d69342301e3a6372a172cfd2eb8069a6a0b3e.tar.bz2
portage-145d69342301e3a6372a172cfd2eb8069a6a0b3e.zip
portdbapi.xmatch: combine match-all with others
This eliminates redundant code.
Diffstat (limited to 'pym/portage/dbapi/porttree.py')
-rw-r--r--pym/portage/dbapi/porttree.py25
1 files changed, 3 insertions, 22 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 94b25e8e7..62a1e8f55 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -868,26 +868,7 @@ 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:
- 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=tree)))
- myval = list(myval)
- if len(myval) > 1:
- self._cpv_sort_ascending(myval)
-
- elif level in ("bestmatch-visible", "match-visible",
+ elif level in ("bestmatch-visible", "match-all", "match-visible",
"minimum-all", "minimum-visible"):
# Find the minimum matching visible version. This is optimized to
# minimize the number of metadata accesses (improves performance
@@ -898,8 +879,8 @@ class portdbapi(dbapi):
mylist = match_from_list(mydep,
self.cp_list(mykey, mytree=mytree))
- visibility_filter = level != "minimum-all"
- single_match = level != "match-visible"
+ visibility_filter = level not in ("match-all", "minimum-all")
+ single_match = level not in ("match-all", "match-visible")
myval = []
aux_keys = list(self._aux_cache_keys)
if level == "bestmatch-visible":