Patchwork [7/9] icecc: Support shell evaluation of KERNEL_CC

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

Comments

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

In the current implementation a KERNEL_CC variable containing shell
evaluation breaks the build process. Shell expansion is not happening
before general expansion in get_cross_kernel_cc which results in a
syntax error and an aborted parse process.

Before expanding the KERNEL_CC variable get_cross_kernel_cc now checks
for backticks or '$(' in the KERNEL_CC variable and performs a shell
evaluation using a call to echo if it finds one.

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

Patch

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index debc05d..0c9b260 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -41,7 +41,13 @@  def icecc_dep_prepend(d):
 DEPENDS_prepend += "${@icecc_dep_prepend(d)} "
 
 def get_cross_kernel_cc(bb,d):
-    kernel_cc = d.expand('${KERNEL_CC}')
+    kernel_cc = d.getVar('KERNEL_CC')
+
+    # evaluate the expression by the shell if necessary
+    if '`' in kernel_cc or '$(' in kernel_cc:
+        kernel_cc = os.popen("echo %s" % kernel_cc).read()[:-1]
+
+    kernel_cc = d.expand(kernel_cc)
     kernel_cc = kernel_cc.replace('ccache', '').strip()
     kernel_cc = kernel_cc.split(' ')[0]
     kernel_cc = kernel_cc.strip()