Lines 54-60
Link Here
|
54 |
|
54 |
|
55 |
class _frozen_depgraph_config(object): |
55 |
class _frozen_depgraph_config(object): |
56 |
|
56 |
|
57 |
def __init__(self, settings, trees, myopts, spinner): |
57 |
def __init__(self, settings, trees, myopts, spinner, allow_backtracking=False): |
58 |
self.settings = settings |
58 |
self.settings = settings |
59 |
self.target_root = settings["ROOT"] |
59 |
self.target_root = settings["ROOT"] |
60 |
self.myopts = myopts |
60 |
self.myopts = myopts |
Lines 88-97
Link Here
|
88 |
clone=self.trees[myroot]["vartree"].settings) |
88 |
clone=self.trees[myroot]["vartree"].settings) |
89 |
|
89 |
|
90 |
self._required_set_names = set(["system", "world"]) |
90 |
self._required_set_names = set(["system", "world"]) |
|
|
91 |
self._allow_backtracking = allow_backtracking |
91 |
|
92 |
|
92 |
class _dynamic_depgraph_config(object): |
93 |
class _dynamic_depgraph_config(object): |
93 |
|
94 |
|
94 |
def __init__(self, depgraph, myparams): |
95 |
def __init__(self, depgraph, myparams, runtime_pkg_mask): |
95 |
self.myparams = myparams |
96 |
self.myparams = myparams |
96 |
# Maps slot atom to package for each Package added to the graph. |
97 |
# Maps slot atom to package for each Package added to the graph. |
97 |
self._slot_pkg_map = {} |
98 |
self._slot_pkg_map = {} |
Lines 155-160
Link Here
|
155 |
self._initially_unsatisfied_deps = [] |
156 |
self._initially_unsatisfied_deps = [] |
156 |
self._ignored_deps = [] |
157 |
self._ignored_deps = [] |
157 |
self._highest_pkg_cache = {} |
158 |
self._highest_pkg_cache = {} |
|
|
159 |
self._runtime_pkg_mask = runtime_pkg_mask |
160 |
self._need_restart = False |
158 |
|
161 |
|
159 |
for myroot in depgraph._frozen_config.trees: |
162 |
for myroot in depgraph._frozen_config.trees: |
160 |
self._slot_pkg_map[myroot] = {} |
163 |
self._slot_pkg_map[myroot] = {} |
Lines 245-256
Link Here
|
245 |
_dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] |
248 |
_dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] |
246 |
|
249 |
|
247 |
def __init__(self, settings, trees, myopts, myparams, spinner, |
250 |
def __init__(self, settings, trees, myopts, myparams, spinner, |
248 |
frozen_config=None): |
251 |
frozen_config=None, runtime_pkg_mask=[], allow_backtracking=False): |
249 |
if frozen_config is None: |
252 |
if frozen_config is None: |
250 |
frozen_config = _frozen_depgraph_config(settings, trees, |
253 |
frozen_config = _frozen_depgraph_config(settings, trees, |
251 |
myopts, spinner) |
254 |
myopts, spinner, allow_backtracking=allow_backtracking) |
252 |
self._frozen_config = frozen_config |
255 |
self._frozen_config = frozen_config |
253 |
self._dynamic_config = _dynamic_depgraph_config(self, myparams) |
256 |
self._dynamic_config = _dynamic_depgraph_config(self, myparams, runtime_pkg_mask) |
254 |
|
257 |
|
255 |
self._select_atoms = self._select_atoms_highest_available |
258 |
self._select_atoms = self._select_atoms_highest_available |
256 |
self._select_package = self._select_pkg_highest_available |
259 |
self._select_package = self._select_pkg_highest_available |
Lines 696-708
Link Here
|
696 |
(dep.parent, dep.atom)) |
699 |
(dep.parent, dep.atom)) |
697 |
return 1 |
700 |
return 1 |
698 |
else: |
701 |
else: |
|
|
702 |
# A slot collision has occurred. |
703 |
if self._frozen_config._allow_backtracking: |
704 |
#Mask existing_node and restart dependency calculation. |
705 |
print "A slot collsion occured for ", existing_node.slot_atom, ". Masking ", existing_node.cpv, "." |
706 |
self._dynamic_config._runtime_pkg_mask.append(existing_node) |
707 |
self._dynamic_config._need_restart = True |
708 |
return 0 |
709 |
else: |
710 |
#Sometimes this coincides with unresolvable blockers, \ |
711 |
#so the slot collision will be shown later if there are \ |
712 |
#no unresolvable blockers. |
713 |
self._add_slot_conflict(pkg) |
714 |
slot_collision = True |
699 |
|
715 |
|
700 |
# A slot collision has occurred. Sometimes this coincides |
|
|
701 |
# with unresolvable blockers, so the slot collision will be |
702 |
# shown later if there are no unresolvable blockers. |
703 |
self._add_slot_conflict(pkg) |
704 |
slot_collision = True |
705 |
|
706 |
if slot_collision: |
716 |
if slot_collision: |
707 |
# Now add this node to the graph so that self.display() |
717 |
# Now add this node to the graph so that self.display() |
708 |
# can show use flags and --tree portage.output. This node is |
718 |
# can show use flags and --tree portage.output. This node is |
Lines 1945-1950
Link Here
|
1945 |
|
1955 |
|
1946 |
for pkg in self._iter_match_pkgs(root_config, pkg_type, atom, |
1956 |
for pkg in self._iter_match_pkgs(root_config, pkg_type, atom, |
1947 |
onlydeps=onlydeps): |
1957 |
onlydeps=onlydeps): |
|
|
1958 |
if pkg in self._dynamic_config._runtime_pkg_mask: |
1959 |
#The package has been masked by the backtracking logic |
1960 |
continue |
1948 |
cpv = pkg.cpv |
1961 |
cpv = pkg.cpv |
1949 |
# Make --noreplace take precedence over --newuse. |
1962 |
# Make --noreplace take precedence over --newuse. |
1950 |
if not pkg.installed and noreplace and \ |
1963 |
if not pkg.installed and noreplace and \ |
Lines 4572-4577
Link Here
|
4572 |
graph in order to avoid making a potentially unsafe decision. |
4585 |
graph in order to avoid making a potentially unsafe decision. |
4573 |
""" |
4586 |
""" |
4574 |
|
4587 |
|
|
|
4588 |
def need_restart(self): |
4589 |
return self._dynamic_config._need_restart |
4590 |
|
4591 |
def get_runtime_pkg_mask(self): |
4592 |
return self._dynamic_config._runtime_pkg_mask[:] |
4593 |
|
4594 |
|
4575 |
class _dep_check_composite_db(portage.dbapi): |
4595 |
class _dep_check_composite_db(portage.dbapi): |
4576 |
""" |
4596 |
""" |
4577 |
A dbapi-like interface that is optimized for use in dep_check() calls. |
4597 |
A dbapi-like interface that is optimized for use in dep_check() calls. |