Bug 7829

Summary: Bitbake shouldn't complain about empty method
Product: [Build System, Metadata & Runtime] BitBake Reporter: Igor Stoppa <igor.stoppa>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: VERIFIED FIXED QA Contact: Daniel Istrate <daniel.alexandrux.istrate>
Severity: normal    
Priority: Medium CC: bogdanx.a.voiculescu, daniel.alexandrux.istrate, poky.bs.watcher, poky.watcher
Version: 1.9   
Target Milestone: 1.9   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Igor Stoppa 2015-05-31 21:29:32 UTC
Sometimes one might want to override a default method.
For example, I wanted to prevent the execution of the real do_build, so I created an empty one:

python do_build () {
}

This apparently simple trick didn't work, I got the error: 
" ... Failure expanding variable do_build: IndexError: string index out of range"


changing the method to:

python do_build () {
# gibberish
}

did the trick.

The limitation imposed seems unnecessary.

Btw, I still didn't get any line number for the error, which tends to be annoying.
Comment 2 Daniel Istrate 2016-02-16 09:02:30 UTC
Verified on master: 36b43b233c841b3c09fc17e04686b4b758780963

Steps:

1. git checkout 43c6e8c0dd7a7139b476b94d69a0252c639393bf
2. Create meta-selftest/recipes-test/ed/ed_1.9.bbappend and add
python do_build () {
}
3. bitbake ed -->
NOTE: Error during finalise of /home/daniel/poky/meta/recipes-extended/ed/ed_1.9.bb                                      | ETA:  00:00:18
ERROR: ExpansionError during parsing /home/daniel/poky/meta/recipes-extended/ed/ed_1.9.bb: Failure expanding variable do_build: IndexError: string index out of range
4. git checkout master
5. bitbake ed --> build successfully