In EbuildBuild.execute(), call doebuild() separately for each phase since
authorZac Medico <zmedico@gentoo.org>
Sun, 29 Jun 2008 09:38:16 +0000 (09:38 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 29 Jun 2008 09:38:16 +0000 (09:38 -0000)
it will be easier to add asynchronous support to doebuild() if it's called
this way.

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

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

index 6bafb5276f891f531ffc73316102c6ce26679be2..dc266ddb07b8b018532382ffad4154d98b5fc202 100644 (file)
@@ -1529,6 +1529,8 @@ class EbuildBuild(Task):
        """
        __slots__ = ("pkg", "settings")
 
+       _phases = ("setup", "unpack", "compile", "test", "install")
+
        def _get_hash_key(self):
                hash_key = getattr(self, "_hash_key", None)
                if hash_key is None:
@@ -1547,10 +1549,13 @@ class EbuildBuild(Task):
                if retval != os.EX_OK:
                        return retval
 
-               retval = portage.doebuild(ebuild_path, "install",
-                       root_config.root, self.settings, debug,
-                       mydbapi=portdb, tree="porttree")
-               return retval
+               for mydo in self._phases:
+                       retval = portage.doebuild(ebuild_path, mydo,
+                               root_config.root, self.settings, debug,
+                               mydbapi=portdb, tree="porttree")
+                       if retval != os.EX_OK:
+                               return retval
+               return os.EX_OK
 
 class EbuildBinpkg(Task):
        """
index e15e78ffdff0dba729071fdf067669564769b868..34f05d19c4575aced51b36791bcdf570e28e2f3f 100644 (file)
@@ -4161,7 +4161,8 @@ def digestcheck(myfiles, mysettings, strict=0, justmanifest=0):
 
 # parse actionmap to spawn ebuild with the appropriate args
 def spawnebuild(mydo,actionmap,mysettings,debug,alwaysdep=0,logfile=None):
-       if alwaysdep or "noauto" not in mysettings.features:
+       if "EMERGE_FROM" not in mysettings and \
+               (alwaysdep or "noauto" not in mysettings.features):
                # process dependency first
                if "dep" in actionmap[mydo]:
                        retval=spawnebuild(actionmap[mydo]["dep"],actionmap,mysettings,debug,alwaysdep=alwaysdep,logfile=logfile)
@@ -5298,7 +5299,8 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                # unpack compile install`, we will try and fetch 4 times :/
                need_distfiles = (mydo in ("fetch", "unpack") or \
                        mydo not in ("digest", "manifest") and "noauto" not in features)
-               if need_distfiles and not fetch(
+               if not ("EMERGE_FROM" in mysettings and mydo != "unpack") and \
+                       need_distfiles and not fetch(
                        fetchme, mysettings, listonly=listonly, fetchonly=fetchonly):
                        if have_build_dirs:
                                # Create an elog message for this fetch failure since the
@@ -5330,10 +5332,8 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                return 1
 
                # See above comment about fetching only when needed
-               if not digestcheck(checkme, mysettings, ("strict" in features),
-                       (mydo not in ["digest","fetch","unpack"] and \
-                       mysettings.get("PORTAGE_CALLER", None) == "ebuild" and \
-                       "noauto" in features)):
+               if not ("EMERGE_FROM" in mysettings and mydo != "unpack") and \
+                       not digestcheck(checkme, mysettings, "strict" in features):
                        return 1
 
                if mydo == "fetch":