Package _emerge :: Module depgraph :: Class depgraph
[hide private]

Class depgraph

source code

object --+
         |
        depgraph

Nested Classes [hide private]
  _dynamic_deps_proc_exit
  _AutounmaskLevel
  UnsatisfiedResumeDep
A dependency of a resume list is not installed.
  _internal_exception
  _unknown_internal_error
Used by the depgraph internally to terminate graph creation.
  _serialize_tasks_retry
This is raised by the _serialize_tasks() method when it needs to be called again for some reason.
  _backtrack_mask
This is raised by _show_unsatisfied_dep() when it's called with check_backtrack=True and a matching package has been masked by backtracking.
  _autounmask_breakage
This is raised by _show_unsatisfied_dep() when it's called with check_autounmask_breakage=True and a matching package has been been disqualified due to autounmask changes.
Instance Methods [hide private]
 
__init__(self, settings, trees, myopts, myparams, spinner, frozen_config=None, backtrack_parameters=BacktrackParameter(), allow_backtracking=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_load_vdb(self)
Load installed package metadata if appropriate.
source code
 
_dynamic_deps_preload(self, fake_vartree, fakedb) source code
 
_spinner_update(self) source code
 
_show_ignored_binaries(self)
Show binaries that have been ignored because their USE didn't match the user's config.
source code
 
_get_missed_updates(self) source code
 
_show_missed_update(self) source code
 
_show_missed_update_unsatisfied_dep(self, missed_updates) source code
 
_show_missed_update_slot_conflicts(self, missed_updates) source code
 
_show_slot_collision_notice(self)
Show an informational message advising the user to mask one of the the packages.
source code
 
_process_slot_conflicts(self)
If there are any slot conflicts and backtracking is enabled, _complete_graph should complete the graph before this method is called, so that all relevant reverse dependencies are available for use in backtracking decisions.
source code
 
_process_slot_conflict(self, root, slot_atom, slot_nodes)
Process slot conflict data to identify specific atoms which lead to conflict.
source code
 
_slot_confict_backtrack(self, root, slot_atom, all_parents, conflict_pkgs) source code
 
_slot_conflict_backtrack_abi(self, pkg, slot_nodes, conflict_atoms)
If one or more conflict atoms have a slot/sub-slot dep that can be resolved by rebuilding the parent package, then schedule the rebuild via backtracking, and return True.
source code
bool
_slot_change_probe(self, dep)
Returns: True if dep.child should be rebuilt due to a change in sub-slot (without revbump, as in bug #456208).
source code
 
_slot_change_backtrack(self, dep, new_child_slot) source code
 
_slot_operator_update_backtrack(self, dep, new_child_slot=None, new_dep=None) source code
 
_slot_operator_update_probe_slot_conflict(self, dep) source code
 
_slot_operator_update_probe(self, dep, new_child_slot=False, slot_conflict=False, autounmask_level=None)
slot/sub-slot := operators tend to prevent updates from getting pulled in, since installed packages pull in packages with the slot/sub-slot that they were built against.
source code
 
_slot_operator_unsatisfied_probe(self, dep) source code
 
_slot_operator_unsatisfied_backtrack(self, dep) source code
 
_downgrade_probe(self, pkg)
Detect cases where a downgrade of the given package is considered desirable due to the current version being masked or unavailable.
source code
 
_select_atoms_probe(self, root, pkg) source code
 
_iter_similar_available(self, graph_pkg, atom, autounmask_level=None)
Given a package that's in the graph, do a rough check to see if a similar package is available to install.
source code
 
_replace_installed_atom(self, inst_pkg)
Given an installed package, generate an atom suitable for slot_operator_replace_installed backtracking info.
source code
 
_slot_operator_trigger_reinstalls(self)
Search for packages with slot-operator deps on older slots, and schedule rebuilds if they can link to a newer slot that's in the graph.
source code
 
_reinstall_for_flags(self, pkg, forced_flags, orig_use, orig_iuse, cur_use, cur_iuse)
Return a set of flags that trigger reinstallation, or None if there are no such flags.
source code
 
_create_graph(self, allow_unsatisfied=False) source code
Iterable
_expand_set_args(self, input_args, add_to_digraph=False)
Iterate over a list of DependencyArg instances and yield all instances given in the input together with additional SetArg instances that are generated from nested sets.
source code
 
_add_dep(self, dep, allow_unsatisfied=False) source code
 
_check_slot_conflict(self, pkg, atom) source code
 
_add_pkg(self, pkg, dep)
Adds a package to the depgraph, queues dependencies, and handles slot conflicts.
source code
 
_check_masks(self, pkg) source code
 
_add_parent_atom(self, pkg, parent_atom) source code
 
_add_slot_operator_dep(self, dep) source code
 
_add_slot_conflict(self, pkg) source code
 
_add_pkg_deps(self, pkg, allow_unsatisfied=False) source code
 
_add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string, allow_unsatisfied) source code
 
_wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string, allow_unsatisfied) source code
 
