diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-08-25 16:37:50 +0100 |
---|---|---|
committer | Marcin Juszkiewicz <marcin@buglabs.net> | 2009-11-03 13:09:28 +0100 |
commit | 740db4716059036777b1bae6465fd2e60e58204b (patch) | |
tree | a63297eee4f6b2d8b1839a8048cb234b1815b6e7 /meta/classes | |
parent | 39bb1e9235e7373dad9afa30fda792c0581826a4 (diff) | |
download | poky-740db4716059036777b1bae6465fd2e60e58204b.tar.gz |
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 <raj.khem@gmail.com> and Holger Freyther <zecke@selfish.org>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/base.bbclass | 12 |
1 files 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() { | |||
526 | } | 526 | } |
527 | 527 | ||
528 | 528 | ||
529 | |||
530 | def subprocess_setup(): | ||
531 | import signal | ||
532 | # Python installs a SIGPIPE handler by default. This is usually not what | ||
533 | # non-Python subprocesses expect. | ||
534 | # SIGPIPE errors are known issues with gzip/bash | ||
535 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) | ||
536 | |||
529 | def oe_unpack_file(file, data, url = None): | 537 | def oe_unpack_file(file, data, url = None): |
530 | import bb, os | 538 | import bb, os, subprocess |
531 | if not url: | 539 | if not url: |
532 | url = "file://%s" % file | 540 | url = "file://%s" % file |
533 | dots = file.split(".") | 541 | dots = file.split(".") |
@@ -593,7 +601,7 @@ def oe_unpack_file(file, data, url = None): | |||
593 | 601 | ||
594 | cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) | 602 | cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) |
595 | bb.note("Unpacking %s to %s/" % (file, os.getcwd())) | 603 | bb.note("Unpacking %s to %s/" % (file, os.getcwd())) |
596 | ret = os.system(cmd) | 604 | ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) |
597 | 605 | ||
598 | os.chdir(save_cwd) | 606 | os.chdir(save_cwd) |
599 | 607 | ||