From 740db4716059036777b1bae6465fd2e60e58204b Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 25 Aug 2009 16:37:50 +0100 Subject: base.bbclass: Use subprocess rather than os.system for do_unpack gzip reports broken pipe errors with do_unpack on Fedora with certain builds of gzip and bash. By avoding python's SIGPIPE handler we can work correctly on these distributions. Patch based on a patch from the OE-devel mailing list, thanks to Khem Raj and Holger Freyther Signed-off-by: Richard Purdie --- meta/classes/base.bbclass | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index af9da505cf..04cb51d026 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -526,8 +526,16 @@ base_do_buildall() { } + +def subprocess_setup(): + import signal + # 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 oe_unpack_file(file, data, url = None): - import bb, os + import bb, os, subprocess if not url: url = "file://%s" % file dots = file.split(".") @@ -593,7 +601,7 @@ def oe_unpack_file(file, data, url = None): cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) bb.note("Unpacking %s to %s/" % (file, os.getcwd())) - ret = os.system(cmd) + ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) os.chdir(save_cwd) -- cgit v1.2.3-54-g00ecf