Make depgraph._serialize_tasks show a debug message when it
authorZac Medico <zmedico@gentoo.org>
Sun, 30 May 2010 09:00:50 +0000 (02:00 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 30 May 2010 09:00:50 +0000 (02:00 -0700)
enables 'complete' mode due to an uninstall, and fix the
Package.__str__ method to display uninstall tasks properly.

pym/_emerge/Package.py
pym/_emerge/depgraph.py

index 963bfd9f0ac94b2b08fd14d997f4fe56ae3727a1..845d307756670210058772aad0ca9127b1266801 100644 (file)
@@ -159,15 +159,13 @@ class Package(Task):
                if self.type_name == "installed":
                        if self.root != "/":
                                s += " in '%s'" % self.root
+                       if self.operation == "uninstall":
+                               s += " scheduled for uninstall"
                else:
                        if self.operation == "merge":
                                s += " scheduled for merge"
                                if self.root != "/":
                                        s += " to '%s'" % self.root
-                       elif self.operation == "uninstall":
-                               s += " scheduled for uninstall"
-                               if self.root != "/":
-                                       s += " from '%s'" % self.root
                s += ")"
                return s
 
index 5180c2ded9c13f43c91e598d4f605d6384dcc063..a466e7d89efc1686bd7afd8ce0032061934da958 100644 (file)
@@ -4014,6 +4014,18 @@ class depgraph(object):
                        not complete and \
                        not unsolvable_blockers:
                        self._dynamic_config.myparams["complete"] = True
+                       if '--debug' in self._frozen_config.myopts:
+                               msg = []
+                               msg.append("enabling 'complete' depgraph mode " + \
+                                       "due to uninstall task(s):")
+                               msg.append("")
+                               for node in retlist:
+                                       if isinstance(node, Package) and \
+                                               node.operation == 'uninstall':
+                                               msg.append("\t%s" % (node,))
+                               writemsg_level("\n%s\n" % \
+                                       "".join("%s\n" % line for line in msg),
+                                       level=logging.DEBUG, noiselevel=-1)
                        raise self._serialize_tasks_retry("")
 
                # Set satisfied state on blockers, but not before the