Revert "dblink.merge: remove autoclean emergelog calls"
authorZac Medico <zmedico@gentoo.org>
Sat, 4 Jun 2011 01:49:02 +0000 (18:49 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 4 Jun 2011 01:49:02 +0000 (18:49 -0700)
This reverts commit 352280549c9b72e7b916803dc6b03b959d0817e3.
I'm planning to fix this so the emergelog calls are only enabled when
emerge is the caller.

pym/portage/dbapi/vartree.py

index 452a38f2c80a2424cabccb22f41f2145428f6ad1..16cf48b76dfc64f8cfd407df93201a1d918ce630 100644 (file)
@@ -57,6 +57,7 @@ from portage import _unicode_encode
 from _emerge.AsynchronousLock import AsynchronousLock
 from _emerge.EbuildBuildDir import EbuildBuildDir
 from _emerge.EbuildPhase import EbuildPhase
+from _emerge.emergelog import emergelog
 from _emerge.PollScheduler import PollScheduler
 from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
 
@@ -2957,6 +2958,9 @@ class dblink(object):
                        if str_buffer:
                                os.write(self._pipe, _unicode_encode(''.join(str_buffer)))
 
+       def _emerge_log(self, msg):
+               emergelog(False, msg)
+
        def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0,
                mydbapi=None, prev_mtimes=None, counter=None):
                """
@@ -3457,6 +3461,8 @@ class dblink(object):
                        match_from_list(PORTAGE_PACKAGE_ATOM, [self.mycpv]):
                        reinstall_self = True
 
+               emerge_log = self._emerge_log
+
                # If we have any preserved libraries then autoclean
                # is forced so that preserve-libs logic doesn't have
                # to account for the additional complexity of the
@@ -3464,6 +3470,9 @@ class dblink(object):
                autoclean = self.settings.get("AUTOCLEAN", "yes") == "yes" \
                        or preserve_paths
 
+               if autoclean:
+                       emerge_log(_(" >>> AUTOCLEAN: %s") % (slot_atom,))
+
                others_in_slot.append(self)  # self has just been merged
                for dblnk in list(others_in_slot):
                        if dblnk is self:
@@ -3471,6 +3480,7 @@ class dblink(object):
                        if not (autoclean or dblnk.mycpv == self.mycpv or reinstall_self):
                                continue
                        showMessage(_(">>> Safely unmerging already-installed instance...\n"))
+                       emerge_log(_(" === Unmerging... (%s)") % (dblnk.mycpv,))
                        others_in_slot.remove(dblnk) # dblnk will unmerge itself now
                        dblnk._linkmap_broken = self._linkmap_broken
                        dblnk.settings["REPLACED_BY_VERSION"] = portage.versions.cpv_getversion(self.mycpv)
@@ -3480,6 +3490,11 @@ class dblink(object):
                                preserve_paths=preserve_paths)
                        dblnk.settings.pop("REPLACED_BY_VERSION", None)
 
+                       if unmerge_rval == os.EX_OK:
+                               emerge_log(_(" >>> unmerge success: %s") % (dblnk.mycpv,))
+                       else:
+                               emerge_log(_(" !!! unmerge FAILURE: %s") % (dblnk.mycpv,))
+
                        self.lockdb()
                        try:
                                # TODO: Check status and abort if necessary.