Package _emerge :: Package resolver :: Module slot_collision :: Class slot_conflict_handler
[hide private]

Class slot_conflict_handler

source code

object --+
         |
        slot_conflict_handler

This class keeps track of all slot conflicts and provides
an interface to get possible solutions.

How it works:
If two packages have been pulled into a slot, one needs to
go away. This class focuses on cases where this can be achieved
with a change in USE settings.

1) Find out if what causes a given slot conflict. There are
three possibilities:

        a) One parent needs foo-1:0 and another one needs foo-2:0,
        nothing we can do about this. This is called a 'version
        based conflict'.

        b) All parents of one of the conflict packages could use
        another conflict package. This is called an 'unspecific
        conflict'. This should be caught by the backtracking logic.
        Ask the user to enable -uN (if not already enabled). If -uN is
        enabled, this case is treated in the same way as c).

        c) Neither a 'version based conflict' nor an 'unspecific
        conflict'. Ignoring use deps would result result in an
        'unspecific conflict'. This is called a 'specific conflict'.
        This is the only conflict we try to find suggestions for.

2) Computing suggestions.

Def.: "configuration": A list of packages, containing exactly one
                package from each slot conflict.

We try to find USE changes such that all parents of conflict packages
can work with a package in the configuration we're looking at. This
is done for all possible configurations, except if the 'all-ebuild'
configuration has a suggestion. In this case we immediately abort the
search.
For the current configuration, all use flags that are part of violated
use deps are computed. This is done for every slot conflict on its own.

Def.: "solution (candidate)": An assignment of "enabled" / "disabled"
                values for the use flags that are part of violated use deps.

Now all involved use flags for the current configuration are known. For
now they have an undetermined value. Fix their value in the
following cases:
        * The use dep in the parent atom is unconditional.
        * The parent package is 'installed'.
        * The conflict package is 'installed'.

USE of 'installed' packages can't be changed. This always requires an
non-installed package.

During this procedure, contradictions may occur. In this case the
configuration has no solution.

Now generate all possible solution candidates with fixed values. Check
if they don't introduce new conflicts.

We have found a valid assignment for all involved use flags. Compute
the needed USE changes and prepare the message for the user.

Instance Methods [hide private]
 
__init__(self, depgraph)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
get_conflict(self) source code
 
_is_subset(self, change1, change2)
Checks if a set of changes 'change1' is a subset of the changes 'change2'.
source code
 
_add_change(self, new_change)
Make sure to keep only minimal changes.
source code
 
_get_change(self, solution) source code
 
_prepare_conflict_msg_and_check_for_specificity(self)
Print all slot conflicts in a human readable way.
source code
 
get_explanation(self) source code
 
_check_configuration(self, config, all_conflict_atoms_by_slotatom, conflict_nodes)
Given a configuartion, required use changes are computed and checked to make sure that no new conflict is introduced.
source code
 
_force_flag_for_package(self, required_changes, pkg, flag, state)
Adds an USE change to required_changes.
source code
 
_check_solution(self, config, all_involved_flags, all_conflict_atoms_by_slotatom)
Given a configuartion and all involved flags, all possible settings for the involved flags are checked if they solve the slot conflict.
source code

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

Class Variables [hide private]
  _check_configuration_max = 1024
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, depgraph)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

_add_change(self, new_change)

source code 

Make sure to keep only minimal changes. If "+foo", does the job, discard "+foo -bar".

_check_configuration(self, config, all_conflict_atoms_by_slotatom, conflict_nodes)

source code 

Given a configuartion, required use changes are computed and checked to make sure that no new conflict is introduced. Returns a solution or None.

_force_flag_for_package(self, required_changes, pkg, flag, state)

source code 

Adds an USE change to required_changes. Sets the target state to "contradiction" if a flag is forced to conflicting values.