Openembedded Bitbake Development
 help / color / mirror / Atom feed
* [PATCH] ast: Add error when trying to use dash in sh function names
@ 2015-01-08 10:35 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2015-01-08 10:35 UTC (permalink / raw)
  To: bitbake-devel

A dash character is illegal in function names in sh (but not bash). Since
our shell tasks run under sh and the shell parser is sh based, EXPORT_FUNCTIONS
won't work with class names containing a dash.

We can't change sh, we can ensure the user is warned about the problem 
straight away though.

[YOCTO #7006]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index af42a0c..879c9d2 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -226,6 +226,8 @@ class ExportFuncsNode(AstNode):
             if data.getVarFlag(calledfunc, "python"):
                 data.setVar(func, "    bb.build.exec_func('" + calledfunc + "', d)\n")
             else:
+                if "-" in self.classname:
+                   bb.fatal("The classname %s contains a dash character and is calling an sh function %s using EXPORT_FUNCTIONS. Since a dash is illegal in sh function names, this cannot work, please rename the class or don't use EXPORT_FUNCTIONS." % (self.classname, calledfunc))
                 data.setVar(func, "    " + calledfunc + "\n")
             data.setVarFlag(func, 'export_func', '1')
 





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-08 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 10:35 [PATCH] ast: Add error when trying to use dash in sh function names Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox