unmerge: show virtual in system unmerge warning
authorZac Medico <zmedico@gentoo.org>
Wed, 8 Jun 2011 20:24:26 +0000 (13:24 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 8 Jun 2011 20:24:26 +0000 (13:24 -0700)
This is intended to clarify the messages shown in bug #370295, so that
it's obvious when a package is a member of the system set due to it
being a virtual provider.

pym/_emerge/unmerge.py

index 38f3515d03041fa0fcb05b8c7f0f534ca306a9a3..3db3a8be93d23e2e5705d5794ee65afec3ec9d40 100644 (file)
@@ -61,10 +61,13 @@ def _unmerge_display(root_config, myopts, unmerge_action,
                        vdb_lock = True
 
                realsyslist = []
+               sys_virt_map = {}
                for x in sets["system"].getAtoms():
                        for atom in expand_new_virt(vartree.dbapi, x):
                                if not atom.blocker:
                                        realsyslist.append(atom)
+                                       if atom.cp != x.cp:
+                                               sys_virt_map[atom.cp] = x.cp
 
                syslist = []
                for x in realsyslist:
@@ -442,8 +445,13 @@ def _unmerge_display(root_config, myopts, unmerge_action,
                        #avoid cluttering the preview printout with stuff that isn't getting unmerged
                        continue
                if not (pkgmap[x]["protected"] or pkgmap[x]["omitted"]) and cp in syslist:
+                       virt_cp = sys_virt_map.get(cp)
+                       if virt_cp is None:
+                               cp_info = "'%s'" % (cp,)
+                       else:
+                               cp_info = "'%s' (%s)" % (cp, virt_cp)
                        writemsg_level(colorize("BAD","\n\n!!! " + \
-                               "'%s' is part of your system profile.\n" % cp),
+                               "%s is part of your system profile.\n" % (cp_info,)),
                                level=logging.WARNING, noiselevel=-1)
                        writemsg_level(colorize("WARN","!!! Unmerging it may " + \
                                "be damaging to your system.\n\n"),