Bug #243220 - Show messages in emerge.log when old versions are uninstalled
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 06:45:37 +0000 (06:45 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 06:45:37 +0000 (06:45 -0000)
for AUTOCLEAN. This reverts behavior so that messages which used to be
generated prior to portage-2.1.5.x (when AUTOCLEAN was moved from emerge to
dblink.treewalk()) are generated once again. (trunk r13241)

svn path=/main/branches/2.1.6/; revision=13422

pym/_emerge/__init__.py
pym/portage/dbapi/vartree.py

index 3b04c3dcff5917af2b139a8a098e2c08a41341a0..7cf0f7cbda1bf05de5ba155b22a7c31e992c2e8a 100644 (file)
@@ -9969,7 +9969,7 @@ class Scheduler(PollScheduler):
 
        class _iface_class(SlotObject):
                __slots__ = ("dblinkEbuildPhase", "dblinkDisplayMerge",
-                       "dblinkElog", "fetch", "register", "schedule",
+                       "dblinkElog", "dblinkEmergeLog", "fetch", "register", "schedule",
                        "scheduleSetup", "scheduleUnpack", "scheduleYield",
                        "unregister")
 
@@ -10098,6 +10098,7 @@ class Scheduler(PollScheduler):
                        dblinkEbuildPhase=self._dblink_ebuild_phase,
                        dblinkDisplayMerge=self._dblink_display_merge,
                        dblinkElog=self._dblink_elog,
+                       dblinkEmergeLog=self._dblink_emerge_log,
                        fetch=fetch_iface, register=self._register,
                        schedule=self._schedule_wait,
                        scheduleSetup=self._schedule_setup,
@@ -10409,6 +10410,9 @@ class Scheduler(PollScheduler):
                        if log_file is not None:
                                log_file.close()
 
+       def _dblink_emerge_log(self, msg):
+               self._logger.log(msg)
+
        def _dblink_display_merge(self, pkg_dblink, msg, level=0, noiselevel=0):
                log_path = pkg_dblink.settings.get("PORTAGE_LOG_FILE")
                background = self._background
index f106e5f568bf5c458c64141a7dc5ed308adb491d..0256361c181865add28b3163ee354a95babf1eb3 100644 (file)
@@ -2068,6 +2068,14 @@ class dblink(object):
                        if var_name == 'SLOT':
                                slot = val
 
+                               if not slot.strip():
+                                       slot = self.settings.get(var_name, '')
+                                       if not slot.strip():
+                                               showMessage("!!! SLOT is undefined\n",
+                                                       level=logging.ERROR, noiselevel=-1)
+                                               return 1
+                                       write_atomic(os.path.join(inforoot, var_name), slot + '\n')
+
                        if val != self.settings.get(var_name, ''):
                                self._eqawarn('preinst',
                                        ["QA Notice: Expected %s='%s', got '%s'\n" % \
@@ -2083,10 +2091,12 @@ class dblink(object):
                for v in self.vartree.dbapi.cp_list(self.mysplit[0]):
                        otherversions.append(v.split("/")[1])
 
+               cp = self.mysplit[0]
+               slot_atom = "%s:%s" % (cp, slot)
+
                # filter any old-style virtual matches
-               slot_matches = [cpv for cpv in self.vartree.dbapi.match(
-                       "%s:%s" % (cpv_getkey(self.mycpv), slot)) \
-                       if cpv_getkey(cpv) == cpv_getkey(self.mycpv)]
+               slot_matches = [cpv for cpv in self.vartree.dbapi.match(slot_atom) \
+                       if cpv_getkey(cpv) == cp]
 
                if self.mycpv not in slot_matches and \
                        self.vartree.dbapi.cpv_exists(self.mycpv):
@@ -2438,7 +2448,17 @@ class dblink(object):
                        match_from_list(PORTAGE_PACKAGE_ATOM, [self.mycpv]):
                        reinstall_self = True
 
+               if scheduler is None:
+                       def emerge_log(msg):
+                               pass
+               else:
+                       emerge_log = scheduler.dblinkEmergeLog
+
                autoclean = self.settings.get("AUTOCLEAN", "yes") == "yes"
+
+               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:
@@ -2446,9 +2466,16 @@ 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.unmerge(trimworld=0, ldpath_mtimes=prev_mtimes,
-                               others_in_slot=others_in_slot)
+                       unmerge_rval = dblnk.unmerge(trimworld=0,
+                               ldpath_mtimes=prev_mtimes, others_in_slot=others_in_slot)
+
+                       if unmerge_rval == os.EX_OK:
+                               emerge_log(" >>> unmerge success: %s" % (dblnk.mycpv,))
+                       else:
+                               emerge_log(" !!! unmerge FAILURE: %s" % (dblnk.mycpv,))
+
                        # TODO: Check status and abort if necessary.
                        dblnk.delete()
                        showMessage(">>> Original instance of package unmerged safely.\n")