post_emerge: suggest depclean after world update
authorZac Medico <zmedico@gentoo.org>
Tue, 22 Feb 2011 02:07:07 +0000 (18:07 -0800)
committerZac Medico <zmedico@gentoo.org>
Tue, 22 Feb 2011 03:12:54 +0000 (19:12 -0800)
This is part of bug #354787.

pym/_emerge/main.py

index 267254c78bad0ae30a2dd13ae47540ae3160d958..b69a00401b1e3ad9b72f5584a600986b3b91a94d 100644 (file)
@@ -384,8 +384,21 @@ def post_emerge(myaction, myopts, myfiles,
                        writemsg_level(
                                " %s spawn failed of %s\n" % (bad("*"), postemerge,),
                                level=logging.ERROR, noiselevel=-1)
+
+       if "--quiet" not in myopts and \
+               myaction is None and "@world" in myfiles:
+               show_depclean_suggestion()
+
        sys.exit(retval)
 
+def show_depclean_suggestion():
+       out = portage.output.EOutput()
+       msg = "After world updates, it is important to remove " + \
+               "obsolete packages with emerge --depclean. Refer " + \
+               "to `man emerge` for more information."
+       for line in textwrap.wrap(msg, 72):
+               out.einfo(line)
+
 def multiple_actions(action1, action2):
        sys.stderr.write("\n!!! Multiple actions requested... Please choose one only.\n")
        sys.stderr.write("!!! '%s' or '%s'\n\n" % (action1, action2))