Patchwork icecc: Use bb.utils.which instead of calling which

login
register
mail settings
Submitter Tobias Henkel
Date Nov. 15, 2013, 7:36 a.m.
Message ID <1384501001-8070-1-git-send-email-tobias.henkel@oss.bmw-carit.de>
Download mbox | patch
Permalink /patch/61759/
State New
Headers show

Comments

Tobias Henkel - Nov. 15, 2013, 7:36 a.m.
From: Tobias Henkel <tobias.henkel@bmw-carit.de>

The icecc class often calls 'which' for determining paths. This leads
to many messages on stderr in case 'which' doesn't find the
executable. Using bb.utils.which is more appropriate here and doesn't
pollute stderr.

Signed-off-by: Tobias Henkel <tobias.henkel@bmw-carit.de>
---
 meta/classes/icecc.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 1f53f85..49dbd77 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -55,7 +55,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 bb.utils.which(os.getenv("PATH"), "icecc")
 
 def create_path(compilers, bb, d):
     """
@@ -175,9 +175,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 bb.utils.which(os.getenv("PATH"), tool)
     elif icc_is_kernel(bb, d):
-        return os.popen("which %s" % get_cross_kernel_cc(bb, d)).read()[:-1]
+        return bb.utils.which(os.getenv("PATH"), get_cross_kernel_cc(bb, d))
     else:
         ice_dir = d.expand('${STAGING_BINDIR_TOOLCHAIN}')
         target_sys = d.expand('${TARGET_SYS}')