@@ -13,7 +13,6 @@ BitBake build tools.
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
import os, re
-import signal
import logging
import urllib.request, urllib.parse, urllib.error
if 'git' not in urllib.parse.uses_netloc:
@@ -780,12 +779,6 @@ def update_stamp(ud, d):
bb.utils.remove(ud.donestamp)
raise
-def subprocess_setup():
- # Python installs a SIGPIPE handler by default. This is usually not what
- # non-Python subprocesses expect.
- # SIGPIPE errors are known issues with gzip/bash
- signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-
def mark_recipe_nocache(d):
if d.getVar('BB_SRCREV_POLICY') != "cache":
d.setVar('BB_DONT_CACHE', '1')
@@ -1553,9 +1546,9 @@ class FetchMethod(object):
def _run(cmd):
if isinstance(cmd, str):
- ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True, cwd=unpackdir, env=env)
+ ret = subprocess.call(cmd, shell=True, cwd=unpackdir, env=env)
else:
- ret = subprocess.call(cmd, preexec_fn=subprocess_setup, cwd=unpackdir, env=env)
+ ret = subprocess.call(cmd, cwd=unpackdir, env=env)
if ret != 0:
raise UnpackError("Unpack command %s failed with return value %s" % (cmd, ret), urldata.url)
@@ -1618,7 +1611,7 @@ class FetchMethod(object):
else:
cmd = 'rpm2cpio.sh %s | cpio --no-absolute-filenames -id' % (file)
elif file.endswith('.deb') or file.endswith('.ipk'):
- output = subprocess.check_output(['ar', '-t', file], preexec_fn=subprocess_setup, env=env)
+ output = subprocess.check_output(['ar', '-t', file], env=env)
datafile = None
valid_datafiles = ('data.tar', 'data.tar.gz', 'data.tar.xz',
'data.tar.zst', 'data.tar.bz2', 'data.tar.lzma')
@@ -26,7 +26,7 @@ import subprocess
import re
from functools import cmp_to_key
import bb
-from bb.fetch import logger, subprocess_setup, UnpackError, runfetchcmd
+from bb.fetch import logger, UnpackError, runfetchcmd
from bb.fetch.wget import Wget
@@ -70,7 +70,6 @@ import bb
from bb.fetch import FetchError
from bb.fetch import MissingParameterError
from bb.fetch import runfetchcmd
-from bb.fetch import subprocess_setup
from bb.fetch.git import Git
from bb.fetch.wget import Wget
@@ -267,8 +266,7 @@ class GoModGit(Git):
f = os.path.join(ud.parm['subpath'], f)
if f in files:
cmd = ['git', 'cat-file', 'blob', srcrev + ':' + f]
- subprocess.check_call(cmd, stdout=mf, cwd=repodir,
- preexec_fn=subprocess_setup)
+ subprocess.check_call(cmd, stdout=mf, cwd=repodir)
else:
# If the module does not have a go.mod file, synthesize one
# containing only a module statement.
@@ -281,6 +279,5 @@ class GoModGit(Git):
prefix = module + '@' + version + '/'
for f in files:
cmd = ['git', 'cat-file', 'blob', srcrev + ':' + f]
- data = subprocess.check_output(cmd, cwd=repodir,
- preexec_fn=subprocess_setup)
+ data = subprocess.check_output(cmd, cwd=repodir)
zf.writestr(prefix + f, data)
@@ -5,7 +5,6 @@
#
import logging
-import signal
import subprocess
import errno
import select
@@ -13,11 +12,6 @@ import bb
logger = logging.getLogger('BitBake.Process')
-def subprocess_setup():
- # Python installs a SIGPIPE handler by default. This is usually not what
- # non-Python subprocesses expect.
- signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-
class CmdError(RuntimeError):
def __init__(self, command, msg=None):
self.command = command
@@ -60,7 +54,6 @@ class ExecutionError(CmdError):
class Popen(subprocess.Popen):
defaults = {
"close_fds": True,
- "preexec_fn": subprocess_setup,
"stdout": subprocess.PIPE,
"stderr": subprocess.PIPE,
"stdin": subprocess.PIPE,
Since Python 3.2, the subprocess.Popen() constructor has had a "restore_signals" parameter defaulting to True: If restore_signals is True (the default) all signals that Python has set to SIG_IGN are restored to SIG_DFL in the child process before the exec. Currently this includes the SIGPIPE, SIGXFZ and SIGXFSZ signals. So ever since bitbake's minimal supported Python version was bumped to 3.4 in 710351610 ("lib/bb: Set required python 3 version to 3.4.0"), this subprocess_setup has been redundant. Signed-off-by: Rasmus Villemoes <ravi@prevas.dk> --- lib/bb/fetch/__init__.py | 13 +++---------- lib/bb/fetch/crate.py | 2 +- lib/bb/fetch/gomod.py | 7 ++----- lib/bb/process.py | 7 ------- 4 files changed, 6 insertions(+), 23 deletions(-)