summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-06-09 09:19:33 -0700
committerZac Medico <zmedico@gentoo.org>2011-06-09 09:19:33 -0700
commitab6d03f3813318f9ba49e75a52d42972e14cdcc7 (patch)
tree809e911e7990385d3bb71d517fb257aebaa57a9c
parent88f5bf84e2fd23125910b2ecaffc035971445696 (diff)
downloadportage-ab6d03f3813318f9ba49e75a52d42972e14cdcc7.tar.gz
portage-ab6d03f3813318f9ba49e75a52d42972e14cdcc7.tar.bz2
portage-ab6d03f3813318f9ba49e75a52d42972e14cdcc7.zip
AbstractEbuildProcess: handle kill by signal
This will fix bug #368817.
-rw-r--r--pym/_emerge/AbstractEbuildProcess.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index 39c613bfe..434878887 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -181,6 +181,11 @@ class AbstractEbuildProcess(SpawnProcess):
return not ('sesandbox' in self.settings.features \
and self.settings.selinux_enabled()) or os.isatty(slave_fd)
+ def _killed_by_signal(self, signum):
+ msg = _("The ebuild phase '%s' has been "
+ "killed by signal %s.") % (self.phase, signum)
+ self._eerror(textwrap.wrap(msg, 72))
+
def _unexpected_exit(self):
phase = self.phase
@@ -243,14 +248,23 @@ class AbstractEbuildProcess(SpawnProcess):
if self._exit_command.exitcode is not None:
self.returncode = self._exit_command.exitcode
else:
- self.returncode = 1
- if not self.cancelled:
- self._unexpected_exit()
+ if self.returncode < 0:
+ if not self.cancelled:
+ self._killed_by_signal(-self.returncode)
+ else:
+ self.returncode = 1
+ if not self.cancelled:
+ self._unexpected_exit()
if self._build_dir is not None:
self._build_dir.unlock()
self._build_dir = None
elif not self.cancelled:
exit_file = self.settings.get('PORTAGE_EBUILD_EXIT_FILE')
if exit_file and not os.path.exists(exit_file):
- self.returncode = 1
- self._unexpected_exit()
+ if self.returncode < 0:
+ if not self.cancelled:
+ self._killed_by_signal(-self.returncode)
+ else:
+ self.returncode = 1
+ if not self.cancelled:
+ self._unexpected_exit()