aboutsummaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-04-29 08:04:13 -0700
committerZac Medico <zmedico@gentoo.org>2011-04-29 08:04:13 -0700
commitb67367d3e7d11a0d7d62e48d433c76eae64e5f99 (patch)
tree2a145c348d4d557cd53c700d5b5cd81ba257383d /pym
parent_postinst_bsdflags: apply to $ROOT, not $D (diff)
downloadportage-b67367d3e7d11a0d7d62e48d433c76eae64e5f99.tar.gz
portage-b67367d3e7d11a0d7d62e48d433c76eae64e5f99.tar.bz2
portage-b67367d3e7d11a0d7d62e48d433c76eae64e5f99.zip
action_info: eliminate duplicate info_pkgs match
Currently, sys-kernel/linux-headers is matched by both a plain sys-kernel/linux-headers atom and by the virtual/os-headers new-style virtual. For backward compatibility, we're going to have duplicates like this for at least a few months (see bug #364673, comment #5). Therefore, automatically eliminate duplicates in the display. Entries that include virtual provider info are preferred over those that do not.
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/actions.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 59db58dbf..6379b368a 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -1427,13 +1427,26 @@ def action_info(settings, trees, myopts, myfiles):
portdb = trees["/"]["porttree"].dbapi
main_repo = portdb.getRepositoryName(portdb.porttree_root)
+ cp_map = {}
+ cp_max_len = 0
for orig_atom, x in myvars:
pkg_matches = vardb.match(x)
versions = []
for cpv in pkg_matches:
+ matched_cp = portage.versions.cpv_getkey(cpv)
ver = portage.versions.cpv_getversion(cpv)
+ ver_map = cp_map.setdefault(matched_cp, {})
+ prev_match = ver_map.get(ver)
+ if prev_match is not None:
+ if prev_match.provide_suffix:
+ # prefer duplicate matches that include
+ # additional virtual provider info
+ continue
+
+ if len(matched_cp) > cp_max_len:
+ cp_max_len = len(matched_cp)
repo = vardb.aux_get(cpv, ["repository"])[0]
if repo == main_repo:
repo_suffix = ""
@@ -1441,22 +1454,20 @@ def action_info(settings, trees, myopts, myfiles):
repo_suffix = "::<unknown repository>"
else:
repo_suffix = "::" + repo
-
- matched_cp = portage.versions.cpv_getkey(cpv)
+
if matched_cp == orig_atom.cp:
provide_suffix = ""
else:
provide_suffix = " (%s)" % (orig_atom,)
- versions.append(
- _info_pkgs_ver(ver, repo_suffix, provide_suffix))
-
- versions.sort()
+ ver_map[ver] = _info_pkgs_ver(ver, repo_suffix, provide_suffix)
- if versions:
- versions = ", ".join(ver.toString() for ver in versions)
- writemsg_stdout("%-20s %s\n" % (x+":", versions),
- noiselevel=-1)
+ for cp in sorted(cp_map):
+ versions = sorted(cp_map[cp].values())
+ versions = ", ".join(ver.toString() for ver in versions)
+ writemsg_stdout("%s %s\n" % \
+ ((cp + ":").ljust(cp_max_len + 1), versions),
+ noiselevel=-1)
libtool_vers = ",".join(trees["/"]["vartree"].dbapi.match("sys-devel/libtool"))