If there are circular dependencies, and circular_dependency_handler
authorZac Medico <zmedico@gentoo.org>
Sat, 28 Aug 2010 21:21:06 +0000 (14:21 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 28 Aug 2010 21:21:06 +0000 (14:21 -0700)
doesn't have a message, eliminate root nodes before calling
digraph.debug_print(). If --debug is enabled then do this even if
circular_dependency_handler has a message.

pym/_emerge/depgraph.py
pym/_emerge/resolver/circular_dependency.py

index eb0dfb8a21aeb6b4a5ae0bec7eb65c522cc5012c..69fe002989e2f5d6e72be6ae6e0c873d5b6e7599 100644 (file)
@@ -4184,9 +4184,12 @@ class depgraph(object):
                        noiselevel=-1)
                portage.writemsg("\n", noiselevel=-1)
 
-               if handler.circular_dep_message is None:
-                       mygraph.debug_print()
-               else:
+               if handler.circular_dep_message is None or \
+                       "--debug" in self._frozen_config.myopts:
+                       handler.debug_print()
+                       portage.writemsg("\n", noiselevel=-1)
+
+               if handler.circular_dep_message is not None:
                        portage.writemsg(handler.circular_dep_message, noiselevel=-1)
 
                suggestions = handler.suggestions
index dbb1adf497fc1421d0543664844c5aea586b67a5..0ecdbbe8c0a51f970303c9ae896e63342bd0088c 100644 (file)
@@ -244,3 +244,18 @@ class circular_dependency_handler(object):
                                final_solutions.setdefault(pkg, set()).add(solution)
 
                return final_solutions, suggestions
+
+       def debug_print(self):
+               """
+               Create a copy of the digraph, prune all root nodes,
+               and call the debug_print() method.
+               """
+               graph = self.graph.copy()
+               while True:
+                       root_nodes = graph.root_nodes(
+                               ignore_priority=DepPrioritySatisfiedRange.ignore_medium_soft)
+                       if not root_nodes:
+                               break
+                       graph.difference_update(root_nodes)
+
+               graph.debug_print()