For bug #181953, prevent the circular_blocks code from selecting a node that's alread...
authorZac Medico <zmedico@gentoo.org>
Wed, 13 Jun 2007 21:46:59 +0000 (21:46 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 13 Jun 2007 21:46:59 +0000 (21:46 -0000)
svn path=/main/trunk/; revision=6837

pym/emerge/__init__.py

index 8b52ed356e34cb9a242324524921d5232fe79a35..b3a03b632fc1a73f624aeafcb57f833b6da589a9 100644 (file)
@@ -2120,8 +2120,16 @@ class depgraph:
                                        if not circular_blocks:
                                                circular_blocks = True
                                                blocker_deps = myblockers.leaf_nodes()
-                                       if blocker_deps:
-                                               selected_nodes = [blocker_deps.pop()]
+                                       while blocker_deps:
+                                               # Some of these nodes might have already been selected
+                                               # by the normal node selection process after the
+                                               # circular_blocks flag has been set.  Therefore, we
+                                               # have to verify that they're still in the graph so
+                                               # that they're not selected more than once.
+                                               node = blocker_deps.pop()
+                                               if mygraph.contains(node):
+                                                       selected_nodes = [node]
+                                                       break
 
                        if not selected_nodes:
                                # No leaf nodes are available, so we have a circular