From: Zac Medico Date: Thu, 12 Aug 2010 12:56:22 +0000 (-0700) Subject: Factor EBUILD_EXIT_STATUS_FILE code out of AbstractEbuildProcess X-Git-Tag: v2.2_rc68~259 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a4589f44d8da96dc83131910aeb60b5ea62ec40f;p=portage.git Factor EBUILD_EXIT_STATUS_FILE code out of AbstractEbuildProcess subclasses and into AbstractEbuildProcess itself. --- diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index 302d34403..f4a87f68b 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -3,12 +3,16 @@ from _emerge.SpawnProcess import SpawnProcess import portage +portage.proxy.lazyimport.lazyimport(globals(), + 'portage.package.ebuild.doebuild:_doebuild_exit_status_check_and_log' +) from portage import os from portage.util._pty import _create_pty_or_pipe class AbstractEbuildProcess(SpawnProcess): __slots__ = ('settings',) + _phases_without_builddir = ('clean', 'cleanrm', 'depend', 'help',) def _pipe(self, fd_pipes): stdout_pipe = fd_pipes.get(1) @@ -22,3 +26,12 @@ class AbstractEbuildProcess(SpawnProcess): # See Bug #162404. return not ('sesandbox' in self.settings.features \ and self.settings.selinux_enabled()) or os.isatty(slave_fd) + + def _set_returncode(self, wait_retval): + SpawnProcess._set_returncode(self, wait_retval) + phase = self.settings.get("EBUILD_PHASE") + if not phase: + phase = 'other' + if phase not in self._phases_without_builddir: + self.returncode = _doebuild_exit_status_check_and_log( + self.settings, phase, self.returncode) diff --git a/pym/_emerge/EbuildProcess.py b/pym/_emerge/EbuildProcess.py index a0ef2357a..147f73a16 100644 --- a/pym/_emerge/EbuildProcess.py +++ b/pym/_emerge/EbuildProcess.py @@ -4,7 +4,7 @@ from _emerge.AbstractEbuildProcess import AbstractEbuildProcess from portage import os from portage.package.ebuild.doebuild import doebuild, \ - _doebuild_exit_status_check_and_log, _post_phase_userpriv_perms + _post_phase_userpriv_perms class EbuildProcess(AbstractEbuildProcess): @@ -38,10 +38,6 @@ class EbuildProcess(AbstractEbuildProcess): def _set_returncode(self, wait_retval): AbstractEbuildProcess._set_returncode(self, wait_retval) - if self.phase not in ("clean", "cleanrm"): - self.returncode = _doebuild_exit_status_check_and_log( - self.settings, self.phase, self.returncode) - if self.phase == "test" and self.returncode != os.EX_OK and \ "test-fail-continue" in self.settings.features: self.returncode = os.EX_OK diff --git a/pym/_emerge/EbuildSpawnProcess.py b/pym/_emerge/EbuildSpawnProcess.py index 36ec0a0c9..d8087576a 100644 --- a/pym/_emerge/EbuildSpawnProcess.py +++ b/pym/_emerge/EbuildSpawnProcess.py @@ -4,30 +4,15 @@ from _emerge.AbstractEbuildProcess import AbstractEbuildProcess import portage from portage import os -portage.proxy.lazyimport.lazyimport(globals(), - 'portage.package.ebuild.doebuild:_doebuild_exit_status_check_and_log' -) class EbuildSpawnProcess(AbstractEbuildProcess): """ - Spawns misc-functions.sh with an existing ebuild environment. + Used by doebuild.spawn() to manage the spawned process. """ _spawn_kwarg_names = AbstractEbuildProcess._spawn_kwarg_names + \ ('fakeroot_state',) __slots__ = ('fakeroot_state', 'spawn_func') - def _start(self): - - AbstractEbuildProcess._start(self) - def _spawn(self, args, **kwargs): return self.spawn_func(args, **kwargs) - - def _set_returncode(self, wait_retval): - AbstractEbuildProcess._set_returncode(self, wait_retval) - phase = self.settings.get("EBUILD_PHASE") - if not phase: - phase = 'other' - self.returncode = _doebuild_exit_status_check_and_log( - self.settings, phase, self.returncode) diff --git a/pym/_emerge/MiscFunctionsProcess.py b/pym/_emerge/MiscFunctionsProcess.py index 8d137afe1..bc70448d0 100644 --- a/pym/_emerge/MiscFunctionsProcess.py +++ b/pym/_emerge/MiscFunctionsProcess.py @@ -4,8 +4,7 @@ from _emerge.AbstractEbuildProcess import AbstractEbuildProcess import portage from portage import os -from portage.package.ebuild.doebuild import spawn, \ - _doebuild_exit_status_check_and_log +from portage.package.ebuild.doebuild import spawn class MiscFunctionsProcess(AbstractEbuildProcess): """ @@ -31,9 +30,3 @@ class MiscFunctionsProcess(AbstractEbuildProcess): debug = settings.get("PORTAGE_DEBUG") == "1" return spawn(" ".join(args), settings, debug=debug, **kwargs) - - def _set_returncode(self, wait_retval): - AbstractEbuildProcess._set_returncode(self, wait_retval) - self.returncode = _doebuild_exit_status_check_and_log( - self.settings, self.phase, self.returncode) - diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 19997d785..61eea40ee 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1173,7 +1173,7 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero mysettings["PORTAGE_SANDBOX_T"]) phase = env.get('EBUILD_PHASE') - if phase not in ('clean', 'cleanrm', 'depend', 'help',): + if phase not in EbuildSpawnProcess._phases_without_builddir: # Don't try to unlink for phases that don't require # PORTAGE_BUILDDIR, since the directory may not # even belong to this process in that case.