From f73c64e7295be1e1065f898b49f50a02e812161c Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 23 Aug 2009 19:24:57 -0700 Subject: base.bbclass: Replace os.system with subprocess call. Often gzip is reporting broken pipe errors with do_unpack of tar.gz files. If you use the commands described above to extract a tar.gz file, gzip sometimes emits a Broken pipe error message. This can safely be ignored if tar extracted all files without any other error message. We do not let python install its SIGPIPE handler and use subprocess call to invoke the command. This is based on the following python bug report. http://bugs.python.org/issue1652 Signed-off-by: Khem Raj --- classes/base.bbclass | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 598a7bb77f..4e9b65c285 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -728,9 +728,14 @@ base_do_buildall() { : } +def subprocess_setup(): + import signal, subprocess + # Python installs a SIGPIPE handler by default. This is usually not what + # non-Python subprocesses expect. + signal.signal(signal.SIGPIPE, signal.SIG_DFL) def oe_unpack_file(file, data, url = None): - import bb, os + import bb, os, signal, subprocess if not url: url = "file://%s" % file dots = file.split(".") @@ -799,7 +804,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/" % (base_path_out(file, data), base_path_out(os.getcwd(), data))) - ret = os.system(cmd) + ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) os.chdir(save_cwd) -- cgit v1.2.3 From af56cd467bcc76f5499199fb1f14252abe1e1e2a Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 26 Aug 2009 00:38:30 -0700 Subject: base.bbclass: Remove redundant import of subprocess and signal. Signed-off-by: Khem Raj --- classes/base.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 4e9b65c285..a350b38850 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -729,13 +729,13 @@ base_do_buildall() { } def subprocess_setup(): - import signal, subprocess + import signal # Python installs a SIGPIPE handler by default. This is usually not what # non-Python subprocesses expect. signal.signal(signal.SIGPIPE, signal.SIG_DFL) def oe_unpack_file(file, data, url = None): - import bb, os, signal, subprocess + import bb, os, subprocess if not url: url = "file://%s" % file dots = file.split(".") -- cgit v1.2.3 From 4cd5e9101dbefdefa183e4103989819893b2ffea Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Wed, 26 Aug 2009 15:31:03 -0700 Subject: base.bbclass: add cleanall task. Can be particularly useful when using multiple srctree recipes. Signed-off-by: Chris Larson --- classes/base.bbclass | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index a350b38850..97ccf5dfc3 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -523,6 +523,12 @@ python base_do_clean() { os.system('rm -f '+ dir) } +python do_cleanall() { + pass +} +do_cleanall[recrdeptask] = "do_clean" +addtask cleanall after do_clean + #Uncomment this for bitbake 1.8.12 #addtask rebuild after do_${BB_DEFAULT_TASK} addtask rebuild -- cgit v1.2.3