Package _emerge
[hide private]

Package _emerge

source code

Submodules [hide private]

Classes [hide private]
  stdout_spinner
  search
  RootConfig
This is used internally by depgraph to track information about a particular $ROOT.
  SlotObject
  AbstractDepPriority
  DepPriority
This class generates an integer priority level based of various attributes of the dependency relationship.
  BlockerDepPriority
  UnmergeDepPriority
  FakeVartree
This is implements an in-memory copy of a vartree instance that provides all the interfaces required for use by the depgraph.
  Task
  Blocker
  Package
  _PackageMetadataWrapper
Detect metadata updates and synchronize Package attributes.
  EbuildFetchPretend
  AsynchronousTask
Subclasses override _wait() and _poll() so that calls to public methods can be wrapped for implementing hooks such as exit listener notification.
  PipeReader
Reads output from one or more files and saves it in memory, for retrieval via the getvalue() method.
  CompositeTask
  TaskSequence
A collection of tasks that executes sequentially.
  SubProcess
  SpawnProcess
Constructor keyword args are passed into portage.process.spawn().
  MiscFunctionsProcess
Spawns misc-functions.sh with an existing ebuild environment.
  EbuildFetcher
  EbuildBuildDir
  EbuildBuild
  EbuildExecuter
  EbuildMetadataPhase
Asynchronous interface for the ebuild "depend" phase which is used to extract metadata from the ebuild.
  EbuildProcess
  EbuildPhase
  EbuildBinpkg
This assumes that src_install() has successfully completed.
  EbuildMerge
  PackageUninstall
  Binpkg
  BinpkgFetcher
  BinpkgVerifier
  BinpkgExtractorAsync
  MergeListItem
TODO: For parallel scheduling, everything here needs asynchronous execution support (start, poll, and wait methods).
  PackageMerge
TODO: Implement asynchronous merge so that the scheduler can run while a merge is executing.
  DependencyArg
  AtomArg
  PackageArg
  SetArg
  Dependency
  BlockerCache
This caches blockers of installed packages so that dep_check does not have to be done for every single installed package on every invocation of emerge.
  BlockerDB
  PackageVirtualDbapi
A dbapi-like interface class that represents the state of the installed package database as new packages are installed, replacing any packages that previously existed in the same slot.
  depgraph
  RepoDisplay
  PackageCounters
  PollConstants
Provides POLL* constants that are equivalent to those from the select module, for use by PollSelectAdapter.
  PollSelectAdapter
Use select to emulate a poll object, for systems that don't support poll().
  SequentialTaskQueue
  PollScheduler
  QueueScheduler
Add instances of SequentialTaskQueue and then call run().
  TaskScheduler
A simple way to handle scheduling of AsynchrousTask instances.
  JobStatusDisplay
  Scheduler
  MetadataRegen
  UninstallFailure
An instance of this class is raised by unmerge() when an uninstallation fails.
Functions [hide private]
 
exithandler(signum, frame) source code
 
userquery(prompt, responses=None, colours=None)
Displays a prompt and a set of responses, then waits for a response which is checked against the responses and the first to match is returned.
source code
 
emergelog(xterm_titles, mystr, short_msg=None) source code
 
countdown(secs=5, doing='Starting') source code
 
format_size(mysize) source code
 
getgccversion(chost)
rtype: str return: the current in-use gcc version
source code
 
getportageversion(portdir, target_root, profile, chost, vardb) source code
 
create_depgraph_params(myopts, myaction) source code
 
create_world_atom(pkg, args_set, root_config)
Create a new atom for the world file if one does not exist.
source code
 
filter_iuse_defaults(iuse) source code
 
grab_global_updates(portdir) source code
 
perform_global_updates(mycpv, mydb, mycommands) source code
Boolean
visible(pkgsettings, pkg)
Check if a package is visible.
source code
 
get_masking_status(pkg, pkgsettings, root_config) source code
 
get_mask_info(root_config, cpv, pkgsettings, db, pkg_type, built, installed, db_keys) source code
 
show_masked_packages(masked_packages) source code
 
