From: Zac Medico Date: Sun, 17 Mar 2013 22:36:54 +0000 (-0700) Subject: portageq: emulate subset of Pkgcore's pquery X-Git-Tag: v2.2.0_alpha167~26 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7aab4998882319e668bf48be2279dcbbec4022b9;p=portage.git portageq: emulate subset of Pkgcore's pquery Pkgcore pquery compatible options: Repository matching options: --repo=REPO repo to use (default is PORTDIR if omitted) --all-repos search all repos Package matching options: --herd=HERD exact match on a herd --maintainer-email=MAINTAINER_EMAIL comma-separated list of maintainer email regexes to search for Output formatting: -n, --no-version collapse multiple matching versions together --- diff --git a/bin/portageq b/bin/portageq index 48e765143..d48277239 100755 --- a/bin/portageq +++ b/bin/portageq @@ -20,6 +20,7 @@ try: except KeyboardInterrupt: sys.exit(128 + signal.SIGINT) +import optparse import os import types @@ -41,11 +42,13 @@ from portage import os from portage.eapi import eapi_has_repo_deps from portage.util import writemsg, writemsg_stdout portage.proxy.lazyimport.lazyimport(globals(), + 're', 'subprocess', '_emerge.Package:Package', '_emerge.RootConfig:RootConfig', 'portage.dbapi._expand_new_virt:expand_new_virt', 'portage._sets.base:InternalPackageSet', + 'portage.xml.metadata:MetaDataXML' ) def eval_atom_use(atom): @@ -874,11 +877,11 @@ list_preserved_libs.uses_eroot = True # DO NOT CHANGE CODE BEYOND THIS POINT - IT'S NOT NEEDED! # -non_commands = frozenset(['elog', 'eval_atom_use', 'exithandler', 'main', 'usage']) +non_commands = frozenset(['elog', 'eval_atom_use', 'exithandler', 'main', 'pquery', 'usage']) commands = sorted(k for k, v in globals().items() \ if k not in non_commands and isinstance(v, types.FunctionType) and v.__module__ == "__main__") -def usage(argv): +def usage(argv, parser=None, pquery_option_groups=None): print(">>> Portage information query tool") print(">>> %s" % portage.VERSION) print(">>> Usage: portageq [