From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D98F7198005 for ; Mon, 18 Mar 2013 10:09:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B40D5E0384; Mon, 18 Mar 2013 10:09:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 53848E0384 for ; Mon, 18 Mar 2013 10:09:39 +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 68EE233D74E for ; Mon, 18 Mar 2013 10:09:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id EED0AE4073 for ; Mon, 18 Mar 2013 10:09:36 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1363601362.8c53b2505670ec7ddec7a80eef939fcc400569c7.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: 8c53b2505670ec7ddec7a80eef939fcc400569c7 X-VCS-Branch: master Date: Mon, 18 Mar 2013 10:09:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: c83390d4-9ea5-44ae-a0fa-de2dd19b21b9 X-Archives-Hash: 409b8485ce77850b350571e930b1bb8b commit: 8c53b2505670ec7ddec7a80eef939fcc400569c7 Author: Zac Medico gentoo org> AuthorDate: Mon Mar 18 10:09:22 2013 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Mar 18 10:09:22 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8c53b250 portageq: optimize cat/name expansion for pquery --- bin/portageq | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/bin/portageq b/bin/portageq index c320dba..1b3658f 100755 --- a/bin/portageq +++ b/bin/portageq @@ -968,7 +968,6 @@ def pquery(parser, pquery_option_groups, opts, args): portage.db[portage.root], None) need_metadata = False - extended_syntax = False atoms = [] for arg in args: if "/" not in arg.split(":")[0]: @@ -989,15 +988,12 @@ def pquery(parser, pquery_option_groups, opts, args): if atom.slot is not None: need_metadata = True - if atom.extended_syntax: - extended_syntax = True atoms.append(atom) if "*/*" in atoms: del atoms[:] need_metadata = False - extended_syntax = False if not opts.no_filters: need_metadata = True @@ -1023,18 +1019,32 @@ def pquery(parser, pquery_option_groups, opts, args): else: repos.append(portdb.repositories.mainRepo()) - if extended_syntax or not atoms: + if not atoms: names = None categories = list(portdb.categories) else: + category_wildcard = False + name_wildcard = False categories = [] names = [] for atom in atoms: category, name = portage.catsplit(atom.cp) categories.append(category) names.append(name) - categories = list(set(categories)) - names = sorted(set(names)) + if "*" in category: + category_wildcard = True + if "*" in name: + name_wildcard = True + + if category_wildcard: + categories = list(portdb.categories) + else: + categories = list(set(categories)) + + if name_wildcard: + names = None + else: + names = sorted(set(names)) categories.sort()