Move clean code, from the previous commit, from doebuild() to
authorZac Medico <zmedico@gentoo.org>
Sun, 29 Jun 2008 04:27:57 +0000 (04:27 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 29 Jun 2008 04:27:57 +0000 (04:27 -0000)
EbuildBuild.execute() where it fits better.

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

pym/_emerge/__init__.py
pym/portage/__init__.py

index c88d8af8f484a15af43fdbdba407859ed0a1db09..4929288f36ecdd6123bebb369c55e582e129171b 100644 (file)
@@ -1538,12 +1538,17 @@ class EbuildBuild(Task):
        def execute(self):
                root_config = self.pkg.root_config
                portdb = root_config.trees["porttree"].dbapi
-               vartree = root_config.trees["vartree"]
                ebuild_path = portdb.findname(self.pkg.cpv)
                debug = self.settings.get("PORTAGE_DEBUG") == "1"
 
+               retval = portage.doebuild(ebuild_path, "clean",
+                       root_config.root, self.settings, debug, cleanup=1,
+                       mydbapi=portdb, tree="porttree")
+               if retval != os.EX_OK:
+                       return retval
+
                retval = portage.doebuild(ebuild_path, "install",
-                       root_config.root, self.settings, debug, vartree=vartree,
+                       root_config.root, self.settings, debug,
                        mydbapi=portdb, tree="porttree")
                return retval
 
index 6bdf03a7860b155aa5b1c9c3379449bc6c6bc5c1..9fd08e88e09e172dfb5d092e691c7ad33142a0e2 100644 (file)
@@ -4934,18 +4934,10 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                        use_cache, mydbapi)
 
                clean_phases = ("clean", "cleanrm")
-               if mydo in clean_phases or \
-                       (not noauto and mydo in actionmap_deps and \
-                       mysettings.get("EMERGE_FROM") == "ebuild"):
-                       if mydo not in clean_phases:
-                               mysettings["EBUILD_PHASE"] = "clean"
-                       try:
-                               retval = spawn(_shell_quote(ebuild_sh_binary) + " clean",
-                                       mysettings, debug=debug, free=1, logfile=None)
-                       finally:
-                               mysettings["EBUILD_PHASE"] = mydo
-                       if mydo in clean_phases or retval != os.EX_OK:
-                               return retval
+               if mydo in clean_phases:
+                       retval = spawn(_shell_quote(ebuild_sh_binary) + " clean",
+                               mysettings, debug=debug, free=1, logfile=None)
+                       return retval
 
                # get possible slot information from the deps file
                if mydo == "depend":