emerge --depclean: Add more --debug output. v2.1.9.19
authorZac Medico <zmedico@gentoo.org>
Sat, 16 Oct 2010 02:49:56 +0000 (19:49 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 16 Oct 2010 02:50:42 +0000 (19:50 -0700)
pym/_emerge/actions.py
pym/_emerge/main.py

index 4f1243c237419838d3536efdf681cfd4b17e85e6..71701d813a6eb99055dffdaaacfb40263f9edbdf 100644 (file)
@@ -618,6 +618,7 @@ def calc_depclean(settings, trees, ldpath_mtimes,
        myopts, action, args_set, spinner):
        allow_missing_deps = bool(args_set)
 
+       debug = '--debug' in myopts
        xterm_titles = "notitles" not in settings.features
        myroot = settings["ROOT"]
        root_config = trees[myroot]["root_config"]
@@ -1102,6 +1103,7 @@ def calc_depclean(settings, trees, ldpath_mtimes,
                        clean_set = set(cleanlist)
 
        if clean_set:
+               writemsg_level(">>> Calculating removal order...\n")
                # Use a topological sort to create an unmerge order such that
                # each package is unmerged before it's dependencies. This is
                # necessary to avoid breaking things that may need to run
@@ -1130,6 +1132,15 @@ def calc_depclean(settings, trees, ldpath_mtimes,
                                if not depstr:
                                        continue
                                priority = priority_map[dep_type]
+
+                               if debug:
+                                       writemsg_level(_unicode_decode("\nParent:    %s\n") \
+                                               % (node,), noiselevel=-1, level=logging.DEBUG)
+                                       writemsg_level(_unicode_decode(  "Depstring: %s\n") \
+                                               % (depstr,), noiselevel=-1, level=logging.DEBUG)
+                                       writemsg_level(_unicode_decode(  "Priority:  %s\n") \
+                                               % (priority,), noiselevel=-1, level=logging.DEBUG)
+
                                try:
                                        atoms = resolver._select_atoms(myroot, depstr,
                                                myuse=node.use.enabled, parent=node,
@@ -1139,6 +1150,11 @@ def calc_depclean(settings, trees, ldpath_mtimes,
                                        # be uninstalled anyway.
                                        continue
 
+                               if debug:
+                                       writemsg_level("Candidates: [%s]\n" % \
+                                               ', '.join(_unicode_decode("'%s'") % (x,) for x in atoms),
+                                               noiselevel=-1, level=logging.DEBUG)
+
                                for atom in atoms:
                                        if not isinstance(atom, portage.dep.Atom):
                                                # Ignore invalid atoms returned from dep_check().
@@ -1152,6 +1168,12 @@ def calc_depclean(settings, trees, ldpath_mtimes,
                                                if child_node in clean_set:
                                                        graph.add(child_node, node, priority=priority)
 
+               if debug:
+                       writemsg_level("\nunmerge digraph:\n\n",
+                               noiselevel=-1, level=logging.DEBUG)
+                       graph.debug_print()
+                       writemsg_level("\n", noiselevel=-1, level=logging.DEBUG)
+
                ordered = True
                if len(graph.order) == len(graph.root_nodes()):
                        # If there are no dependencies between packages
index f262d11bf8eccd56e9937ef732db5f9c0cf929e4..dc15719ec50e52f22ffa027528f1eb85c00d156f 100644 (file)
@@ -1480,6 +1480,7 @@ def emerge_main():
        if settings.get("PORTAGE_DEBUG", "") == "1":
                spinner.update = spinner.update_quiet
                portage.debug=1
+               portage.util.noiselimit = 0
                if "python-trace" in settings.features:
                        import portage.debug
                        portage.debug.set_trace(True)