In AbstractEbuildProcess._start(), verify that PORTAGE_BUILDIR
authorZac Medico <zmedico@gentoo.org>
Sun, 5 Sep 2010 06:23:54 +0000 (23:23 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 5 Sep 2010 06:23:54 +0000 (23:23 -0700)
exists and bail out if necessary.

pym/_emerge/AbstractEbuildProcess.py

index 61cd02fd8c3167546001d607fb05327c3408b1b5..28e783e08e9cc54611245156e350386a7ff5e249 100644 (file)
@@ -44,6 +44,19 @@ class AbstractEbuildProcess(SpawnProcess):
 
        def _start(self):
 
+               # 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 \
+                       not os.path.isdir(self.settings['PORTAGE_BUILDDIR']):
+                       msg = _("The ebuild phase '%s' has been aborted "
+                       "since PORTAGE_BUILDIR does not exist: '%s'") % \
+                       (self.phase, self.settings['PORTAGE_BUILDDIR'])
+                       self._eerror(textwrap.wrap(msg, 72))
+                       self._set_returncode((self.pid, 1))
+                       self.wait()
+                       return
+
                if self.background:
                        # Automatically prevent color codes from showing up in logs,
                        # since we're not displaying to a terminal anyway.