Package portage :: Package package :: Package ebuild :: Module config :: Class config
[hide private]

Class config

source code

object --+
         |
        config

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.

Nested Classes [hide private]
  _lazy_vars
  _lazy_use_expand
Lazily evaluate USE_EXPAND variables since they are only needed when an ebuild shell is spawned.
Instance Methods [hide private]
 
__init__(self, clone=None, mycpv=None, config_profile_path=None, config_incrementals=None, config_root=None, target_root=None, eprefix=None, local_config=True, env=None, _unmatched_removal=False, repositories=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_validate_commands(self) source code
 
_init_dirs(self)
Create a few directories that are critical to portage operation
source code
 
expandLicenseTokens(self, 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.
source code
 
validate(self)
Validate miscellaneous settings and display warnings if necessary.
source code
 
load_best_module(self, property_string) source code
 
lock(self) source code
 
unlock(self) source code
 
modifying(self) source code
 
backup_changes(self, key=None) source code
 
reset(self, keeping_pkg=0, use_cache=None)
Restore environment from self.backupenv, call self.regenerate()
source code
None
setcpv(self, mycpv, use_cache=None, mydb=None)
Load a particular CPV into the config, this lets us see the Default USE flags for a particular ebuild as well as the USE flags from package.use.
source code
 
_grab_pkg_env(self, penv, container, protected_keys=None) source code
 
_iuse_effective_match(self, flag) source code
 
_calc_iuse_effective(self)
Beginning with EAPI 5, IUSE_EFFECTIVE is defined by PMS.
source code
 
_get_implicit_iuse(self)
Prior to EAPI 5, these flags are considered to...
source code
 
_getUseMask(self, pkg, stable=None) source code
 
_getUseForce(self, pkg, stable=None) source code
String
_getMaskAtom(self, 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.
source code
String
_getRawMaskAtom(self, 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.
source code
String
_getProfileMaskAtom(self, cpv, metadata)
Take a package and return a matching profile atom, or None if no such atom exists.
source code
 
_isStable(self, pkg) source code
 
_getKeywords(self, cpv, metadata) source code
List
_getMissingKeywords(self, cpv, metadata)
Take a package and return a list of any KEYWORDS that the user may need to accept for the given package.
source code
List
_getRawMissingKeywords(self, cpv, metadata)
Take a package and return a list of any KEYWORDS that the user may need to accept for the given package.
source code
 
_getPKeywords(self, cpv, metadata) source code
List
_getMissingLicenses(self, cpv, metadata)
Take a LICENSE string and return a list of any licenses that the user may need to accept for the given package.
source code
List
_getMissingProperties(self, cpv, metadata)
Take a PROPERTIES string and return a list of any properties the user may need to accept for the given package.
source code
List
_getMissingRestrict(self, cpv, metadata)
Take a RESTRICT string and return a list of any tokens the user may need to accept for the given package.
source code
 
_accept_chost(self, cpv, metadata)
@return True if pkg CHOST is accepted, False otherwise.
source code
 
setinst(self, mycpv, mydbapi)
This updates the preferences for old-style virtuals, affecting the behavior of dep_expand() and dep_check() calls.
source code
 
reload(self)
Reload things like /etc/profile.env that can change during runtime.
source code
None
regenerate(self, 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.
source code
 
get_virts_p(self) source code
 
getvirtuals(self) source code
 
_populate_treeVirtuals_if_needed(self, vartree)
Reduce the provides into a list by CP.
source code
 
__delitem__(self, mykey) source code
 
__getitem__(self, key) source code
 
_getitem(self, mykey) source code
 
get(self, k, x=None) source code
 
pop(self, key, *args) source code
 
__contains__(self, mykey)
Called to implement membership test operators (in and not in).
source code
 
setdefault(self, k, x=None) source code
 
__iter__(self) source code
 
iterkeys(self) source code
 
iteritems(self) source code
 
__setitem__(self, mykey, myvalue)
set a value; will be thrown away at reset() time
source code
 
environ(self)
return our locally-maintained environment
source code
 
thirdpartymirrors(self) source code
 
archlist(self) source code
 
selinux_enabled(self) source code
 
keys(self) source code
 
items(self) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _constant_keys = frozenset([u'PORTAGE_BIN_PATH', u'PORTAGE_GID...
  _setcpv_aux_keys = (u'DEFINED_PHASES', u'DEPEND', u'EAPI', u'H...
  _module_aliases = {u'cache.metadata_overlay.database': u'porta...
  _case_insensitive_vars = (u'AUTOCLEAN', u'NOCOLOR')
  _default_globals = {u'ACCEPT_LICENSE': u'* -@EULA', u'ACCEPT_P...
  _env_blacklist = frozenset([u'A', u'AA', u'CATEGORY', u'DEPEND...
  _environ_filter = frozenset([u'ACCEPT_CHOSTS', u'ACCEPT_KEYWOR...
  _environ_whitelist = frozenset([u'A', u'AA', u'ACCEPT_LICENSE'...
  _environ_whitelist_re = re.compile(r'^(CCACHE_|DISTCC_).*')
  _global_only_vars = frozenset([u'CONFIG_PROTECT'])
Properties [hide private]
  mygcfg
  _keywords_manager
  _mask_manager
  _virtuals_manager
  pkeywordsdict
  pmaskdict
  punmaskdict
  virts_p
  virtuals

Inherited from object: __class__

Method Details [hide private]

__init__(self, clone=None, mycpv=None, config_profile_path=None, config_incrementals=None, config_root=None, target_root=None, eprefix=None, local_config=True, env=None, _unmatched_removal=False, repositories=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • clone (Instance of config class.) - If provided, init will use deepcopy to copy by value the instance.
  • mycpv (String) - CPV to load up (see setcpv), this is the same as calling init with mycpv=None and then calling instance.setcpv(mycpv).
  • config_profile_path (String) - Configurable path to the profile (usually PROFILE_PATH from portage.const)
  • config_incrementals (List) - List of incremental variables (defaults to portage.const.INCREMENTALS)
  • config_root (String) - path to read local config from (defaults to "/", see PORTAGE_CONFIGROOT)
  • target_root (String) - the target root, which typically corresponds to the value of the $ROOT env variable (default is /)
  • eprefix (String) - set the EPREFIX variable (default is portage.const.EPREFIX)
  • local_config (Boolean) - Enables loading of local config (/etc/portage); used most by repoman to ignore local config (keywording and unmasking)
  • env (dict) - The calling environment which is used to override settings. Defaults to os.environ if unspecified.
  • _unmatched_removal (Boolean) - Enabled by repoman when the --unmatched-removal option is given.
  • repositories (Instance of portage.repository.config.RepoConfigLoader class.) - Configuration of repositories. Defaults to portage.repository.config.load_repository_config().
Overrides: object.__init__

expandLicenseTokens(self, tokens)

source code 

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.

validate(self)

source code 

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

reset(self, keeping_pkg=0, use_cache=None)

source code 

Restore environment from self.backupenv, call self.regenerate()

Parameters:
  • keeping_pkg (Boolean) - Should we keep the setcpv() data or delete it.

setcpv(self, mycpv, use_cache=None, mydb=None)

source code 

Load a particular CPV into the config, this lets us see the Default USE flags for a particular ebuild as well as the USE flags from package.use.

Parameters:
  • mycpv (string) - A cpv to load
  • mydb (dbapi or derivative.) - a dbapi instance that supports aux_get with the IUSE key.
Returns: None

_get_implicit_iuse(self)

source code 

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

_getMaskAtom(self, cpv, metadata)

source code 

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. PROVIDE is not checked, so atoms will not be found for old-style virtuals.

Parameters:
  • cpv (String) - The package name
  • metadata (dict) - A dictionary of raw package metadata
Returns: String
A matching atom string or None if one is not found.

_getRawMaskAtom(self, cpv, metadata)

source code 

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. PROVIDE is not checked, so atoms will not be found for old-style virtuals.

Parameters:
  • cpv (String) - The package name
  • metadata (dict) - A dictionary of raw package metadata
Returns: String
A matching atom string or None if one is not found.

_getProfileMaskAtom(self, cpv, metadata)

source code 

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. PROVIDE is not checked, so atoms will not be found for old-style virtuals.

Parameters:
  • cpv (String) - The package name
  • metadata (dict) - A dictionary of raw package metadata
Returns: String
A matching profile atom string or None if one is not found.

_getMissingKeywords(self, cpv, metadata)

source code 

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 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
Returns: List
A list of KEYWORDS that have not been accepted.

_getRawMissingKeywords(self, cpv, metadata)

source code 

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
Returns: List
lists of KEYWORDS that have not been accepted and the keywords it looked for.

_getMissingLicenses(self, cpv, metadata)

source code 

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
Returns: List
A list of licenses that have not been accepted.

_getMissingProperties(self, cpv, metadata)

source code 

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
Returns: List
A list of properties that have not been accepted.

_getMissingRestrict(self, cpv, metadata)

source code 

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
Returns: List
A list of tokens that have not been accepted.

setinst(self, mycpv, mydbapi)

source code 

This updates the preferences for old-style virtuals, affecting the behavior of dep_expand() and dep_check() calls. It can change dbapi.match() behavior since that calls dep_expand(). However, dbapi instances have internal match caches that are not invalidated when preferences are updated here. This can potentially lead to some inconsistency (relevant to bug #1343).

regenerate(self, useonly=0, use_cache=None)

source code 

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)
Returns: None

Class Variable Details [hide private]

_constant_keys

Value:
frozenset([u'PORTAGE_BIN_PATH',
           u'PORTAGE_GID',
           u'PORTAGE_PYM_PATH',
           u'PORTAGE_PYTHONPATH'])

_setcpv_aux_keys

Value:
(u'DEFINED_PHASES',
 u'DEPEND',
 u'EAPI',
 u'HDEPEND',
 u'INHERITED',
 u'IUSE',
 u'REQUIRED_USE',
 u'KEYWORDS',
...

_module_aliases

Value:
{u'cache.metadata_overlay.database': u'portage.cache.flat_hash.databas\
e',
 u'portage.cache.metadata_overlay.database': u'portage.cache.flat_hash\
.database'}

_default_globals

Value:
{u'ACCEPT_LICENSE': u'* -@EULA',
 u'ACCEPT_PROPERTIES': u'*',
 u'PORTAGE_BZIP2_COMMAND': u'bzip2'}

_env_blacklist

Value:
frozenset([u'A',
           u'AA',
           u'CATEGORY',
           u'DEPEND',
           u'DESCRIPTION',
           u'EAPI',
           u'EBUILD_FORCE_TEST',
           u'EBUILD_PHASE',
...

_environ_filter

Value:
frozenset([u'ACCEPT_CHOSTS',
           u'ACCEPT_KEYWORDS',
           u'ACCEPT_PROPERTIES',
           u'ACCEPT_RESTRICT',
           u'AUTOCLEAN',
           u'CLEAN_DELAY',
           u'COLLISION_IGNORE',
           u'CONFIG_PROTECT',
...

_environ_whitelist

Value:
frozenset([u'A',
           u'AA',
           u'ACCEPT_LICENSE',
           u'BASH_ENV',
           u'BUILD_PREFIX',
           u'CATEGORY',
           u'COLORTERM',
           u'COLUMNS',
...

Property Details [hide private]

mygcfg

Get Method:
unreachable.mygcfg(self)

_keywords_manager

Get Method:
unreachable._keywords_manager(self)

_mask_manager

Get Method:
unreachable._mask_manager(self)

_virtuals_manager

Get Method:
unreachable._virtuals_manager(self)

pkeywordsdict

Get Method:
unreachable.pkeywordsdict(self)

pmaskdict

Get Method:
unreachable.pmaskdict(self)

punmaskdict

Get Method:
unreachable.punmaskdict(self)

virts_p

Get Method:
unreachable.virts_p(self)

virtuals

Get Method:
unreachable.virtuals(self)