public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:2.1.9 commit in: pym/_emerge/
Date: Wed,  4 May 2011 20:03:32 +0000 (UTC)	[thread overview]
Message-ID: <5a26bb626213d5db94c1b9c2121f3d8b838c3d7d.zmedico@gentoo> (raw)

commit:     5a26bb626213d5db94c1b9c2121f3d8b838c3d7d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 29 15:04:13 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May  4 19:37:57 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5a26bb62

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.

---
 pym/_emerge/actions.py |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 1c68298..47db134 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -1422,13 +1422,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 = ""
@@ -1436,22 +1449,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"))
 



             reply	other threads:[~2011-05-04 20:06 UTC|newest]

Thread overview: 136+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 20:03 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-27  3:36 [gentoo-commits] proj/portage:2.1.9 commit in: pym/_emerge/ Zac Medico
2011-05-27  1:26 Zac Medico
2011-05-27  0:40 Zac Medico
2011-05-26 22:34 Zac Medico
2011-05-26 21:37 Zac Medico
2011-05-26 13:04 Zac Medico
2011-05-26 12:52 Zac Medico
2011-05-26 12:26 Zac Medico
2011-05-26 12:05 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-05 18:12 Zac Medico
2011-05-05 16:01 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-05-04 20:03 Zac Medico
2011-04-13  7:52 Zac Medico
2011-04-13  7:52 Zac Medico
2011-04-13  7:52 Zac Medico
2011-04-13  7:52 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-01 21:54 Zac Medico
2011-03-01 20:55 Zac Medico
2011-03-01 20:55 Zac Medico
2011-03-01 20:55 Zac Medico
2011-02-22 17:41 Zac Medico
2011-02-22  3:16 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-22  3:14 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-20  0:04 Zac Medico
2011-02-14 17:02 Zac Medico
2011-02-14 16:45 Zac Medico
2011-02-14 16:35 Zac Medico
2011-02-14 16:04 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  7:49 Zac Medico
2011-02-14  5:04 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-14  4:31 Zac Medico
2011-02-08 20:48 Zac Medico
2011-02-05  3:37 Zac Medico
2011-02-04 17:47 zmedico
2011-02-04 15:57 zmedico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a26bb626213d5db94c1b9c2121f3d8b838c3d7d.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox