Bug 7006

Summary: classes containing a dash in the name cannot use "EXPORT_FUNCTIONS"
Product: [Build System, Metadata & Runtime] BitBake Reporter: Diego <diego.ml>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher
Version: unspecified   
Target Milestone: 1.8 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Diego 2014-12-02 11:03:10 UTC
Using EXPORT_FUNCTIONS, as described here:
http://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#flexible-inheritance-for-class-functions
works only when the class has no dashes in the name.

While classes with a dash in the name are valid (there are plenty in oe-core/poky itself), they cause error when using EXPORT_FUNCTIONS.

How to reproduce:

1) define the following "dashed-class.bbclass":
dashed-class_do_custom_function() {
        # do nothing
}

EXPORT_FUNCTIONS do_custom_function

2) use do_custom_function inside a recipe

Bitbaking will result in the following error:
dashed-class_do_custom_function: not found


Renaming the class to "nondashedclass.bbclass" and fixing the function definition accordingly doesn't cause the problem, so my guess is that dashed are not parsed properly in functions definition.
Comment 1 Richard Purdie 2015-01-08 10:40:14 UTC
dash characters are illegal in sh function names. There isn't anything we can do about that (and we don't want to mandate bash, we can't due to our sh parser anyway) so I've made sure you get a clear early error at parse time from bitbake instead explaining the problem:

http://git.yoctoproject.org/cgit.cgi/poky/patch/?id=2e26745a134373dfde3aa2b16fef3df720436e77