Move code from EbuildProcess to EbuildPhase.
authorZac Medico <zmedico@gentoo.org>
Thu, 19 Aug 2010 08:58:27 +0000 (01:58 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 19 Aug 2010 08:58:27 +0000 (01:58 -0700)
pym/_emerge/EbuildPhase.py
pym/_emerge/EbuildProcess.py

index 98372eaf25e8be42a9116c3dbcf42a82c19f2431..7fbc668493b3154ee3d453dae040547de078c1d6 100644 (file)
@@ -9,7 +9,8 @@ from portage.util import writemsg, writemsg_stdout
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
        'portage.package.ebuild.doebuild:_check_build_log,' + \
-               '_post_phase_cmds,_post_src_install_chost_fix,' + \
+               '_post_phase_cmds,_post_phase_userpriv_perms,' + \
+               '_post_src_install_chost_fix,' + \
                '_post_src_install_uid_fix'
 )
 from portage import os
@@ -45,8 +46,15 @@ class EbuildPhase(CompositeTask):
 
        def _start_ebuild(self):
 
+               # Don't open the log file during the clean phase since the
+               # open file can result in an nfs lock on $T/build.log which
+               # prevents the clean phase from removing $T.
+               logfile = self.settings.get("PORTAGE_LOG_FILE")
+               if self.phase in ("clean", "cleanrm"):
+                       logfile = None
+
                ebuild_process = EbuildProcess(actionmap=self.actionmap,
-                       background=self.background,
+                       background=self.background, logfile=logfile,
                        phase=self.phase, scheduler=self.scheduler,
                        settings=self.settings)
 
@@ -54,6 +62,17 @@ class EbuildPhase(CompositeTask):
 
        def _ebuild_exit(self, ebuild_process):
 
+               fail = False
+               if self._default_exit(ebuild_process) != os.EX_OK:
+                       if self.phase == "test" and \
+                               "test-fail-continue" in self.settings.features:
+                               pass
+                       else:
+                               fail = True
+
+               if not fail:
+                       self.returncode = None
+
                if self.phase == "install":
                        out = portage.StringIO()
                        log_path = self.settings.get("PORTAGE_LOG_FILE")
@@ -75,11 +94,12 @@ class EbuildPhase(CompositeTask):
                                if log_file is not None:
                                        log_file.close()
 
-               if self._default_exit(ebuild_process) != os.EX_OK:
+               if fail:
                        self._die_hooks()
                        return
 
                settings = self.settings
+               _post_phase_userpriv_perms(settings)
 
                if self.phase == "install":
                        out = portage.StringIO()
index 5ddbc68cc1ecff3301ef2d7f31be68027e94a0f3..ce97aff0f3c813fb73bc4f515634ec4e63a67df3 100644 (file)
@@ -4,23 +4,13 @@
 from _emerge.AbstractEbuildProcess import AbstractEbuildProcess
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
-       'portage.package.ebuild.doebuild:_post_phase_userpriv_perms,' + \
-               '_spawn_actionmap,_doebuild_spawn'
+       'portage.package.ebuild.doebuild:_doebuild_spawn,_spawn_actionmap'
 )
-from portage import os
 
 class EbuildProcess(AbstractEbuildProcess):
 
        __slots__ = ('actionmap',)
 
-       def _start(self):
-               # Don't open the log file during the clean phase since the
-               # open file can result in an nfs lock on $T/build.log which
-               # prevents the clean phase from removing $T.
-               if self.phase not in ("clean", "cleanrm"):
-                       self.logfile = self.settings.get("PORTAGE_LOG_FILE")
-               AbstractEbuildProcess._start(self)
-
        def _spawn(self, args, **kwargs):
 
                actionmap = self.actionmap
@@ -29,13 +19,3 @@ class EbuildProcess(AbstractEbuildProcess):
 
                return _doebuild_spawn(self.phase, self.settings,
                                actionmap=actionmap, **kwargs)
-
-       def _set_returncode(self, wait_retval):
-               AbstractEbuildProcess._set_returncode(self, wait_retval)
-
-               if self.phase == "test" and self.returncode != os.EX_OK and \
-                       "test-fail-continue" in self.settings.features:
-                       self.returncode = os.EX_OK
-
-               _post_phase_userpriv_perms(self.settings)
-