emerge --depclean: Add more --debug output. v2.2_rc97
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:49:56 +0000 (19:49 -0700)
pym/_emerge/actions.py
pym/_emerge/main.py

index d9dbfb473c9f24092124efb3b460cfa7f2496b23..5ac676d91c689634d744ff0cccda25edd86e3bba 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 087e456fd2bf033d88b6289ed5e0efd25691baba..fa8ddefc28b2bae0b7deebbe00136c7bfce7cae9 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)