For bug #161422, make slot collisions non-fatal in cases where an invalid depgraph...
authorZac Medico <zmedico@gentoo.org>
Wed, 10 Jan 2007 23:29:43 +0000 (23:29 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 10 Jan 2007 23:29:43 +0000 (23:29 -0000)
svn path=/main/trunk/; revision=5534

bin/emerge

index 7bb2fc5d44b3235928cbad37846caa593804c9db..ffbb214f76eb50f499877f486778f740e02511d1 100755 (executable)
@@ -1164,6 +1164,7 @@ class depgraph:
                        slot_atom = "%s:%s" % (portage.dep_getkey(mykey), metadata["SLOT"])
                        existing_node = self._slot_node_map[myroot].get(
                                slot_atom, None)
+                       slot_collision = False
                        if existing_node:
                                e_type, myroot, e_cpv, e_status = existing_node
                                if mykey == e_cpv:
@@ -1188,31 +1189,26 @@ class depgraph:
                                                myparents.append(myparent)
                                        self._slot_collision_info.append(
                                                ((jbigkey, myparents), (existing_node, e_parents)))
-
-                                       # Now add this node to the graph so that self.display()
-                                       # can show use flags and --tree output.  This node is
-                                       # only being partially added to the graph.  It must not be
-                                       # allowed to interfere with the other nodes that have been
-                                       # added.  Do not overwrite data for existing nodes in
-                                       # self.pkg_node_map and self.mydbapi since that data will
-                                       # be used for blocker validation.
-                                       self.pkg_node_map[myroot].setdefault(mykey, jbigkey)
-                                       self.useFlags[myroot].setdefault(mykey, myuse)
-                                       self._parent_child_digraph.add(jbigkey, myparent)
-                                       if rev_dep and myparent:
-                                               self.digraph.add(myparent, jbigkey,
-                                                       priority=priority)
-                                       else:
-                                               self.digraph.add(jbigkey, myparent,
-                                                       priority=priority)
-                                       # The slot collision has rendered the graph invalid, so
-                                       # there's no need to process dependencies of this node.
-                                       return 1
-
-                       self._slot_node_map[myroot][slot_atom] = jbigkey
-                       self.pkg_node_map[myroot][mykey] = jbigkey
-                       self.useFlags[myroot][mykey] = myuse
-                       self.mydbapi[myroot].cpv_inject(mykey, metadata=metadata)
+                                       slot_collision = True
+
+                       if slot_collision:
+                               # Now add this node to the graph so that self.display()
+                               # can show use flags and --tree output.  This node is
+                               # only being partially added to the graph.  It must not be
+                               # allowed to interfere with the other nodes that have been
+                               # added.  Do not overwrite data for existing nodes in
+                               # self.pkg_node_map and self.mydbapi since that data will
+                               # be used for blocker validation.
+                               self.pkg_node_map[myroot].setdefault(mykey, jbigkey)
+                               self.useFlags[myroot].setdefault(mykey, myuse)
+                               # Even though the graph is now invalid, continue to process
+                               # dependencies so that things like --fetchonly can still
+                               # function despite collisions.
+                       else:
+                               self.mydbapi[myroot].cpv_inject(mykey, metadata=metadata)
+                               self._slot_node_map[myroot][slot_atom] = jbigkey
+                               self.pkg_node_map[myroot][mykey] = jbigkey
+                               self.useFlags[myroot][mykey] = myuse
 
                        if rev_dep and myparent:
                                self.digraph.addnode(myparent, jbigkey,
@@ -1938,9 +1934,18 @@ class depgraph:
                                if x[0] == "blocks":
                                        return True
                        self._show_slot_collision_notice(self._slot_collision_info[0])
-                       return False
+                       if not self._invalid_depgraph_is_acceptable():
+                               return False
                return True
 
+       def _invalid_depgraph_is_acceptable(self):
+               acceptable = False
+               for x in ("--nodeps", "--pretend", "--fetchonly", "--fetch-all-uri"):
+                       if x in self.myopts:
+                               acceptable = True
+                               break
+               return acceptable
+
        def altlist(self, reversed=False):
                if reversed in self._altlist_cache:
                        return self._altlist_cache[reversed][:]