diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-04-16 22:29:20 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-04-16 22:29:20 +0000 |
commit | a9b69e9465e550da17f424843345f7e4d11a5232 (patch) | |
tree | a8d94b45e11bf331ecab6671748a61c6f04b4926 | |
parent | 35e5407120441f60f6e77e6544e12e3c56cbacc8 (diff) | |
download | portage-a9b69e9465e550da17f424843345f7e4d11a5232.tar.gz portage-a9b69e9465e550da17f424843345f7e4d11a5232.tar.bz2 portage-a9b69e9465e550da17f424843345f7e4d11a5232.zip |
Remove redundant version sorting in _expand_new_virtuals() since the
dbapi match results are already sorted.
svn path=/main/trunk/; revision=9920
-rw-r--r-- | pym/portage/__init__.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 13ded0fea..f9a9e5d11 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -5309,8 +5309,6 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", # According to GLEP 37, RDEPEND is the only dependency type that is valid # for new-style virtuals. Repoman should enforce this. dep_keys = ["RDEPEND", "DEPEND", "PDEPEND"] - def compare_pkgs(a, b): - return pkgcmp(b[1], a[1]) portdb = trees[myroot]["porttree"].dbapi if kwargs["use_binaries"]: portdb = trees[myroot]["bintree"].dbapi @@ -5336,19 +5334,14 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", match_atom = x if isblocker: match_atom = x[1:] - pkgs = {} - for cpv in portdb.match(match_atom): + pkgs = [] + matches = portdb.match(match_atom) + # Use descending order to prefer higher versions. + matches.reverse() + for cpv in matches: # only use new-style matches if cpv.startswith("virtual/"): - pkgs[cpv] = (cpv, catpkgsplit(cpv)[1:], portdb) - if kwargs["use_binaries"] and "vartree" in trees[myroot]: - vardb = trees[myroot]["vartree"].dbapi - for cpv in vardb.match(match_atom): - # only use new-style matches - if cpv.startswith("virtual/"): - if cpv in pkgs: - continue - pkgs[cpv] = (cpv, catpkgsplit(cpv)[1:], vardb) + pkgs.append((cpv, catpkgsplit(cpv)[1:], portdb)) if not (pkgs or mychoices): # This one couldn't be expanded as a new-style virtual. Old-style # virtuals have already been expanded by dep_virtual, so this one @@ -5360,8 +5353,6 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", if not pkgs and len(mychoices) == 1: newsplit.append(x.replace(mykey, mychoices[0])) continue - pkgs = pkgs.values() - pkgs.sort(compare_pkgs) # Prefer higher versions. if isblocker: a = [] else: |