portage.package.ebuild.config module

portage.package.ebuild.config._get_feature_flags(eapi_attrs)
class portage.package.ebuild.config._iuse_implicit_match_cache(settings)

Bases: object

portage.package.ebuild.config._lazy_iuse_regex(iuse_implicit)

The PORTAGE_IUSE value is lazily evaluated since re.escape() is slow and the value is only used when an ebuild phase needs to be executed (it’s used only to generate QA notices).

portage.package.ebuild.config.autouse(myvartree, use_cache=1, mysettings=None)
portage.package.ebuild.config.best_from_dict(key, top_dict, key_order, EmptyOnError=1, FullCopy=1, AllowEmpty=1)
portage.package.ebuild.config.check_config_instance(test)
class portage.package.ebuild.config.config(clone=None, mycpv=None, config_profile_path=None, config_incrementals=None, config_root=None, target_root=None, sysroot=None, eprefix=None, local_config=True, env=None, _unmatched_removal=False, repositories=None)

Bases: object

This class encompasses the main portage configuration. Data is pulled from ROOT/PORTDIR/profiles/, from ROOT/etc/make.profile incrementally through all parent profiles as well as from ROOT/PORTAGE_CONFIGROOT/* for user specified overrides.

Generally if you need data like USE flags, FEATURES, environment variables, virtuals …etc you look in here.

_accept_chost(cpv, metadata)

:return True if pkg CHOST is accepted, False otherwise.

_calc_iuse_effective()

Beginning with EAPI 5, IUSE_EFFECTIVE is defined by PMS.

_case_insensitive_vars = ('AUTOCLEAN', 'NOCOLOR')
_constant_keys = frozenset({'PORTAGE_BIN_PATH', 'PORTAGE_GID', 'PORTAGE_PYM_PATH', 'PORTAGE_PYTHONPATH'})
_default_globals = {'ACCEPT_PROPERTIES': '*', 'PORTAGE_BZIP2_COMMAND': 'bzip2'}
_deprecated_keys = {'PORTAGE_LOGDIR': 'PORT_LOGDIR', 'PORTAGE_LOGDIR_CLEAN': 'PORT_LOGDIR_CLEAN', 'SIGNED_OFF_BY': 'DCO_SIGNED_OFF_BY'}
_env_blacklist = frozenset({'A', 'AA', 'BASH_FUNC____in_portage_iuse%%', 'BDEPEND', 'BROOT', 'CATEGORY', 'DEPEND', 'DESCRIPTION', 'DOCS', 'EAPI', 'EBUILD_FORCE_TEST', 'EBUILD_PHASE', 'EBUILD_PHASE_FUNC', 'EBUILD_SKIP_MANIFEST', 'ED', 'EMERGE_FROM', 'EPREFIX', 'EROOT', 'GREP_OPTIONS', 'HOMEPAGE', 'IDEPEND', 'INHERITED', 'IUSE', 'IUSE_EFFECTIVE', 'KEYWORDS', 'LICENSE', 'MERGE_TYPE', 'PDEPEND', 'PF', 'PKGUSE', 'PORTAGE_BACKGROUND', 'PORTAGE_BACKGROUND_UNMERGE', 'PORTAGE_BUILDDIR_LOCKED', 'PORTAGE_BUILT_USE', 'PORTAGE_CONFIGROOT', 'PORTAGE_INTERNAL_CALLER', 'PORTAGE_IUSE', 'PORTAGE_NONFATAL', 'PORTAGE_PIPE_FD', 'PORTAGE_REPO_NAME', 'PORTAGE_USE', 'PROPERTIES', 'RDEPEND', 'REPOSITORY', 'REQUIRED_USE', 'RESTRICT', 'ROOT', 'SANDBOX_LOG', 'SLOT', 'SRC_URI', '_'})
_environ_filter = frozenset({'ACCEPT_CHOSTS', 'ACCEPT_KEYWORDS', 'ACCEPT_PROPERTIES', 'ACCEPT_RESTRICT', 'AUTOCLEAN', 'BDEPEND', 'BINPKG_COMPRESS', 'BINPKG_COMPRESS_FLAGS', 'CLEAN_DELAY', 'COLLISION_IGNORE', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK', 'DEPEND', 'EGENCACHE_DEFAULT_OPTS', 'EMERGE_DEFAULT_OPTS', 'EMERGE_LOG_DIR', 'EMERGE_WARNING_DELAY', 'FETCHCOMMAND', 'FETCHCOMMAND_FTP', 'FETCHCOMMAND_HTTP', 'FETCHCOMMAND_HTTPS', 'FETCHCOMMAND_RSYNC', 'FETCHCOMMAND_SFTP', 'GENTOO_MIRRORS', 'HISTFILE', 'IDEPEND', 'INFOPATH', 'MANPATH', 'NOCONFMEM', 'O', 'PDEPEND', 'PORTAGE_BACKGROUND', 'PORTAGE_BACKGROUND_UNMERGE', 'PORTAGE_BINHOST', 'PORTAGE_BINPKG_FORMAT', 'PORTAGE_BUILDDIR_LOCKED', 'PORTAGE_CHECKSUM_FILTER', 'PORTAGE_ELOG_CLASSES', 'PORTAGE_ELOG_MAILFROM', 'PORTAGE_ELOG_MAILSUBJECT', 'PORTAGE_ELOG_MAILURI', 'PORTAGE_ELOG_SYSTEM', 'PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS', 'PORTAGE_FETCH_RESUME_MIN_SIZE', 'PORTAGE_GPG_DIR', 'PORTAGE_GPG_KEY', 'PORTAGE_GPG_SIGNING_COMMAND', 'PORTAGE_IONICE_COMMAND', 'PORTAGE_LOGDIR', 'PORTAGE_LOGDIR_CLEAN', 'PORTAGE_LOG_FILTER_FILE_CMD', 'PORTAGE_PACKAGE_EMPTY_ABORT', 'PORTAGE_REPO_DUPLICATE_WARN', 'PORTAGE_RO_DISTDIRS', 'PORTAGE_RSYNC_EXTRA_OPTS', 'PORTAGE_RSYNC_OPTS', 'PORTAGE_RSYNC_RETRIES', 'PORTAGE_SSH_OPTS', 'PORTAGE_SYNC_STALE', 'PORTAGE_USE', 'POSIXLY_CORRECT', 'QUICKPKG_DEFAULT_OPTS', 'RDEPEND', 'REPOMAN_DEFAULT_OPTS', 'RESUMECOMMAND', 'RESUMECOMMAND_FTP', 'RESUMECOMMAND_HTTP', 'RESUMECOMMAND_HTTPS', 'RESUMECOMMAND_RSYNC', 'RESUMECOMMAND_SFTP', 'SIGNED_OFF_BY', 'SRC_URI', 'SYNC', 'UNINSTALL_IGNORE', 'USER', 'USE_EXPAND_HIDDEN', 'USE_ORDER', '__PORTAGE_HELPER'})
_environ_whitelist = frozenset({'A', 'AA', 'ACCEPT_LICENSE', 'BASH_ENV', 'BASH_FUNC____in_portage_iuse%%', 'BROOT', 'BUILD_PREFIX', 'CATEGORY', 'COLORTERM', 'COLUMNS', 'CVS_RSH', 'D', 'DISPLAY', 'DISTDIR', 'DOC_SYMLINKS_DIR', 'EAPI', 'EBUILD', 'EBUILD_FORCE_TEST', 'EBUILD_PHASE', 'EBUILD_PHASE_FUNC', 'ECHANGELOG_USER', 'ECLASSDIR', 'ECLASS_DEPTH', 'ED', 'EDITOR', 'EMERGE_FROM', 'ENV_UNSET', 'EPREFIX', 'EROOT', 'ESYSROOT', 'FEATURES', 'FILESDIR', 'GPG_AGENT_INFO', 'HOME', 'INSTALL_MASK', 'LANG', 'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_MESSAGES', 'LC_MONETARY', 'LC_NUMERIC', 'LC_PAPER', 'LC_TIME', 'LESS', 'LESSOPEN', 'LOGNAME', 'LS_COLORS', 'MERGE_TYPE', 'NOCOLOR', 'P', 'PAGER', 'PATH', 'PF', 'PKGDIR', 'PKGUSE', 'PKG_INSTALL_MASK', 'PKG_LOGDIR', 'PKG_TMPDIR', 'PM_EBUILD_HOOK_DIR', 'PN', 'PORTAGE_ACTUAL_DISTDIR', 'PORTAGE_ARCHLIST', 'PORTAGE_BASHRC', 'PORTAGE_BASHRC_FILES', 'PORTAGE_BINPKG_FILE', 'PORTAGE_BINPKG_TAR_OPTS', 'PORTAGE_BINPKG_TMPFILE', 'PORTAGE_BIN_PATH', 'PORTAGE_BUILDDIR', 'PORTAGE_BUILD_GROUP', 'PORTAGE_BUILD_USER', 'PORTAGE_BUNZIP2_COMMAND', 'PORTAGE_BZIP2_COMMAND', 'PORTAGE_COLORMAP', 'PORTAGE_COMPRESS', 'PORTAGE_COMPRESSION_COMMAND', 'PORTAGE_COMPRESS_EXCLUDE_SUFFIXES', 'PORTAGE_CONFIGROOT', 'PORTAGE_DEBUG', 'PORTAGE_DEPCACHEDIR', 'PORTAGE_DOHTML_UNWARNED_SKIPPED_EXTENSIONS', 'PORTAGE_DOHTML_UNWARNED_SKIPPED_FILES', 'PORTAGE_DOHTML_WARN_ON_SKIPPED_FILES', 'PORTAGE_EBUILD_EXIT_FILE', 'PORTAGE_ECLASS_LOCATIONS', 'PORTAGE_FEATURES', 'PORTAGE_GID', 'PORTAGE_GRPNAME', 'PORTAGE_INST_GID', 'PORTAGE_INST_UID', 'PORTAGE_INTERNAL_CALLER', 'PORTAGE_IPC_DAEMON', 'PORTAGE_IUSE', 'PORTAGE_LOG_FILE', 'PORTAGE_OVERRIDE_EPREFIX', 'PORTAGE_PIPE_FD', 'PORTAGE_PROPERTIES', 'PORTAGE_PYM_PATH', 'PORTAGE_PYTHON', 'PORTAGE_PYTHONPATH', 'PORTAGE_QUIET', 'PORTAGE_REPOSITORIES', 'PORTAGE_REPO_NAME', 'PORTAGE_RESTRICT', 'PORTAGE_SIGPIPE_STATUS', 'PORTAGE_SOCKS5_PROXY', 'PORTAGE_TMPDIR', 'PORTAGE_UPDATE_ENV', 'PORTAGE_USERNAME', 'PORTAGE_VERBOSE', 'PORTAGE_WORKDIR_MODE', 'PORTAGE_XATTR_EXCLUDE', 'PORTDIR', 'PORTDIR_OVERLAY', 'PR', 'PREROOTPATH', 'PV', 'PVR', 'PYTHONDONTWRITEBYTECODE', 'REPLACED_BY_VERSION', 'REPLACING_VERSIONS', 'ROOT', 'ROOTPATH', 'SANDBOX_LOG', 'SSH_AGENT_PID', 'SSH_AUTH_SOCK', 'STY', 'SYSROOT', 'T', 'TEMP', 'TERM', 'TERMCAP', 'TMP', 'TMPDIR', 'USER', 'USE_EXPAND', 'USE_ORDER', 'WINDOW', 'WORKDIR', 'XARGS', 'XAUTHORITY', '__PORTAGE_TEST_HARDLINK_LOCKS', 'ftp_proxy', 'http_proxy', 'no_proxy'})
_environ_whitelist_re = re.compile('^(CCACHE_|DISTCC_).*')
_getKeywords(cpv, metadata)
_getMaskAtom(cpv, metadata)

Take a package and return a matching package.mask atom, or None if no such atom exists or it has been cancelled by package.unmask.

Parameters
  • cpv (String) – The package name

  • metadata (dict) – A dictionary of raw package metadata

Return type

String

Returns

A matching atom string or None if one is not found.

_getMissingKeywords(cpv, metadata)

Take a package and return a list of any KEYWORDS that the user may need to accept for the given package. If the KEYWORDS are empty and the ** keyword has not been accepted, the returned list will contain ** alone (in order to distinguish from the case of “none missing”).

Parameters
  • cpv (String) – The package name (for package.keywords support)

  • metadata (dict) – A dictionary of raw package metadata

Return type

List

Returns

A list of KEYWORDS that have not been accepted.

_getMissingLicenses(cpv, metadata)

Take a LICENSE string and return a list of any licenses that the user may need to accept for the given package. The returned list will not contain any licenses that have already been accepted. This method can throw an InvalidDependString exception.

Parameters
  • cpv (String) – The package name (for package.license support)

  • metadata (dict) – A dictionary of raw package metadata

Return type

List

Returns

A list of licenses that have not been accepted.

_getMissingProperties(cpv, metadata)

Take a PROPERTIES string and return a list of any properties the user may need to accept for the given package. The returned list will not contain any properties that have already been accepted. This method can throw an InvalidDependString exception.

Parameters
  • cpv (String) – The package name (for package.properties support)

  • metadata (dict) – A dictionary of raw package metadata

Return type

List

Returns

A list of properties that have not been accepted.

_getMissingRestrict(cpv, metadata)

Take a RESTRICT string and return a list of any tokens the user may need to accept for the given package. The returned list will not contain any tokens that have already been accepted. This method can throw an InvalidDependString exception.

Parameters
  • cpv (String) – The package name (for package.accept_restrict support)

  • metadata (dict) – A dictionary of raw package metadata

Return type

List

Returns

A list of tokens that have not been accepted.

_getPKeywords(cpv, metadata)
_getProfileMaskAtom(cpv, metadata)

Take a package and return a matching profile atom, or None if no such atom exists. Note that a profile atom may or may not have a “*” prefix.

Parameters
  • cpv (String) – The package name

  • metadata (dict) – A dictionary of raw package metadata

Return type

String

Returns

A matching profile atom string or None if one is not found.

_getRawMaskAtom(cpv, metadata)

Take a package and return a matching package.mask atom, or None if no such atom exists or it has been cancelled by package.unmask.

Parameters
  • cpv (String) – The package name

  • metadata (dict) – A dictionary of raw package metadata

Return type

String

Returns

A matching atom string or None if one is not found.

_getRawMissingKeywords(cpv, metadata)

Take a package and return a list of any KEYWORDS that the user may need to accept for the given package. If the KEYWORDS are empty, the returned list will contain ** alone (in order to distinguish from the case of “none missing”). This DOES NOT apply any user config package.accept_keywords acceptance.

Parameters
  • cpv (String) – The package name (for package.keywords support)

  • metadata (dict) – A dictionary of raw package metadata

Return type

List

Returns

lists of KEYWORDS that have not been accepted

and the keywords it looked for.

_getUseForce(pkg, stable=None)
_getUseMask(pkg, stable=None)
_get_implicit_iuse()

Prior to EAPI 5, these flags are considered to be implicit members of IUSE:

  • Flags derived from ARCH

  • Flags derived from USE_EXPAND_HIDDEN variables

  • Masked flags, such as those from {,package}use.mask

  • Forced flags, such as those from {,package}use.force

  • build and bootstrap flags used by bootstrap.sh

_getitem(mykey)
_global_only_vars = frozenset({'CONFIG_PROTECT'})
_grab_pkg_env(penv, container, protected_keys=None)
_init_dirs()

Create a few directories that are critical to portage operation

_init_iuse()
_isStable(pkg)
_iuse_effective_match(flag)
property _keywords_manager
class _lazy_use_expand(settings, unfiltered_use, use, usemask, iuse_effective, use_expand_split, use_expand_dict)

Bases: object

Lazily evaluate USE_EXPAND variables since they are only needed when an ebuild shell is spawned. Variables values are made consistent with the previously calculated USE settings.

class _lazy_vars(built_use, settings)

Bases: object

_flatten(var, use, settings)
_init_values()
built_use
settings
values
property _mask_manager
_module_aliases = {'cache.metadata_overlay.database': 'portage.cache.flat_hash.mtime_md5_database', 'portage.cache.metadata_overlay.database': 'portage.cache.flat_hash.mtime_md5_database'}
_populate_treeVirtuals_if_needed(vartree)

Reduce the provides into a list by CP.

_setcpv_aux_keys = ('BDEPEND', 'DEFINED_PHASES', 'DEPEND', 'EAPI', 'IDEPEND', 'INHERITED', 'IUSE', 'REQUIRED_USE', 'KEYWORDS', 'LICENSE', 'PDEPEND', 'PROPERTIES', 'RDEPEND', 'SLOT', 'repository', 'RESTRICT', 'LICENSE')
_setcpv_recursion_gate()

Raise AssertionError for recursive setcpv calls.

_validate_commands()
property _virtuals_manager
archlist()
backup_changes(key=None)
environ()

return our locally-maintained environment

expandLicenseTokens(tokens)

Take a token from ACCEPT_LICENSE or package.license and expand it if it’s a group token (indicated by @) or just return it if it’s not a group. If a group is negated then negate all group elements.

get(k, x=None)
get_virts_p()
getvirtuals()
items()
iteritems()
iterkeys()
keys()
load_best_module(property_string)
lock()
modifying()
property mygcfg
property pkeywordsdict
property pmaskdict
pop(key, *args)
property punmaskdict
regenerate(useonly=0, use_cache=None)

Regenerate settings This involves regenerating valid USE flags, re-expanding USE_EXPAND flags re-stacking USE flags (-flag and -*), as well as any other INCREMENTAL variables. This also updates the env.d configdict; useful in case an ebuild changes the environment.

If FEATURES has already stacked, it is not stacked twice.

Parameters

useonly (Boolean) – Only regenerate USE flags (not any other incrementals)

Return type

None

reload()

Reload things like /etc/profile.env that can change during runtime.

reset(keeping_pkg=0, use_cache=None)

Restore environment from self.backupenv, call self.regenerate() :param keeping_pkg: Should we keep the setcpv() data or delete it. :type keeping_pkg: Boolean @rype: None

selinux_enabled()
setcpv(*args, **kwargs)
setdefault(k, x=None)
setinst(mycpv, mydbapi)

This used to update the preferences for old-style virtuals. It is no-op now.

property soname_provided
thirdpartymirrors()
unlock()
validate()

Validate miscellaneous settings and display warnings if necessary. (This code was previously in the global scope of portage.py)

property virts_p
property virtuals