Patchwork [2/9] icecc: Remove output on stderr when calling which

login
register
mail settings
Submitter Tobias Henkel
Date Nov. 12, 2013, 8:33 a.m.
Message ID <1384245243-20247-3-git-send-email-tobias.henkel@oss.bmw-carit.de>
Download mbox | patch
Permalink /patch/61473/
State New
Headers show

Comments

Tobias Henkel - Nov. 12, 2013, 8:33 a.m.
From: Tobias Henkel <tobias.henkel@bmw-carit.de>

The icecc class often uses 'which' for determining paths. This leads
to many messages on stderr in case 'which' doesn't find the
executable. Redirecting stderr to /dev/null inhibits these messages as
the result is handled correctly anyway.

Signed-off-by: Tobias Henkel <tobias.henkel@bmw-carit.de>
---
 meta/classes/icecc.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Enrico Scholz - Nov. 12, 2013, 11:04 a.m.
Tobias Henkel <tobias.henkel-Y0tyK2LzuKvpgbXj0Ix11Q@public.gmane.org>
writes:

> -    return d.getVar('ICECC_PATH') or os.popen("which icecc").read()[:-1]
> +    return d.getVar('ICECC_PATH') or os.popen("which icecc 2> /dev/null").read()[:-1]
                                        ~~~~~~~~~~~~~~~~~~~~~~

I think, this can/should be replaced by

  bb.utils.which(os.getenv("PATH"), "icecc")

Ditto the other locations.


Enrico
Tobias Henkel - Nov. 13, 2013, 6:11 a.m.
On 11/12/2013 12:04 PM, Enrico Scholz wrote:
> -    return d.getVar('ICECC_PATH') or os.popen("which icecc").read()[:-1]
> +    return d.getVar('ICECC_PATH') or os.popen("which icecc 2> /dev/null").read()[:-1]
>                                          ~~~~~~~~~~~~~~~~~~~~~~
>
> I think, this can/should be replaced by
>
>    bb.utils.which(os.getenv("PATH"), "icecc")
>
> Ditto the other locations.
Thank you for this point. I'll post this as a new patch as the other 
patches of this patch series already seem to be in master.

Best regards
Tobias

Patch

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 71c556f..c4088af 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -48,7 +48,7 @@  def get_cross_kernel_cc(bb,d):
     return kernel_cc
 
 def get_icecc(d):
-    return d.getVar('ICECC_PATH') or os.popen("which icecc").read()[:-1]
+    return d.getVar('ICECC_PATH') or os.popen("which icecc 2> /dev/null").read()[:-1]
 
 def create_path(compilers, bb, d):
     """
@@ -161,9 +161,9 @@  def icc_get_external_tool(bb, d, tool):
 
 def icc_get_tool(bb, d, tool):
     if icc_is_native(bb, d):
-        return os.popen("which %s" % tool).read()[:-1]
+        return os.popen("which %s 2> /dev/null" % tool).read()[:-1]
     elif icc_is_kernel(bb, d):
-        return os.popen("which %s" % get_cross_kernel_cc(bb, d)).read()[:-1]
+        return os.popen("which %s 2> /dev/null" % get_cross_kernel_cc(bb, d)).read()[:-1]
     else:
         ice_dir = d.expand('${STAGING_BINDIR_TOOLCHAIN}')
         target_sys = d.expand('${TARGET_SYS}')