Package portage :: Package package :: Package ebuild :: Module doebuild
[hide private]

Module doebuild

source code

Functions [hide private]
 
_doebuild_spawn(phase, settings, actionmap=None, **kwargs)
All proper ebuild phases which execute ebuild.sh are spawned via this function.
source code
 
_spawn_phase(phase, settings, actionmap=None, returnpid=False, logfile=None, **kwargs) source code
 
_doebuild_path(settings, eapi=None)
Generate the PATH variable.
source code
 
doebuild_environment(myebuild, mydo, myroot=None, settings=None, debug=False, use_cache=None, db=None)
Create and store environment variable in the config instance that's passed in as the "settings" parameter.
source code
 
doebuild(myebuild, mydo, _unused=<type 'exceptions.DeprecationWarning'>, settings=None, debug=0, listonly=0, fetchonly=0, cleanup=0, dbkey=<type 'exceptions.DeprecationWarning'>, use_cache=1, fetchall=0, tree=None, mydbapi=None, vartree=None, prev_mtimes=None, fd_pipes=None, returnpid=False)
Wrapper function that invokes specific ebuild phases through the spawning of ebuild.sh
source code
 
_check_temp_dir(settings) source code
 
_prepare_env_file(settings)
Extract environment.bz2 if it exists, but only if the destination environment file doesn't already exist.
source code
 
_prepare_fake_distdir(settings, alist) source code
 
_spawn_actionmap(settings) source code
 
_validate_deps(mysettings, myroot, mydo, mydbapi) source code
 
spawn(mystring, mysettings, debug=False, free=False, droppriv=False, sesandbox=False, fakeroot=False, networked=True, ipc=True, **keywords)
Spawn a subprocess with extra portage-specific options.
source code
 
spawnebuild(mydo, actionmap, mysettings, debug, alwaysdep=0, logfile=None, fd_pipes=None, returnpid=False) source code
 
_post_phase_userpriv_perms(mysettings) source code
 
_check_build_log(mysettings, out=None)
Search the content of $PORTAGE_LOG_FILE if it exists and generate the following QA Notices when appropriate:
source code
 
_post_src_install_write_metadata(settings)
It's possible that the ebuild has changed the CHOST variable, so revert it to the initial setting.
source code
 
_preinst_bsdflags(mysettings) source code
 
_postinst_bsdflags(mysettings) source code
 
_post_src_install_uid_fix(mysettings, out)
Files in $D with user and group bits that match the "portage" user or group are automatically mapped to PORTAGE_INST_UID and PORTAGE_INST_GID if necessary.
source code
 
_reapply_bsdflags_to_image(mysettings)
Reapply flags saved and removed by _preinst_bsdflags.
source code
 
_post_src_install_soname_symlinks(mysettings, out)
Check that libraries in $D have corresponding soname symlinks.
source code
 
_merge_desktopfile_error(errors) source code
 
_merge_unicode_error(errors) source code
 
_prepare_self_update(settings)
Call this when portage is updating itself, in order to create temporary copies of PORTAGE_BIN_PATH and PORTAGE_PYM_PATH, since the new versions may be incompatible.
source code
 
