Lines 3-13
Link Here
|
3 |
|
3 |
|
4 |
from __future__ import print_function |
4 |
from __future__ import print_function |
5 |
|
5 |
|
6 |
from itertools import chain |
6 |
from itertools import chain, product |
|
|
7 |
import logging |
7 |
|
8 |
|
8 |
from portage.dep import use_reduce, extract_affecting_use, check_required_use, get_required_use_flags |
9 |
from portage.dep import use_reduce, extract_affecting_use, check_required_use, get_required_use_flags |
9 |
from portage.exception import InvalidDependString |
10 |
from portage.exception import InvalidDependString |
10 |
from portage.output import colorize |
11 |
from portage.output import colorize |
|
|
12 |
from portage.util import writemsg_level |
11 |
from _emerge.DepPrioritySatisfiedRange import DepPrioritySatisfiedRange |
13 |
from _emerge.DepPrioritySatisfiedRange import DepPrioritySatisfiedRange |
12 |
|
14 |
|
13 |
class circular_dependency_handler(object): |
15 |
class circular_dependency_handler(object): |
Lines 17-22
class circular_dependency_handler(object):
Link Here
|
17 |
self.graph = graph |
19 |
self.graph = graph |
18 |
self.all_parent_atoms = depgraph._dynamic_config._parent_atoms |
20 |
self.all_parent_atoms = depgraph._dynamic_config._parent_atoms |
19 |
|
21 |
|
|
|
22 |
if "--debug" in depgraph._frozen_config.myopts: |
23 |
# Show this debug output before doing the calculations |
24 |
# that follow, so at least we have this debug info |
25 |
# if we happen to hit a bug later. |
26 |
writemsg_level("\n\ncircular dependency graph:\n\n", |
27 |
level=logging.DEBUG, noiselevel=-1) |
28 |
self.debug_print() |
29 |
|
20 |
self.cycles, self.shortest_cycle = self._find_cycles() |
30 |
self.cycles, self.shortest_cycle = self._find_cycles() |
21 |
#Guess if it is a large cluster of cycles. This usually requires |
31 |
#Guess if it is a large cluster of cycles. This usually requires |
22 |
#a global USE change. |
32 |
#a global USE change. |
Lines 147-173
class circular_dependency_handler(object):
Link Here
|
147 |
#We iterate over all possible settings of these use flags and gather |
157 |
#We iterate over all possible settings of these use flags and gather |
148 |
#a set of possible changes |
158 |
#a set of possible changes |
149 |
#TODO: Use the information encoded in REQUIRED_USE |
159 |
#TODO: Use the information encoded in REQUIRED_USE |
150 |
use_state = [] |
|
|
151 |
for flag in affecting_use: |
152 |
use_state.append("disabled") |
153 |
|
154 |
def _next_use_state(state, id=None): |
155 |
if id is None: |
156 |
id = len(state)-1 |
157 |
|
158 |
if id == 0 and state[0] == "enabled": |
159 |
return False |
160 |
|
161 |
if state[id] == "disabled": |
162 |
state[id] = "enabled" |
163 |
for i in range(id+1,len(state)): |
164 |
state[i] = "disabled" |
165 |
return True |
166 |
else: |
167 |
return _next_use_state(state, id-1) |
168 |
|
169 |
solutions = set() |
160 |
solutions = set() |
170 |
while(True): |
161 |
for use_state in product(("disabled", "enabled"), |
|
|
162 |
repeat=len(affecting_use)): |
171 |
current_use = set(self.depgraph._pkg_use_enabled(parent)) |
163 |
current_use = set(self.depgraph._pkg_use_enabled(parent)) |
172 |
for flag, state in zip(affecting_use, use_state): |
164 |
for flag, state in zip(affecting_use, use_state): |
173 |
if state == "enabled": |
165 |
if state == "enabled": |
Lines 200-208
class circular_dependency_handler(object):
Link Here
|
200 |
solution.add((flag, False)) |
192 |
solution.add((flag, False)) |
201 |
solutions.add(frozenset(solution)) |
193 |
solutions.add(frozenset(solution)) |
202 |
|
194 |
|
203 |
if not _next_use_state(use_state): |
|
|
204 |
break |
205 |
|
206 |
for solution in solutions: |
195 |
for solution in solutions: |
207 |
ignore_solution = False |
196 |
ignore_solution = False |
208 |
for other_solution in solutions: |
197 |
for other_solution in solutions: |