show_invalid_depstring_notice(parent_node, depstring, error_msg) source code
bool
can_poll_device()
Test if it's possible to use poll() on a device such as a pty.
source code
 
create_poll_instance()
Create an instance of select.poll, or an instance of PollSelectAdapter there is no poll() implementation or it is broken somehow.
source code
 
unmerge(root_config, myopts, unmerge_action, unmerge_files, ldpath_mtimes, autoclean=0, clean_world=1, clean_delay=1, ordered=0, raise_on_error=0, scheduler=None, writemsg_level=<function writemsg_level at 0x8a18e64>) source code
 
chk_updated_info_files(root, infodirs, prev_mtimes, retval) source code
 
display_news_notification(root_config, myopts) source code
bool
_flush_elog_mod_echo()
Dump the mod_echo output now so that our other notifications are shown last.
source code
 
post_emerge(root_config, myopts, mtimedb, retval)
Misc.
source code
 
chk_updated_cfg_files(target_root, config_protect) source code
 
checkUpdatedNewsItems(portdb, vardb, NEWS_PATH, UNREAD_PATH, repo_id, update=False)
Examines news items in repodir + '/' + NEWS_PATH and attempts to find unread items Returns the number of unread (yet relevent) items.
source code
 
insert_category_into_atom(atom, category) source code
 
is_valid_package_atom(x) source code
 
show_blocker_docs_link() source code
 
show_mask_docs() source code
 
action_sync(settings, trees, mtimedb, myopts, myaction) source code
 
action_metadata(settings, portdb, myopts) source code
 
action_regen(settings, portdb, max_jobs, max_load) source code
 
action_config(settings, trees, myopts, myfiles) source code
 
action_info(settings, trees, myopts, myfiles) source code
 
action_search(root_config, myopts, myfiles, spinner) source code
 
action_depclean(settings, trees, ldpath_mtimes, myopts, action, myfiles, spinner) source code
tuple
resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner, skip_masked=False, skip_unsatisfied=False)
Construct a depgraph for the given resume list.
source code
 
action_build(settings, trees, mtimedb, myopts, myaction, myfiles, spinner) source code
 
multiple_actions(action1, action2) source code
 
insert_optional_args(args)
Parse optional arguments and insert a value if one has not been provided.
source code
 
parse_opts(tmpcmdline, silent=False) source code
 
validate_ebuild_environment(trees) source code
 
clear_caches(trees) source code
 
load_emerge_config(trees=None) source code
 
adjust_config(myopts, settings)
Make emerge specific adjustments to the config.
source code
 
apply_priorities(settings) source code
 
nice(settings) source code
 
ionice(settings) source code
 
display_missing_pkg_set(root_config, set_name) source code
 