_minimize_children(self, parent, priority, root_config, atoms)
Selects packages to satisfy the given atoms, and minimizes the number of selected packages.
source code
 
_queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct)
Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack.
source code
 
_queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct) source code
 
_pop_disjunction(self, allow_unsatisfied)
Pop one disjunctive dep from self._dynamic_config._dep_disjunctive_stack, and use it to populate self._dynamic_config._dep_stack.
source code
 
_priority(self, **kwargs) source code
list
_dep_expand(self, root_config, atom_without_category)
Returns: a list of atoms containing categories (possibly empty)
source code
 
_have_new_virt(self, root, atom_cp) source code
 
_iter_atoms_for_pkg(self, pkg) source code
 
select_files(self, args) source code
 
_select_files(self, myfiles)
Given a list of .tbz2s, .ebuilds sets, and deps, populate self._dynamic_config._initial_arg_list and call self._resolve to create the appropriate depgraph and return a favorite list.
source code
 
_gen_reinstall_sets(self) source code
 
_resolve(self, myfavorites)
Given self._dynamic_config._initial_arg_list, pull in the root nodes, call self._creategraph to process theier deps and return a favorite list.
source code
 
_set_args(self, args)
Create the "__non_set_args__" package set from atoms and packages given as arguments.
source code
 
_greedy_slots(self, root_config, atom, blocker_lookahead=False)
Return a list of slot atoms corresponding to installed slots that differ from the slot of the highest visible match.
source code
 
_select_atoms_from_graph(self, *pargs, **kwargs)
Prefer atoms matching packages that have already been added to the graph or those that are installed and have not been scheduled for replacement.
source code
 
_select_atoms_highest_available(self, root, depstring, myuse=None, parent=None, strict=True, trees=None, priority=None)
This will raise InvalidDependString if necessary.
source code
 
_expand_virt_from_graph(self, root, atom) source code
 
_virt_deps_visible(self, pkg, ignore_use=False)
Assumes pkg is a virtual package.
source code
 
_get_dep_chain(self, start_node, target_atom=None, unsatisfied_dependency=False)
Returns a list of (atom, node_type) pairs that represent a dep chain.
source code
 
_get_dep_chain_as_comment(self, pkg, unsatisfied_dependency=False) source code
 
_show_unsatisfied_dep(self, root, atom, myparent=None, arg=None, check_backtrack=False, check_autounmask_breakage=False, show_req_use=None)
When check_backtrack=True, no output is produced and the method either returns or raises _backtrack_mask if a matching package has been masked by backtracking.
source code
 
_iter_match_pkgs_any(self, root_config, atom, onlydeps=False) source code
 
_iter_match_pkgs(self, root_config, pkg_type, atom, onlydeps=False)
Iterate over Package instances of pkg_type matching the given atom.
source code
 
_select_pkg_highest_available(self, root, atom, onlydeps=False) source code
 
