summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/AbstractEbuildProcess.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-07 15:18:33 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-07 15:18:33 -0700
commit80f05f892db11ece3cdfec0c267307652e0b7502 (patch)
tree0de6f6519cbb1b151e3b0ef799f7092a6641d57d /pym/_emerge/AbstractEbuildProcess.py
parentf74439e66eb93d218c16f0936b9c2f1938752aa5 (diff)
downloadportage-80f05f892db11ece3cdfec0c267307652e0b7502.tar.gz
portage-80f05f892db11ece3cdfec0c267307652e0b7502.tar.bz2
portage-80f05f892db11ece3cdfec0c267307652e0b7502.zip
Move the stale elog cleanup code from _doebuild_spawn() to
AbstractEbuildProcess._start() since that's a better place if we decide to use phase_completed_file skip the spawning of bash (dyn_unpack automatic clean/re-unpack logic could be migrated here too).
Diffstat (limited to 'pym/_emerge/AbstractEbuildProcess.py')
-rw-r--r--pym/_emerge/AbstractEbuildProcess.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index 39c8c5683..a74a39437 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -44,10 +44,12 @@ class AbstractEbuildProcess(SpawnProcess):
def _start(self):
+ need_builddir = self.phase not in self._phases_without_builddir
+
# This can happen if the pre-clean phase triggers
# die_hooks for some reason, and PORTAGE_BUILDDIR
# doesn't exist yet.
- if self.phase not in self._phases_without_builddir and \
+ if need_builddir and \
not os.path.isdir(self.settings['PORTAGE_BUILDDIR']):
msg = _("The ebuild phase '%s' has been aborted "
"since PORTAGE_BUILDIR does not exist: '%s'") % \
@@ -57,6 +59,20 @@ class AbstractEbuildProcess(SpawnProcess):
self.wait()
return
+ if need_builddir:
+ phase_completed_file = os.path.join(
+ self.settings['PORTAGE_BUILDDIR'],
+ ".%sed" % self.phase.rstrip('e'))
+ if not os.path.exists(phase_completed_file):
+ # If the phase is really going to run then we want
+ # to eliminate any stale elog messages that may
+ # exist from a previous run.
+ try:
+ os.unlink(os.path.join(self.settings['T'],
+ 'logging', self.phase))
+ except OSError:
+ pass
+
if self.background:
# Automatically prevent color codes from showing up in logs,
# since we're not displaying to a terminal anyway.