Move the AUTOCLEAN code into dblink.treewalk since it's already partially
authorZac Medico <zmedico@gentoo.org>
Sun, 30 Mar 2008 06:18:15 +0000 (06:18 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 30 Mar 2008 06:18:15 +0000 (06:18 -0000)
supported there anyway (for replacement of identical cpv). This has the
benefit of guaranteeing that the order of installation and removal phases
is always the same.

svn path=/main/trunk/; revision=9621

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

index 63ca57dc191b5ed76485ab8b57a626369093a604..91ec5dd0f815523d31d79384f809debdf863a334 100644 (file)
@@ -4792,20 +4792,6 @@ class MergeTask(object):
                                if "--pretend" not in self.myopts and \
                                        "--fetchonly" not in self.myopts and \
                                        "--fetch-all-uri" not in self.myopts:
-                                       # Clean the old package that we have merged over top of it.
-                                       if pkgsettings.get("AUTOCLEAN", "yes") == "yes":
-                                               xsplit=portage.pkgsplit(x[2])
-                                               emergelog(xterm_titles, " >>> AUTOCLEAN: " + xsplit[0])
-                                               retval = unmerge(self.trees[myroot]["root_config"],
-                                                       self.myopts,
-                                                       "clean", [xsplit[0]], ldpath_mtimes, autoclean=1)
-                                               if not retval:
-                                                       emergelog(xterm_titles,
-                                                               " --- AUTOCLEAN: Nothing unmerged.")
-                                       else:
-                                               portage.writemsg_stdout(colorize("WARN", "WARNING:")
-                                                       + " AUTOCLEAN is disabled.  This can cause serious"
-                                                       + " problems due to overlapping packages.\n")
 
                                        # Figure out if we need a restart.
                                        mysplit=portage.pkgsplit(x[2])
index 3a692680dc613a4c2baa2fdddafb4ec2e136673a..7970c0a4b7d0cf2931f526ffeac0902f1450eef4 100644 (file)
@@ -2126,11 +2126,11 @@ class dblink(object):
                        "portage" == pkgsplit(self.pkg)[0]:
                        reinstall_self = True
 
+               autoclean = self.settings.get("AUTOCLEAN", "yes") == "yes"
                for dblnk in list(others_in_slot):
                        if dblnk is self:
                                continue
-                       if dblnk.mycpv != self.mycpv and \
-                               not reinstall_self:
+                       if not (autoclean or dblnk.mycpv == self.mycpv or reinstall_self):
                                continue
                        writemsg_stdout(">>> Safely unmerging already-installed instance...\n")
                        others_in_slot.remove(dblnk) # dblnk will unmerge itself now
@@ -2139,8 +2139,12 @@ class dblink(object):
                        # TODO: Check status and abort if necessary.
                        dblnk.delete()
                        writemsg_stdout(">>> Original instance of package unmerged safely.\n")
-                       if not reinstall_self:
-                               break
+
+               if len(others_in_slot) > 1:
+                       from portage.output import colorize
+                       writemsg_stdout(colorize("WARN", "WARNING:")
+                               + " AUTOCLEAN is disabled.  This can cause serious"
+                               + " problems due to overlapping packages.\n")
 
                # We hold both directory locks.
                self.dbdir = self.dbpkgdir