emerge --info: show package names for providing packages
authorSebastian Luther <SebastianLuther@gmx.de>
Sun, 11 Jul 2010 07:26:33 +0000 (09:26 +0200)
committerZac Medico <zmedico@gentoo.org>
Sun, 11 Jul 2010 08:17:26 +0000 (01:17 -0700)
pym/_emerge/actions.py

index 2e4994a2245a085ac90a9b446c1fc978430d7968..35923929a37f8290ad3ede76d9d28b7b2806779e 100644 (file)
@@ -1272,14 +1272,23 @@ def action_info(settings, trees, myopts, myfiles):
                        for cpv in pkg_matches:
                                ver = portage.versions.cpv_getversion(cpv)
                                repo = vardb.aux_get(cpv, ["repository"])[0]
-                               if not repo:
-                                       repo = "<unknown repository>"
-                               if repo != main_repo:
-                                       versions.append(ver + "::" + repo)
+                               if repo == main_repo:
+                                       repo_suffix = ""
+                               elif not repo:
+                                       repo_suffix = "::<unknown repository>"
                                else:
-                                       versions.append(ver)
+                                       repo_suffix = "::" + repo
+                               
+                               matched_cp = portage.versions.cpv_getkey(cpv)
+                               if matched_cp == x:
+                                       provide_suffix = ""
+                               else:
+                                       provide_suffix = " (%s)" % matched_cp
+
+                               versions.append(ver + repo_suffix + provide_suffix)
 
-                       versions.sort(cmp=lambda a,b: portage.versions.vercmp(a.split("::")[0], b.split("::")[0]))
+                       versions.sort(cmp=lambda a,b: portage.versions.vercmp( \
+                               a.split()[0].split("::")[0], b.split()[0].split("::")[0]))
 
                        if versions:
                                versions = ", ".join(versions)