emerge_main() source code
Variables [hide private]
  actions = ['clean', 'config', 'depclean', 'info', 'metadata', ...
  options = ['--ask', '--alphabetical', '--buildpkg', '--buildpk...
  shortmapping = {'1': '--oneshot', 'B': '--buildpkgonly', 'C': ...
  _all_metadata_keys = set(['CHOST', 'COUNTER', 'DEPEND', 'DESCR...
  _can_poll_device = None

Imports: sys, signal, array, deque, fcntl, formatter, logging, select, shlex, shutil, textwrap, urlparse, weakref, gc, os, stat, platform, osp, digraph, portdbapi, NEWS_LIB_PATH, CACHE_PATH, PRIVATE_PATH, USER_CONFIG_PATH, GLOBAL_CONFIG_PATH, commands, errno, re, socket, time, types, blue, bold, colorize, darkblue, darkgreen, darkred, green, havecolor, nc_len, nocolor, red, teal, turquoise, xtermTitle, xtermTitleReset, yellow, create_color_func, good, bad, white, portage, secpass, eerror, normpath, writemsg, writemsg_level, load_default_config, SETPREFIX, InternalPackageSet, chain, izip, DictMixin, cPickle, StringIO, slot_dict_class, _PackageMetadataWrapperBase, help


Function Details [hide private]

userquery(prompt, responses=None, colours=None)

source code 

Displays a prompt and a set of responses, then waits for a response which is checked against the responses and the first to match is returned. An empty response will match the first value in responses. The input buffer is *not* cleared prior to the prompt!

prompt: a String. responses: a List of Strings. colours: a List of Functions taking and returning a String, used to process the responses for display. Typically these will be functions like red() but could be e.g. lambda x: "DisplayString". If responses is omitted, defaults to ["Yes", "No"], [green, red]. If only colours is omitted, defaults to [bold, ...].

Returns a member of the List responses. (If called without optional arguments, returns "Yes" or "No".) KeyboardInterrupt is converted to SystemExit to avoid tracebacks being printed.

create_world_atom(pkg, args_set, root_config)

source code 

Create a new atom for the world file if one does not exist. If the argument atom is precise enough to identify a specific slot then a slot atom will be returned. Atoms that are in the system set may also be stored in world since system atoms can only match one slot while world atoms can be greedy with respect to slots. Unslotted system packages will not be stored in world.

visible(pkgsettings, pkg)

source code 

Check if a package is visible. This can raise an InvalidDependString exception if LICENSE is invalid. TODO: optionally generate a list of masking reasons

Returns: Boolean
True if the package is visible, False otherwise.

can_poll_device()

source code 

Test if it's possible to use poll() on a device such as a pty. This is known to fail on Darwin.

Returns: bool
True if poll() on a device succeeds, False otherwise.

_flush_elog_mod_echo()

source code 

Dump the mod_echo output now so that our other notifications are shown last.

Returns: bool
True if messages were shown, False otherwise.

post_emerge(root_config, myopts, mtimedb, retval)

source code 

Misc. things to run at the end of a merge session.

Update Info Files
Update Config Files
Update News Items
Commit mtimeDB
Display preserved libs warnings
Exit Emerge

@param trees: A dictionary mapping each ROOT to it's package databases
@type trees: dict
@param mtimedb: The mtimeDB to store data needed across merge invocations
@type mtimedb: MtimeDB class instance
@param retval: Emerge's return value
@type retval: Int
@rype: None
@returns:
1.  Calls sys.exit(retval)

checkUpdatedNewsItems(portdb, vardb, NEWS_PATH, UNREAD_PATH, repo_id, update=False)

source code 

Examines news items in repodir + '/' + NEWS_PATH and attempts to find unread items
Returns the number of unread (yet relevent) items.

@param portdb: a portage tree database
@type portdb: pordbapi
@param vardb: an installed package database
@type vardb: vardbapi
@param NEWS_PATH:
@type NEWS_PATH:
@param UNREAD_PATH:
@type UNREAD_PATH:
@param repo_id:
@type repo_id:
@rtype: Integer
@returns:
1.  The number of unread but relevant news items.

resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner, skip_masked=False, skip_unsatisfied=False)

source code 

Construct a depgraph for the given resume list. This will raise PackageNotFound or depgraph.UnsatisfiedResumeDep when necessary.

Returns: tuple
(success, depgraph, dropped_tasks)

insert_optional_args(args)

source code 

Parse optional arguments and insert a value if one has not been provided. This is done before feeding the args to the optparse parser since that parser does not support this feature natively.


Variables Details [hide private]

actions

Value:
['clean',
 'config',
 'depclean',
 'info',
 'metadata',
 'prune',
 'regen',
 'search',
...

options

Value:
['--ask',
 '--alphabetical',
 '--buildpkg',
 '--buildpkgonly',
 '--changelog',
 '--columns',
 '--complete-graph',
 '--debug',
...

shortmapping

Value:
{'1': '--oneshot',
 'B': '--buildpkgonly',
 'C': '--unmerge',
 'D': '--deep',
 'F': '--fetch-all-uri',
 'G': '--getbinpkgonly',
 'K': '--usepkgonly',
 'N': '--newuse',
...

_all_metadata_keys

Value:
set(['CHOST',
     'COUNTER',
     'DEPEND',
     'DESCRIPTION',
     'EAPI',
     'HOMEPAGE',
     'INHERITED',
     'IUSE',
...