_want_installed_pkg(self, pkg)
Given an installed package returned from select_pkg, return True if the user has not explicitly requested for this package to be replaced (typically via an atom on the command line).
source code
 
_want_update_pkg(self, parent, pkg) source code
 
_equiv_ebuild_visible(self, pkg, autounmask_level=None) source code
 
_equiv_binary_installed(self, pkg) source code
 
_autounmask_levels(self)
Iterate over the different allowed things to unmask.
source code
 
_select_pkg_highest_available_imp(self, root, atom, onlydeps=False) source code
 
_pkg_visibility_check(self, pkg, autounmask_level=None, trust_graph=True) source code
 
_pkg_use_enabled(self, pkg, target_use=None)
If target_use is None, returns pkg.use.enabled + changes in _needed_use_config_changes.
source code
 
_wrapped_select_pkg_highest_available_imp(self, root, atom, onlydeps=False, autounmask_level=None) source code
 
_select_pkg_from_graph(self, root, atom, onlydeps=False)
Select packages that have already been added to the graph or those that are installed and have not been scheduled for replacement.
source code
 
_select_pkg_from_installed(self, root, atom, onlydeps=False)
Select packages that are installed.
source code
 
_complete_graph(self, required_sets=None)
Add any deep dependencies of required sets (args, system, world) that have not been pulled into the graph yet.
source code
 
_pkg(self, cpv, type_name, root_config, installed=False, onlydeps=False, myrepo=None)
Get a package instance from the cache, or create a new one if necessary.
source code
 
_validate_blockers(self)
Remove any blockers from the digraph that do not match any of the packages within the graph.
source code
 
_accept_blocker_conflicts(self) source code
 
_merge_order_bias(self, mygraph)
For optimal leaf node selection, promote deep system runtime deps and order nodes from highest to lowest overall reference count.
source code
 
altlist(self, reversed=<type 'exceptions.DeprecationWarning'>) source code
 
