portageq

From Gentoo Wiki
Jump to:navigation Jump to:search

Resources

portageq is a tool to quickly query Portage information. It comes pre-installed as part of Portage and is primarily used by Gentoo developers in order to determine Portage configuration information.

Usage

Invocation

user $portageq --help

Querying environment variables

Probably the only question users will have as they read through the help output above is the definition of eroot. eroot simply means the repository filesystem path (directory) and can be obtained by:

user $portageq envvar EROOT
/

Queryable Portage specific environmental variables are listed in /var/db/repos/gentoo/profiles/info_vars. The queryable user environment's environment variables can be shown using the env command.

Return the CONFIG_PROTECT variable value (should be a filesystem path):

user $portageq config_protect

Return the DISTDIR variable value (should be a filesystem path):

user $portageq distdir
/var/cache/distfiles

Return the PKGDIR variable value (should be a filesystem path):

user $portageq pkgdir
/var/cache/binpkgs

Query repository information

To see a detailed list of repositories as configured in repos.conf, without any formatting:

user $portageq repos_config /

To see a list of repositories sorted by priority (highest first):

user $portageq get_repos /

Query package metadata

To get a specific piece of metadata about an atom (i.e. package name including version):

user $portageq metadata / ebuild sys-devel/gcc-13.2.1_p20231216 HOMEPAGE

The general syntax for the metadata subcommand is:

metadata <eroot> <pkgtype> <category/package> [<key>]+

where:

  • <pkgtype> is one of ebuild, porttree, binary, bintree, installed or vartree;

and

  • <key> is one or more of BDEPEND, DEFINED_PHASES, DEPEND, DESCRIPTION, EAPI, HOMEPAGE, IDEPEND, INHERIT, INHERITED, IUSE, KEYWORDS, LICENSE, PDEPEND, PROPERTIES, RDEPEND, REQUIRED_USE, RESTRICT, SLOT and SRC_URI.

See also

  • Elogv — a curses-based tool that parses the contents of elogs created by Portage.
  • Egencache — a tool that (re)builds metadata information for the Portage package database.
  • Environment variables (AMD64 handbook)