circular_dependency: show debug graph earlier
authorZac Medico <zmedico@gentoo.org>
Sat, 9 Jul 2011 22:54:47 +0000 (15:54 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 9 Jul 2011 22:54:47 +0000 (15:54 -0700)
This might help in some cases like bug 374397 where we're
troubleshooting the circular_dependency code.

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

index 899d04e3067df0c5492462d76a312c4f1ef33254..64ed50e2770929998daec20e06823568346c65f8 100644 (file)
@@ -5497,8 +5497,7 @@ class depgraph(object):
                        noiselevel=-1)
                portage.writemsg("\n", noiselevel=-1)
 
-               if handler.circular_dep_message is None or \
-                       "--debug" in self._frozen_config.myopts:
+               if handler.circular_dep_message is None:
                        handler.debug_print()
                        portage.writemsg("\n", noiselevel=-1)
 
index 9a3286c5c9556edfa21464c3c6bb6f6acd04e916..994e2022dfa3889df3b237e2c88c271716ac1738 100644 (file)
@@ -4,10 +4,12 @@
 from __future__ import print_function
 
 from itertools import chain, product
+import logging
 
 from portage.dep import use_reduce, extract_affecting_use, check_required_use, get_required_use_flags
 from portage.exception import InvalidDependString
 from portage.output import colorize
+from portage.util import writemsg_level
 from _emerge.DepPrioritySatisfiedRange import DepPrioritySatisfiedRange
 
 class circular_dependency_handler(object):
@@ -17,6 +19,14 @@ class circular_dependency_handler(object):
                self.graph = graph
                self.all_parent_atoms = depgraph._dynamic_config._parent_atoms
 
+               if "--debug" in depgraph._frozen_config.myopts:
+                       # Show this debug output before doing the calculations
+                       # that follow, so at least we have this debug info
+                       # if we happen to hit a bug later.
+                       writemsg_level("\n\ncircular dependency graph:\n\n",
+                               level=logging.DEBUG, noiselevel=-1)
+                       self.debug_print()
+
                self.cycles, self.shortest_cycle = self._find_cycles()
                #Guess if it is a large cluster of cycles. This usually requires
                #a global USE change.