_implicit_libc_deps(self, mergelist, graph)
Create implicit dependencies on libc, in order to ensure that libc is installed as early as possible (see bug #303567).
source code
 
schedulerGraph(self)
The scheduler graph is identical to the normal one except that uninstall edges are reversed in specific cases that require conflicting packages to be temporarily installed simultaneously.
source code
 
break_refs(self)
Break any references in Package instances that lead back to the depgraph.
source code
 
_resolve_conflicts(self) source code
 
_serialize_tasks(self) source code
 
_show_circular_deps(self, mygraph) source code
 
_show_merge_list(self) source code
 
_show_unsatisfied_blockers(self, blockers) source code
 
display(self, mylist, favorites=[], verbosity=None) source code
 
_display_autounmask(self)
Display --autounmask message and optionally write it to config files (using CONFIG_PROTECT).
source code
 
display_problems(self)
Display problems with the dependency graph such as slot collisions.
source code
 
saveNomergeFavorites(self)
Find atoms in favorites that are not in the mergelist and add them to the world file if necessary.
source code
 
_loadResumeCommand(self, resume_data, skip_masked=True, skip_missing=True)
Add a resume command to the graph and validate it in the process.
source code
 
_load_favorites(self, favorites)
Use a list of favorites to resume state from a previous select_files() call.
source code
 
need_restart(self) source code
 
success_without_autounmask(self) source code
 
autounmask_breakage_detected(self) source code
 
get_backtrack_infos(self) source code

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

Class Variables [hide private]
  pkg_tree_map = {'binary': 'bintree', 'ebuild': 'porttree', 'in...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, settings, trees, myopts, myparams, spinner, frozen_config=None, backtrack_parameters=BacktrackParameter(), allow_backtracking=False)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

_load_vdb(self)

source code 

Load installed package metadata if appropriate. This used to be called from the constructor, but that wasn't very nice since this procedure is slow and it generates spinner output. So, now it's called on-demand by various methods when necessary.

_show_slot_collision_notice(self)

source code 

Show an informational message advising the user to mask one of the the packages. In some cases it may be possible to resolve this automatically, but support for backtracking (removal nodes that have already been selected) will be required in order to handle all possible cases.

_process_slot_conflict(self, root, slot_atom, slot_nodes)

source code 

Process slot conflict data to identify specific atoms which lead to conflict. These atoms only match a subset of the packages that have been pulled into a given slot.

_slot_conflict_backtrack_abi(self, pkg, slot_nodes, conflict_atoms)

source code 

If one or more conflict atoms have a slot/sub-slot dep that can be resolved by rebuilding the parent package, then schedule the rebuild via backtracking, and return True. Otherwise, return False.

_slot_change_probe(self, dep)

source code 
Returns: bool
True if dep.child should be rebuilt due to a change in sub-slot (without revbump, as in bug #456208).

_slot_operator_update_probe(self, dep, new_child_slot=False, slot_conflict=False, autounmask_level=None)

source code 

slot/sub-slot := operators tend to prevent updates from getting pulled in,
since installed packages pull in packages with the slot/sub-slot that they
were built against. Detect this case so that we can schedule rebuilds
and reinstalls when appropriate.
NOTE: This function only searches for updates that involve upgrades
        to higher versions, since the logic required to detect when a
        downgrade would be desirable is not implemented.

_iter_similar_available(self, graph_pkg, atom, autounmask_level=None)

source code 

Given a package that's in the graph, do a rough check to see if a similar package is available to install. The given graph_pkg itself may be yielded only if it's not installed.

_replace_installed_atom(self, inst_pkg)

source code 

Given an installed package, generate an atom suitable for slot_operator_replace_installed backtracking info. The replacement SLOT may differ from the installed SLOT, so first search by cpv.

_expand_set_args(self, input_args, add_to_digraph=False)

source code 

Iterate over a list of DependencyArg instances and yield all instances given in the input together with additional SetArg instances that are generated from nested sets.

Parameters:
  • input_args (Iterable) - An iterable of DependencyArg instances
  • add_to_digraph (Boolean) - If True then add SetArg instances to the digraph, in order to record parent -> child relationships from nested sets
Returns: Iterable
All args given in the input together with additional SetArg instances that are generated from nested sets

_minimize_children(self, parent, priority, root_config, atoms)

source code 

Selects packages to satisfy the given atoms, and minimizes the number of selected packages. This serves to identify and eliminate redundant package selections when multiple atoms happen to specify a version range.

_queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct)

source code 

Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack. Yields non-disjunctive deps. Raises InvalidDependString when necessary.

_dep_expand(self, root_config, atom_without_category)

source code 
Parameters:
  • root_config (RootConfig) - a root config instance
  • atom_without_category (String) - an atom without a category component
Returns: list
a list of atoms containing categories (possibly empty)

_set_args(self, args)

source code 

Create the "__non_set_args__" package set from atoms and packages given as arguments. This method can be called multiple times if necessary. The package selection cache is automatically invalidated, since arguments influence package selections.

_greedy_slots(self, root_config, atom, blocker_lookahead=False)

source code 

Return a list of slot atoms corresponding to installed slots that differ from the slot of the highest visible match. When blocker_lookahead is True, slot atoms that would trigger a blocker conflict are automatically discarded, potentially allowing automatic uninstallation of older slots when appropriate.

_select_atoms_highest_available(self, root, depstring, myuse=None, parent=None, strict=True, trees=None, priority=None)

source code 

This will raise InvalidDependString if necessary. If trees is None then self._dynamic_config._filtered_trees is used.

_virt_deps_visible(self, pkg, ignore_use=False)

source code 

Assumes pkg is a virtual package. Traverses virtual deps recursively and returns True if all deps are visible, False otherwise. This is useful for checking if it will be necessary to expand virtual slots, for cases like bug #382557.

_get_dep_chain(self, start_node, target_atom=None, unsatisfied_dependency=False)

source code 

Returns a list of (atom, node_type) pairs that represent a dep chain. If target_atom is None, the first package shown is pkg's parent. If target_atom is not None the first package shown is pkg. If unsatisfied_dependency is True, the first parent is select who's dependency is not satisfied by 'pkg'. This is need for USE changes. (Does not support target_atom.)

_iter_match_pkgs(self, root_config, pkg_type, atom, onlydeps=False)

source code 

Iterate over Package instances of pkg_type matching the given atom. This does not check visibility and it also does not match USE for unbuilt ebuilds since USE are lazily calculated after visibility checks (to avoid the expense when possible).

_autounmask_levels(self)

source code 

Iterate over the different allowed things to unmask.

0. USE
1. USE + license
2. USE + ~arch + license
3. USE + ~arch + license + missing keywords
4. USE + license + masks
5. USE + ~arch + license + masks
6. USE + ~arch + license + missing keywords + masks

Some thoughts:
        * Do least invasive changes first.
        * Try unmasking alone before unmasking + missing keywords
                to avoid -9999 versions if possible

_pkg_use_enabled(self, pkg, target_use=None)

source code 

If target_use is None, returns pkg.use.enabled + changes in _needed_use_config_changes. If target_use is given, the need changes are computed to make the package useable. Example: target_use = { "foo": True, "bar": False } The flags target_use must be in the pkg's IUSE.

_complete_graph(self, required_sets=None)

source code 

Add any deep dependencies of required sets (args, system, world) that have not been pulled into the graph yet. This ensures that the graph is consistent such that initially satisfied deep dependencies are not broken in the new graph. Initially unsatisfied dependencies are irrelevant since we only want to avoid breaking dependencies that are initially satisfied.

Since this method can consume enough time to disturb users, it is currently only enabled by the --complete-graph option.

Parameters:
  • required_sets (dict) - contains required sets (currently only used for depclean and prune removal operations)

_pkg(self, cpv, type_name, root_config, installed=False, onlydeps=False, myrepo=None)

source code 

Get a package instance from the cache, or create a new one if necessary. Raises PackageNotFound from aux_get if it failures for some reason (package does not exist or is corrupt).

_validate_blockers(self)

source code 

Remove any blockers from the digraph that do not match any of the packages within the graph. If necessary, create hard deps to ensure correct merge order such that mutually blocking packages are never installed simultaneously. Also add runtime blockers from all installed packages if any of them haven't been added already (bug 128809).

schedulerGraph(self)

source code 

The scheduler graph is identical to the normal one except that uninstall edges are reversed in specific cases that require conflicting packages to be temporarily installed simultaneously. This is intended for use by the Scheduler in it's parallelization logic. It ensures that temporary simultaneous installation of conflicting packages is avoided when appropriate (especially for !!atom blockers), but allowed in specific cases that require it.

Note that this method calls break_refs() which alters the state of internal Package instances such that this depgraph instance should not be used to perform any more calculations.

break_refs(self)

source code 

Break any references in Package instances that lead back to the depgraph. This is useful if you want to hold references to packages without also holding the depgraph on the heap. It should only be called after the depgraph and _frozen_config will not be used for any more calculations.

_display_autounmask(self)

source code 

Display --autounmask message and optionally write it to config files (using CONFIG_PROTECT). The message includes the comments and the changes.

display_problems(self)

source code 

Display problems with the dependency graph such as slot collisions. This is called internally by display() to show the problems _after_ the merge list where it is most likely to be seen, but if display() is not going to be called then this method should be called explicitly to ensure that the user is notified of problems with the graph.

_loadResumeCommand(self, resume_data, skip_masked=True, skip_missing=True)

source code 

Add a resume command to the graph and validate it in the process. This will raise a PackageNotFound exception if a package is not available.

_load_favorites(self, favorites)

source code 

Use a list of favorites to resume state from a previous select_files() call. This creates similar DependencyArg instances to those that would have been created by the original select_files() call. This allows Package instances to be matched with DependencyArg instances during graph creation.


Class Variable Details [hide private]

pkg_tree_map

Value:
{'binary': 'bintree', 'ebuild': 'porttree', 'installed': 'vartree'}