_handle_self_update(settings, vardb) source code
Variables [hide private]
  _unsandboxed_phases = frozenset([u'clean', u'cleanrm', u'confi...
  _ipc_phases = frozenset([u'postinst', u'postrm', u'preinst', u...
  _networked_phases = frozenset([u'postinst', u'postrm', u'prein...
  _phase_func_map = {u'compile': u'src_compile', u'config': u'pk...
  _vdb_use_conditional_keys = (u'DEPEND', u'HDEPEND', u'PDEPEND'...
  _doebuild_manifest_cache = None
hash(x)
  _doebuild_broken_ebuilds = set([])
  _doebuild_broken_manifests = set([])
  _doebuild_commands_without_builddir = (u'clean', u'cleanrm', u...
  _post_phase_cmds = {u'install': [u'install_qa_check', u'instal...
  __package__ = 'portage.package.ebuild'

Imports: grp, gzip, errno, io, chain, logging, _os, platform, pwd, re, signal, stat, sys, tempfile, wrap, time, warnings, zlib, portage, auxdbkeys, bsd_chflags, eapi_is_supported, merge, os, selinux, shutil, unmerge, _encodings, _os_merge, _shell_quote, _unicode_decode, _unicode_encode, EBUILD_SH_ENV_FILE, EBUILD_SH_ENV_DIR, EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY, PORTAGE_PYM_PACKAGES, portage_gid, portage_uid, secpass, uid, userpriv_groups, _parse_uri_map, Atom, check_required_use, human_readable_required_use, paren_enclose, use_reduce, eapi_exports_KV, eapi_exports_merge_type, eapi_exports_replace_vars, eapi_exports_REPOSITORY, eapi_has_required_use, eapi_has_src_prepare_and_src_configure, eapi_has_pkg_pretend, _get_eapi_attrs, elog_process, _preload_elog_modules, eerror, eqawarn, DigestException, FileNotFound, IncorrectParameter, InvalidDependString, PermissionDenied, UnsupportedAPIException, _, colormap, prepare_build_dirs, apply_recursive_permissions, apply_secpass_permissions, noiselimit, normalize_path, writemsg, writemsg_stdout, write_atomic, rewrite_lafile, _pkgsplit, BinpkgEnvExtractor, EbuildBuildDir, EbuildPhase, EbuildSpawnProcess, Package, RootConfig, EventLoop, ExtractKernelVersion, QueryCommand, SchedulerInterface, check_config_instance, digestcheck, digestgen, evaluate_slot_operator_equal_deps, fetch, global_event_loop, spawn_nofetch, validate_desktop_entry


Function Details [hide private]

_doebuild_spawn(phase, settings, actionmap=None, **kwargs)

source code 

All proper ebuild phases which execute ebuild.sh are spawned via this function. No exceptions.

doebuild_environment(myebuild, mydo, myroot=None, settings=None, debug=False, use_cache=None, db=None)

source code 

Create and store environment variable in the config instance that's passed in as the "settings" parameter. This will raise UnsupportedAPIException if the given ebuild has an unsupported EAPI. All EAPI dependent code comes last, so that essential variables like PORTAGE_BUILDDIR are still initialized even in cases when UnsupportedAPIException needs to be raised, which can be useful when uninstalling a package that has corrupt EAPI metadata. The myroot and use_cache parameters are unused.

doebuild(myebuild, mydo, _unused=<type 'exceptions.DeprecationWarning'>, settings=None, debug=0, listonly=0, fetchonly=0, cleanup=0, dbkey=<type 'exceptions.DeprecationWarning'>, use_cache=1, fetchall=0, tree=None, mydbapi=None, vartree=None, prev_mtimes=None, fd_pipes=None, returnpid=False)

source code 

Wrapper function that invokes specific ebuild phases through the spawning
of ebuild.sh

@param myebuild: name of the ebuild to invoke the phase on (CPV)
@type myebuild: String
@param mydo: Phase to run
@type mydo: String
@param _unused: Deprecated (use settings["ROOT"] instead)
@type _unused: String
@param settings: Portage Configuration
@type settings: instance of portage.config
@param debug: Turns on various debug information (eg, debug for spawn)
@type debug: Boolean
@param listonly: Used to wrap fetch(); passed such that fetch only lists files required.
@type listonly: Boolean
@param fetchonly: Used to wrap fetch(); passed such that files are only fetched (no other actions)
@type fetchonly: Boolean
@param cleanup: Passed to prepare_build_dirs (TODO: what does it do?)
@type cleanup: Boolean
@param dbkey: A file path where metadata generated by the 'depend' phase
        will be written.
@type dbkey: String
@param use_cache: Enables the cache
@type use_cache: Boolean
@param fetchall: Used to wrap fetch(), fetches all URIs (even ones invalid due to USE conditionals)
@type fetchall: Boolean
@param tree: Which tree to use ('vartree','porttree','bintree', etc..), defaults to 'porttree'
@type tree: String
@param mydbapi: a dbapi instance to pass to various functions; this should be a portdbapi instance.
@type mydbapi: portdbapi instance
@param vartree: A instance of vartree; used for aux_get calls, defaults to db[myroot]['vartree']
@type vartree: vartree instance
@param prev_mtimes: A dict of { filename:mtime } keys used by merge() to do config_protection
@type prev_mtimes: dictionary
@param fd_pipes: A dict of mapping for pipes, { '0': stdin, '1': stdout }
        for example.
@type fd_pipes: Dictionary
@param returnpid: Return a list of process IDs for a successful spawn, or
        an integer value if spawn is unsuccessful. NOTE: This requires the
        caller clean up all returned PIDs.
@type returnpid: Boolean
@rtype: Boolean
@return:
1. 0 for success
2. 1 for error

Most errors have an accompanying error message.

listonly and fetchonly are only really necessary for operations involving 'fetch'
prev_mtimes are only necessary for merge operations.
Other variables may not be strictly required, many have defaults that are set inside of doebuild.

_prepare_env_file(settings)

source code 

Extract environment.bz2 if it exists, but only if the destination environment file doesn't already exist. There are lots of possible states when doebuild() calls this function, and we want to avoid clobbering an existing environment file.

spawn(mystring, mysettings, debug=False, free=False, droppriv=False, sesandbox=False, fakeroot=False, networked=True, ipc=True, **keywords)

source code 

Spawn a subprocess with extra portage-specific options.
Optiosn include:

Sandbox: Sandbox means the spawned process will be limited in its ability t
read and write files (normally this means it is restricted to ${D}/)
SElinux Sandbox: Enables sandboxing on SElinux
Reduced Privileges: Drops privilages such that the process runs as portage:portage
instead of as root.

Notes: os.system cannot be used because it messes with signal handling.  Instead we
use the portage.process spawn* family of functions.

This function waits for the process to terminate.

@param mystring: Command to run
@type mystring: String
@param mysettings: Either a Dict of Key,Value pairs or an instance of portage.config
@type mysettings: Dictionary or config instance
@param debug: Ignored
@type debug: Boolean
@param free: Enable sandboxing for this process
@type free: Boolean
@param droppriv: Drop to portage:portage when running this command
@type droppriv: Boolean
@param sesandbox: Enable SELinux Sandboxing (toggles a context switch)
@type sesandbox: Boolean
@param fakeroot: Run this command with faked root privileges
@type fakeroot: Boolean
@param networked: Run this command with networking access enabled
@type networked: Boolean
@param ipc: Run this command with host IPC access enabled
@type ipc: Boolean
@param keywords: Extra options encoded as a dict, to be passed to spawn
@type keywords: Dictionary
@rtype: Integer
@return:
1. The return code of the spawned process.

_check_build_log(mysettings, out=None)

source code 

Search the content of $PORTAGE_LOG_FILE if it exists
and generate the following QA Notices when appropriate:

  * Automake "maintainer mode"
  * command not found
  * Unrecognized configure options

_post_src_install_write_metadata(settings)

source code 

It's possible that the ebuild has changed the CHOST variable, so revert it to the initial setting. Also, revert IUSE in case it's corrupted due to local environment settings like in bug #386829.

_post_src_install_uid_fix(mysettings, out)

source code 

Files in $D with user and group bits that match the "portage" user or group are automatically mapped to PORTAGE_INST_UID and PORTAGE_INST_GID if necessary. The chown system call may clear S_ISUID and S_ISGID bits, so those bits are restored if necessary.

_post_src_install_soname_symlinks(mysettings, out)

source code 

Check that libraries in $D have corresponding soname symlinks. If symlinks are missing then create them and trigger a QA Notice. This requires $PORTAGE_BUILDDIR/build-info/NEEDED.ELF.2 for operation.

_prepare_self_update(settings)

source code 

Call this when portage is updating itself, in order to create temporary copies of PORTAGE_BIN_PATH and PORTAGE_PYM_PATH, since the new versions may be incompatible. An atexit hook will automatically clean up the temporary copies.


Variables Details [hide private]

_unsandboxed_phases

Value:
frozenset([u'clean',
           u'cleanrm',
           u'config',
           u'help',
           u'info',
           u'postinst',
           u'postrm',
           u'preinst',
...

_ipc_phases

Value:
frozenset([u'postinst',
           u'postrm',
           u'preinst',
           u'prerm',
           u'pretend',
           u'setup'])

_networked_phases

Value:
frozenset([u'postinst',
           u'postrm',
           u'preinst',
           u'prerm',
           u'pretend',
           u'setup',
           u'unpack'])

_phase_func_map

Value:
{u'compile': u'src_compile',
 u'config': u'pkg_config',
 u'configure': u'src_configure',
 u'info': u'pkg_info',
 u'install': u'src_install',
 u'nofetch': u'pkg_nofetch',
 u'postinst': u'pkg_postinst',
 u'postrm': u'pkg_postrm',
...

_vdb_use_conditional_keys

Value:
(u'DEPEND',
 u'HDEPEND',
 u'PDEPEND',
 u'RDEPEND',
 u'LICENSE',
 u'PROPERTIES',
 u'PROVIDE',
 u'RESTRICT')

_doebuild_commands_without_builddir

Value:
(u'clean',
 u'cleanrm',
 u'depend',
 u'digest',
 u'fetch',
 u'fetchall',
 u'help',
 u'manifest')

_post_phase_cmds

Value:
{u'install': [u'install_qa_check',
              u'install_symlink_html_docs',
              u'install_hooks'],
 u'preinst': [u'preinst_sfperms',
              u'preinst_selinux_labels',
              u'preinst_suid_scan']}