diff options
author | Zac Medico <zmedico@gentoo.org> | 2013-03-18 05:01:24 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2013-03-18 05:01:24 -0700 |
commit | 1e44aa827280f7ba73de5d1c4d079bc07087c2c2 (patch) | |
tree | b91942da2939f7e098615a4f3f0ae6b6bf8bd9ac | |
parent | portageq: add pquery to global command list (diff) | |
download | portage-1e44aa827280f7ba73de5d1c4d079bc07087c2c2.tar.gz portage-1e44aa827280f7ba73de5d1c4d079bc07087c2c2.tar.bz2 portage-1e44aa827280f7ba73de5d1c4d079bc07087c2c2.zip |
portageq: fix visiblity filter with no atoms
-rwxr-xr-x | bin/portageq | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/bin/portageq b/bin/portageq index a691a56c7..f76a96729 100755 --- a/bin/portageq +++ b/bin/portageq @@ -903,6 +903,20 @@ def pquery(parser, pquery_option_groups, opts, args): root_config = RootConfig(portdb.settings, portage.db[portage.root], None) + def _pkg(cpv, repo_name): + try: + metadata = dict(zip( + Package.metadata_keys, + portdb.aux_get(cpv, + Package.metadata_keys, + myrepo=repo_name))) + except KeyError: + raise portage.exception.PackageNotFound(cpv) + return Package(built=False, cpv=cpv, + installed=False, metadata=metadata, + root_config=root_config, + type_name="ebuild") + need_metadata = False atoms = [] for arg in args: @@ -1020,17 +1034,9 @@ def pquery(parser, pquery_option_groups, opts, args): if need_metadata: if pkg is None: try: - metadata = dict(zip( - Package.metadata_keys, - portdb.aux_get(cpv, - Package.metadata_keys, - myrepo=repo.name))) - except KeyError: + pkg = _pkg(cpv, repo.name) + except portage.exception.PackageNotFound: continue - pkg = Package(built=False, cpv=cpv, - installed=False, metadata=metadata, - root_config=root_config, - type_name="ebuild") if not (opts.no_filters or pkg.visible): continue @@ -1038,8 +1044,17 @@ def pquery(parser, pquery_option_groups, opts, args): continue matches.append(cpv) break - else: + elif opts.no_filters: matches.extend(cpv_list) + else: + for cpv in cpv_list: + try: + pkg = _pkg(cpv, repo.name) + except portage.exception.PackageNotFound: + continue + else: + if pkg.visible: + matches.append(cpv) if not matches: continue |