From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from <gentoo-commits+bounces-448749-garchives=archives.gentoo.org@lists.gentoo.org>) id 1SIoQ4-00043i-RA for garchives@archives.gentoo.org; Fri, 13 Apr 2012 21:52:46 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 02614E0B6C; Fri, 13 Apr 2012 21:52:33 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C484DE0B6C for <gentoo-commits@lists.gentoo.org>; Fri, 13 Apr 2012 21:52:33 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 117A31B4025 for <gentoo-commits@lists.gentoo.org>; Fri, 13 Apr 2012 21:52:33 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D1072E5402 for <gentoo-commits@lists.gentoo.org>; Fri, 13 Apr 2012 21:52:31 +0000 (UTC) From: "Zac Medico" <zmedico@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org> Message-ID: <1334353906.0bb454d0aecba0be1dd197038eefc4be6be2580e.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/portageq X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 0bb454d0aecba0be1dd197038eefc4be6be2580e X-VCS-Branch: master Date: Fri, 13 Apr 2012 21:52:31 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: f2c5707f-c18a-4ada-b858-b5717037f3aa X-Archives-Hash: c4ec49563989b0069dd085985627e0da commit: 0bb454d0aecba0be1dd197038eefc4be6be2580e Author: Zdenek Behan <rain <AT> matfyz <DOT> cz> AuthorDate: Fri Apr 13 21:51:46 2012 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Fri Apr 13 21:51:46 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D0bb454d0 portageq mass_best_visible: optional "type" arg --- bin/portageq | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/portageq b/bin/portageq index fcdb9d9..dc465d2 100755 --- a/bin/portageq +++ b/bin/portageq @@ -504,21 +504,35 @@ def best_visible(argv): writemsg_stdout("%s\n" % (pkg.cpv,), noiselevel=3D-1) return os.EX_OK =20 + # No package found, write out an empty line. + writemsg_stdout("\n", noiselevel=3D-1) + return 1 best_visible.uses_root =3D True =20 =20 def mass_best_visible(argv): - """<eroot> [<category/package>]+ + """<root> [<type>] [<category/package>]+ Returns category/package-version (without .ebuild). + The pkgtype argument defaults to "ebuild" if unspecified, + otherwise it must be one of ebuild, binary, or installed. """ + type_map =3D { + "ebuild":"porttree", + "binary":"bintree", + "installed":"vartree"} + if (len(argv) < 2): print("ERROR: insufficient parameters!") sys.exit(2) try: - for pack in argv[1:]: - mylist=3Dportage.db[argv[0]]["porttree"].dbapi.match(pack) - print(pack+":"+portage.best(mylist)) + root =3D argv.pop(0) + pkgtype =3D "ebuild" + if argv[0] in type_map: + pkgtype =3D argv.pop(0) + for pack in argv: + writemsg_stdout("%s:" % pack, noiselevel=3D-1) + best_visible([root, pkgtype, pack]) except KeyError: sys.exit(1) mass_best_visible.uses_root =3D True