* [PATCH] base.bbclass: Replace os.system with subprocess call.
@ 2009-08-24 2:31 Khem Raj
2009-08-24 3:12 ` Holger Hans Peter Freyther
2009-08-24 3:49 ` Holger Hans Peter Freyther
0 siblings, 2 replies; 8+ messages in thread
From: Khem Raj @ 2009-08-24 2:31 UTC (permalink / raw)
To: openembedded-devel
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 <raj.khem@gmail.com>
---
classes/base.bbclass | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 598a7bb..4e9b65c 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)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] base.bbclass: Replace os.system with subprocess call.
2009-08-24 2:31 [PATCH] base.bbclass: Replace os.system with subprocess call Khem Raj
@ 2009-08-24 3:12 ` Holger Hans Peter Freyther
2009-08-24 6:32 ` Khem Raj
2009-08-24 3:49 ` Holger Hans Peter Freyther
1 sibling, 1 reply; 8+ messages in thread
From: Holger Hans Peter Freyther @ 2009-08-24 3:12 UTC (permalink / raw)
To: openembedded-devel
On Monday 24 August 2009 04:31:41 Khem Raj wrote:
> This is based on the following python bug report.
> http://bugs.python.org/issue1652
What about giving credit to the guy on irc that:
- Pointed you to the gzip faq
- The launchpad ticket
- The blogpost
- And the above URL?
z.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] base.bbclass: Replace os.system with subprocess call.
2009-08-24 2:31 [PATCH] base.bbclass: Replace os.system with subprocess call Khem Raj
2009-08-24 3:12 ` Holger Hans Peter Freyther
@ 2009-08-24 3:49 ` Holger Hans Peter Freyther
2009-08-24 6:48 ` Michael 'Mickey' Lauer
2009-08-25 15:42 ` Richard Purdie
1 sibling, 2 replies; 8+ messages in thread
From: Holger Hans Peter Freyther @ 2009-08-24 3:49 UTC (permalink / raw)
To: openembedded-devel
On Monday 24 August 2009 04:31:41 Khem Raj wrote:
> 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 <raj.khem@gmail.com>
Acked-by: Holger Freyther <zecke@selfish.org>
> ---
> classes/base.bbclass | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/classes/base.bbclass b/classes/base.bbclass
> index 598a7bb..4e9b65c 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)
you don't need to import subprocess here...
>
> def oe_unpack_file(file, data, url = None):
> - import bb, os
> + import bb, os, signal, subprocess
no need for import signal...
> 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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] base.bbclass: Replace os.system with subprocess call.
2009-08-24 3:12 ` Holger Hans Peter Freyther
@ 2009-08-24 6:32 ` Khem Raj
0 siblings, 0 replies; 8+ messages in thread
From: Khem Raj @ 2009-08-24 6:32 UTC (permalink / raw)
To: openembedded-devel
On (24/08/09 05:12), Holger Hans Peter Freyther wrote:
> On Monday 24 August 2009 04:31:41 Khem Raj wrote:
>
> > This is based on the following python bug report.
> > http://bugs.python.org/issue1652
>
> What about giving credit to the guy on irc that:
indeed. I should edit the git emails before sending them out.
> - Pointed you to the gzip faq
> - The launchpad ticket
> - The blogpost
> - And the above URL?
All of above Zecke's courtesy :) I can put this in git log too before
pushing.
>
> z.
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] base.bbclass: Replace os.system with subprocess call.
2009-08-24 3:49 ` Holger Hans Peter Freyther
@ 2009-08-24 6:48 ` Michael 'Mickey' Lauer
2009-08-24 18:41 ` Khem Raj
2009-08-26 7:42 ` Khem Raj
2009-08-25 15:42 ` Richard Purdie
1 sibling, 2 replies; 8+ messages in thread
From: Michael 'Mickey' Lauer @ 2009-08-24 6:48 UTC (permalink / raw)
To: openembedded-devel
As a general reminder, please avoid import statements in functions. They're
just wasting cycles. Put them into global scope.
:M:
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] base.bbclass: Replace os.system with subprocess call.
2009-08-24 6:48 ` Michael 'Mickey' Lauer
@ 2009-08-24 18:41 ` Khem Raj
2009-08-26 7:42 ` Khem Raj
1 sibling, 0 replies; 8+ messages in thread
From: Khem Raj @ 2009-08-24 18:41 UTC (permalink / raw)
To: openembedded-devel
On Sun, Aug 23, 2009 at 11:48 PM, Michael 'Mickey'
Lauer<mickey@vanille-media.de> wrote:
> As a general reminder, please avoid import statements in functions. They're
> just wasting cycles. Put them into global scope.
OK. I will redo this part.
>
> :M:
>
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] base.bbclass: Replace os.system with subprocess call.
2009-08-24 3:49 ` Holger Hans Peter Freyther
2009-08-24 6:48 ` Michael 'Mickey' Lauer
@ 2009-08-25 15:42 ` Richard Purdie
1 sibling, 0 replies; 8+ messages in thread
From: Richard Purdie @ 2009-08-25 15:42 UTC (permalink / raw)
To: openembedded-devel
On Mon, 2009-08-24 at 05:49 +0200, Holger Hans Peter Freyther wrote:
> On Monday 24 August 2009 04:31:41 Khem Raj wrote:
> > 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 <raj.khem@gmail.com>
>
> Acked-by: Holger Freyther <zecke@selfish.org>
Thanks, I've been seeing reports of this and have just merged into
Poky! :)
Cheers,
Richard
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] base.bbclass: Replace os.system with subprocess call.
2009-08-24 6:48 ` Michael 'Mickey' Lauer
2009-08-24 18:41 ` Khem Raj
@ 2009-08-26 7:42 ` Khem Raj
1 sibling, 0 replies; 8+ messages in thread
From: Khem Raj @ 2009-08-26 7:42 UTC (permalink / raw)
To: openembedded-devel
On (24/08/09 08:48), Michael 'Mickey' Lauer wrote:
> As a general reminder, please avoid import statements in functions. They're
> just wasting cycles. Put them into global scope.
looking at base.bbclass I decided to leave it as it is to conform to
other functions coding style but may be we should move the import to
global scope at once sometime.
Thanks
-Khem
>
> :M:
>
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-08-26 8:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-24 2:31 [PATCH] base.bbclass: Replace os.system with subprocess call Khem Raj
2009-08-24 3:12 ` Holger Hans Peter Freyther
2009-08-24 6:32 ` Khem Raj
2009-08-24 3:49 ` Holger Hans Peter Freyther
2009-08-24 6:48 ` Michael 'Mickey' Lauer
2009-08-24 18:41 ` Khem Raj
2009-08-26 7:42 ` Khem Raj
2009-08-25 15:42 ` Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.