Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r14517 - in main/trunk: bin man pym/_emerge pym/portage/dbapi
Date: Wed, 07 Oct 2009 23:30:07
Message-Id: E1MvfxN-0007iV-EF@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-10-07 23:30:04 +0000 (Wed, 07 Oct 2009)
3 New Revision: 14517
4
5 Modified:
6 main/trunk/bin/ebuild
7 main/trunk/man/make.conf.5
8 main/trunk/pym/_emerge/EbuildPhase.py
9 main/trunk/pym/portage/dbapi/vartree.py
10 Log:
11 Bug #287950 - Add support for FEATURES=fail-clean which is useful for cleaning
12 up temp files on tmpfs after build failures with --keep-going.
13
14
15 Modified: main/trunk/bin/ebuild
16 ===================================================================
17 --- main/trunk/bin/ebuild 2009-10-07 19:30:41 UTC (rev 14516)
18 +++ main/trunk/bin/ebuild 2009-10-07 23:30:04 UTC (rev 14517)
19 @@ -199,6 +199,11 @@
20 tmpsettings["FEATURES"] = " ".join(sorted(tmpsettings.features))
21 tmpsettings.backup_changes("FEATURES")
22
23 +if 'fail-clean' in tmpsettings.features:
24 + tmpsettings.features.remove('fail-clean')
25 + tmpsettings["FEATURES"] = " ".join(sorted(tmpsettings.features))
26 + tmpsettings.backup_changes("FEATURES")
27 +
28 if opts.skip_manifest:
29 tmpsettings["EBUILD_SKIP_MANIFEST"] = "1"
30 tmpsettings.backup_changes("EBUILD_SKIP_MANIFEST")
31
32 Modified: main/trunk/man/make.conf.5
33 ===================================================================
34 --- main/trunk/man/make.conf.5 2009-10-07 19:30:41 UTC (rev 14516)
35 +++ main/trunk/man/make.conf.5 2009-10-07 23:30:04 UTC (rev 14517)
36 @@ -213,6 +213,13 @@
37 Enable fakeroot for the install and package phases when a non-root user runs
38 the \fBebuild\fR(1) command.
39 .TP
40 +.B fail\-clean
41 +Clean up temporary files after a build failure. This is particularly useful
42 +if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
43 +probably also want to enable \fBPORT_LOGDIR\fR in order to save the build log.
44 +Both the \fBebuild\fR(1) command and the \fInoclean\fR feature cause the
45 +\fIfail\-clean\fR feature to be automatically disabled.
46 +.TP
47 .B fixpackages
48 Runs the script that will fix the dependencies in all binary packages. This is
49 run whenever packages are moved around in the portage tree. Please note that this
50
51 Modified: main/trunk/pym/_emerge/EbuildPhase.py
52 ===================================================================
53 --- main/trunk/pym/_emerge/EbuildPhase.py 2009-10-07 19:30:41 UTC (rev 14516)
54 +++ main/trunk/pym/_emerge/EbuildPhase.py 2009-10-07 23:30:04 UTC (rev 14517)
55 @@ -45,6 +45,11 @@
56 log_file.close()
57
58 if self._default_exit(ebuild_process) != os.EX_OK:
59 + if self.phase != 'clean' and \
60 + 'noclean' not in self.settings.features and \
61 + 'fail-clean' in self.settings.features:
62 + self._fail_clean()
63 + return
64 self.wait()
65 return
66
67 @@ -80,7 +85,27 @@
68 if self._final_exit(post_phase) != os.EX_OK:
69 writemsg("!!! post %s failed; exiting.\n" % self.phase,
70 noiselevel=-1)
71 + if self.phase != 'clean' and \
72 + 'noclean' not in self.settings.features and \
73 + 'fail-clean' in self.settings.features:
74 + self._fail_clean()
75 + return
76 self._current_task = None
77 self.wait()
78 return
79
80 + def _fail_clean(self):
81 + self.returncode = None
82 + portage.elog.elog_process(self.pkg.cpv, self.settings)
83 + phase = "clean"
84 + clean_phase = EbuildPhase(background=self.background,
85 + pkg=self.pkg, phase=phase,
86 + scheduler=self.scheduler, settings=self.settings,
87 + tree=self.tree)
88 + self._start_task(clean_phase, self._fail_clean_exit)
89 + return
90 +
91 + def _fail_clean_exit(self, clean_phase):
92 + self._final_exit(clean_phase)
93 + self.returncode = 1
94 + self.wait()
95
96 Modified: main/trunk/pym/portage/dbapi/vartree.py
97 ===================================================================
98 --- main/trunk/pym/portage/dbapi/vartree.py 2009-10-07 19:30:41 UTC (rev 14516)
99 +++ main/trunk/pym/portage/dbapi/vartree.py 2009-10-07 23:30:04 UTC (rev 14517)
100 @@ -4349,7 +4349,10 @@
101
102 # Process ebuild logfiles
103 elog_process(self.mycpv, self.settings, phasefilter=filter_mergephases)
104 - if retval == os.EX_OK and "noclean" not in self.settings.features:
105 + if 'noclean' not in self.settings.features and \
106 + (retval == os.EX_OK or \
107 + ('fail-clean' in self.settings.features and \
108 + os.path.isdir(self.settings['PORTAGE_BUILDDIR']))):
109 if myebuild is None:
110 myebuild = os.path.join(inforoot, self.pkg + ".ebuild")