From 4b8e84bf854cf1549a130756391665a434b463a5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 20 Nov 2007 23:19:13 +0000 Subject: [PATCH] Make the slot collision display show all collisions instead of just the first one. (trunk r8498) svn path=/main/branches/2.1.2/; revision=8556 --- bin/emerge | 54 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/bin/emerge b/bin/emerge index 611b4abfd..3366e26c4 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1195,14 +1195,14 @@ class depgraph: self.blocker_digraph = digraph() self.blocker_parents = {} self._unresolved_blocker_parents = {} - self._slot_collision_info = [] + self._slot_collision_info = set() # Slot collision nodes are not allowed to block other packages since # blocker validation is only able to account for one package per slot. self._slot_collision_nodes = set() self._altlist_cache = {} self._pprovided_args = [] - def _show_slot_collision_notice(self, packages): + def _show_slot_collision_notice(self): """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 @@ -1213,17 +1213,35 @@ class depgraph: msg.append("\n!!! Multiple versions within a single " + \ "package slot have been \n") msg.append("!!! pulled into the dependency graph:\n\n") - for node, parents in packages: - msg.append(str(node)) - if parents: - msg.append(" pulled in by\n") - for parent in parents: - msg.append(" ") - msg.append(str(parent)) - msg.append("\n") - else: - msg.append(" (no parents)\n") - msg.append("\n") + indent = " " + for slot_atom, root in self._slot_collision_info: + msg.append(slot_atom) + msg.append("\n\n") + slot_nodes = [] + for node in self._slot_collision_nodes: + type_name, pkg_root, cpv, pkg_status = node + if pkg_root != root: + continue + mydb = self.roots[root].trees[ + self.pkg_tree_map[type_name]].dbapi + slot = mydb.aux_get(cpv, ["SLOT"])[0] + if slot_atom == "%s:%s" % (portage.cpv_getkey(cpv), slot): + slot_nodes.append(node) + slot_nodes.append(self._slot_node_map[root][slot_atom]) + for node in slot_nodes: + msg.append(indent) + msg.append(str(node)) + parents = self._parent_child_digraph.parent_nodes(node) + if parents: + msg.append(" pulled in by\n") + for parent in parents: + msg.append(2*indent) + msg.append(str(parent)) + msg.append("\n") + else: + msg.append(" (no parents)\n") + msg.append("\n") + msg.append("\n") sys.stderr.write("".join(msg)) sys.stderr.flush() @@ -1404,13 +1422,7 @@ class depgraph: # A slot collision has occurred. Sometimes this coincides # with unresolvable blockers, so the slot collision will be # shown later if there are no unresolvable blockers. - e_parents = self._parent_child_digraph.parent_nodes( - existing_node) - myparents = [] - if myparent: - myparents.append(myparent) - self._slot_collision_info.append( - ((jbigkey, myparents), (existing_node, e_parents))) + self._slot_collision_info.add((slot_atom, myroot)) self._slot_collision_nodes.add(jbigkey) slot_collision = True @@ -2335,7 +2347,7 @@ class depgraph: for x in self.altlist(): if x[0] == "blocks": return True - self._show_slot_collision_notice(self._slot_collision_info[0]) + self._show_slot_collision_notice() if not self._accept_collisions(): return False return True -- 2.26.2