From 3a58eab382f5b31378030ea547ce0811e4b7d6a0 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Tue, 6 Jul 2010 23:10:48 +0200 Subject: [PATCH] emerge --info: Print repo names for packages not from $PORTDIR --- pym/_emerge/actions.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index af4380ed1..a4b9f76ba 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1260,20 +1260,30 @@ def action_info(settings, trees, myopts, myfiles): myvars = portage.util.unique_array(myvars) myvars.sort() + portdb = trees["/"]["porttree"].dbapi + vardb = trees["/"]["vartree"].dbapi + main_repo = portdb.getRepositoryName(portdb.porttree_root) + for x in myvars: if portage.isvalidatom(x): - pkg_matches = trees["/"]["vartree"].dbapi.match(x) - pkg_matches = [portage.catpkgsplit(cpv)[1:] for cpv in pkg_matches] - pkg_matches.sort(key=cmp_sort_key(portage.pkgcmp)) - pkgs = [] - for pn, ver, rev in pkg_matches: - if rev != "r0": - pkgs.append(ver + "-" + rev) + pkg_matches = vardb.match(x) + + versions = [] + for cpv in pkg_matches: + ver = portage.versions.cpv_getversion(cpv) + repo = vardb.aux_get(cpv, ["repository"])[0] + if not repo: + repo = "" + if repo != main_repo: + versions.append(ver + "::" + repo) else: - pkgs.append(ver) - if pkgs: - pkgs = ", ".join(pkgs) - print("%-20s %s" % (x+":", pkgs)) + versions.append(ver) + + versions.sort(cmp=lambda a,b: portage.versions.vercmp(a.split("::")[0], b.split("::")[0])) + + if versions: + versions = ", ".join(versions) + print("%-20s %s" % (x+":", versions)) else: print("%-20s %s" % (x+":", "[NOT VALID]")) -- 2.26.2