]> code.ossystems Code Review - openembedded-core.git/commitdiff
base.bbclass: Use subprocess rather than os.system for do_unpack
authorRichard Purdie <rpurdie@linux.intel.com>
Tue, 25 Aug 2009 15:37:50 +0000 (16:37 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 25 Aug 2009 15:37:50 +0000 (16:37 +0100)
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 <raj.khem@gmail.com> and Holger Freyther <zecke@selfish.org>

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
meta/classes/base.bbclass

index 3704cce01a27ef6e0828023b17a3e720aad82059..4f1e2dd788fe31a3b8f9da6a8accf54c9d3cf00a 100644 (file)
@@ -627,8 +627,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(".")
@@ -694,7 +702,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)