Make the slot collision display show all collisions instead
authorZac Medico <zmedico@gentoo.org>
Tue, 20 Nov 2007 23:19:13 +0000 (23:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 20 Nov 2007 23:19:13 +0000 (23:19 -0000)
of just the first one. (trunk r8498)

svn path=/main/branches/2.1.2/; revision=8556

bin/emerge

index 611b4abfdf4199945be82f977e7a2509a0014f5b..3366e26c45815c0ba79b859e1160e841a77e4e3d 100755 (executable)
@@ -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