From 004fd4ac957fac9f3784d75026369373cabad1a0 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 6 Oct 2010 12:33:26 -0700 Subject: [PATCH] Add fallback backtrack_data, in case logic fails. This adds some safety in the depgraph._add_pkg() slot conflict code, in case the new logic fails somehow (it shouldn't, but given all the complexities, who knows?). Also, add some more debug output. --- pym/_emerge/depgraph.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index ab34a411a..5ab42f68e 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -874,6 +874,7 @@ class depgraph(object): self._process_slot_conflicts() backtrack_data = [] + fallback_data = [] all_parents = set() # The ordering of backtrack_data can make # a difference here, because both mask actions may lead @@ -904,16 +905,26 @@ class depgraph(object): all_match = False break - if all_match: - # 'to_be_masked' does not violate any parent atom, which means - # there is no point in masking it. - continue - if to_be_selected >= to_be_masked: # We only care about the parent atoms # when they trigger a downgrade. parent_atoms = set() - backtrack_data.append((to_be_masked, parent_atoms)) + + fallback_data.append((to_be_masked, parent_atoms)) + + if all_match: + # 'to_be_masked' does not violate any parent atom, which means + # there is no point in masking it. + pass + else: + backtrack_data.append((to_be_masked, parent_atoms)) + + if not backtrack_data: + # This shouldn't happen, but fall back to th old + # behavior if this gets triggered somehow. + backtrack_data = fallback_data + + to_be_masked = backtrack_data[-1][0] self._dynamic_config._backtrack_infos["slot conflict"] = backtrack_data self._dynamic_config._need_restart = True @@ -922,8 +933,11 @@ class depgraph(object): msg.append("") msg.append("") msg.append("backtracking due to slot conflict:") + if backtrack_data is fallback_data: + msg.append("!!! backtrack_data fallback") msg.append(" first package: %s" % existing_node) msg.append(" second package: %s" % pkg) + msg.append(" package to mask: %s" % to_be_masked) msg.append(" slot: %s" % pkg.slot_atom) msg.append(" parents: %s" % ", ".join( \ "(%s, '%s')" % (ppkg, atom) for ppkg, atom in all_parents)) -- 2.26.2