up temp files on tmpfs after build failures with --keep-going.
svn path=/main/trunk/; revision=14517
tmpsettings["FEATURES"] = " ".join(sorted(tmpsettings.features))
tmpsettings.backup_changes("FEATURES")
+if 'fail-clean' in tmpsettings.features:
+ tmpsettings.features.remove('fail-clean')
+ tmpsettings["FEATURES"] = " ".join(sorted(tmpsettings.features))
+ tmpsettings.backup_changes("FEATURES")
+
if opts.skip_manifest:
tmpsettings["EBUILD_SKIP_MANIFEST"] = "1"
tmpsettings.backup_changes("EBUILD_SKIP_MANIFEST")
Enable fakeroot for the install and package phases when a non-root user runs
the \fBebuild\fR(1) command.
.TP
+.B fail\-clean
+Clean up temporary files after a build failure. This is particularly useful
+if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
+probably also want to enable \fBPORT_LOGDIR\fR in order to save the build log.
+Both the \fBebuild\fR(1) command and the \fInoclean\fR feature cause the
+\fIfail\-clean\fR feature to be automatically disabled.
+.TP
.B fixpackages
Runs the script that will fix the dependencies in all binary packages. This is
run whenever packages are moved around in the portage tree. Please note that this
log_file.close()
if self._default_exit(ebuild_process) != os.EX_OK:
+ if self.phase != 'clean' and \
+ 'noclean' not in self.settings.features and \
+ 'fail-clean' in self.settings.features:
+ self._fail_clean()
+ return
self.wait()
return
if self._final_exit(post_phase) != os.EX_OK:
writemsg("!!! post %s failed; exiting.\n" % self.phase,
noiselevel=-1)
+ if self.phase != 'clean' and \
+ 'noclean' not in self.settings.features and \
+ 'fail-clean' in self.settings.features:
+ self._fail_clean()
+ return
self._current_task = None
self.wait()
return
+ def _fail_clean(self):
+ self.returncode = None
+ portage.elog.elog_process(self.pkg.cpv, self.settings)
+ phase = "clean"
+ clean_phase = EbuildPhase(background=self.background,
+ pkg=self.pkg, phase=phase,
+ scheduler=self.scheduler, settings=self.settings,
+ tree=self.tree)
+ self._start_task(clean_phase, self._fail_clean_exit)
+ return
+
+ def _fail_clean_exit(self, clean_phase):
+ self._final_exit(clean_phase)
+ self.returncode = 1
+ self.wait()
# Process ebuild logfiles
elog_process(self.mycpv, self.settings, phasefilter=filter_mergephases)
- if retval == os.EX_OK and "noclean" not in self.settings.features:
+ if 'noclean' not in self.settings.features and \
+ (retval == os.EX_OK or \
+ ('fail-clean' in self.settings.features and \
+ os.path.isdir(self.settings['PORTAGE_BUILDDIR']))):
if myebuild is None:
myebuild = os.path.join(inforoot, self.pkg + ".ebuild")