summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-25 18:26:15 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-25 18:26:15 -0700
commit07de48f66fc63bb747111af4ae6ad8fe53e9fe26 (patch)
tree2264d62f0b3be033a14aff1b4b578fe53b6bc30d /pym
parentfb502ea2ad6bd0445b9e0266a862a106b35dbc34 (diff)
downloadportage-07de48f66fc63bb747111af4ae6ad8fe53e9fe26.tar.gz
portage-07de48f66fc63bb747111af4ae6ad8fe53e9fe26.tar.bz2
portage-07de48f66fc63bb747111af4ae6ad8fe53e9fe26.zip
Use a PORTAGE_SIGPIPE_STATUS variable to export 128 + SIGPIPE to the
ebuild environment. SIGPIPE is typically 13, but its better not to assume that.
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/BinpkgExtractorAsync.py7
-rw-r--r--pym/portage/package/ebuild/doebuild.py6
2 files changed, 10 insertions, 3 deletions
diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py
index 3a2654ec1..a2bbe7a45 100644
--- a/pym/_emerge/BinpkgExtractorAsync.py
+++ b/pym/_emerge/BinpkgExtractorAsync.py
@@ -1,9 +1,10 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.SpawnProcess import SpawnProcess
import portage
import os
+import signal
class BinpkgExtractorAsync(SpawnProcess):
@@ -12,12 +13,12 @@ class BinpkgExtractorAsync(SpawnProcess):
_shell_binary = portage.const.BASH_BINARY
def _start(self):
- # SIGPIPE handling (status 141) should be compatible with
+ # SIGPIPE handling (128 + SIGPIPE) should be compatible with
# assert_sigpipe_ok() that's used by the ebuild unpack() helper.
self.args = [self._shell_binary, "-c",
("bzip2 -dqc -- %s | tar -xp -C %s -f - ; " + \
"p=(${PIPESTATUS[@]}) ; " + \
- "if [[ ${p[0]} != 0 && ${p[0]} != 141 ]] ; then " + \
+ "if [[ ${p[0]} != 0 && ${p[0]} != %d ]] ; then " % (128 + signal.SIGPIPE) + \
"echo bzip2 failed with status ${p[0]} ; exit ${p[0]} ; fi ; " + \
"if [ ${p[1]} != 0 ] ; then " + \
"echo tar failed with status ${p[1]} ; exit ${p[1]} ; fi ; " + \
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index c33cb9a5d..1e8da8a01 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -11,6 +11,7 @@ import logging
import os as _os
import re
import shutil
+import signal
import stat
import sys
import tempfile
@@ -177,6 +178,11 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
# Set requested Python interpreter for Portage helpers.
mysettings['PORTAGE_PYTHON'] = portage._python_interpreter
+ # This is used by assert_sigpipe_ok() that's used by the ebuild
+ # unpack() helper. SIGPIPE is typically 13, but its better not
+ # to assume that.
+ mysettings['PORTAGE_SIGPIPE_STATUS'] = str(128 + signal.SIGPIPE)
+
# We are disabling user-specific bashrc files.
mysettings["BASH_ENV"] = INVALID_ENV_FILE