| Summary: |
Suggested documentation on using overrides with functions |
| Product: |
[Documentation] BitBake User Manual
|
Reporter: |
ulfalizer |
| Component: |
bitbake-manual | Assignee: |
Scott Rifenbark <srifenbark> |
| Status: |
RESOLVED
FIXED
|
QA Contact: |
|
| Severity: |
normal
|
|
|
| Priority: |
Medium
|
CC: |
bluelightning, sgw, srifenbark
|
| Version: |
2.2 | |
|
| Target Milestone: |
2.2 M4 | |
|
| Hardware: |
x86 | |
|
| OS: |
Multiple | |
|
| Whiteboard: |
22 Sept 2016: RESOLVED |
|
OS type for building Yocto:
|
---
|
Type of Regression:
|
---
|
|
Verified:
|
|
Documentation change:
|
Done (doc changes complete)
|
Hello, There doesn't seem to be any documentation that explicitly mentions that you can append and prepend to functions. I suggest the following changes: Add this to the end of '3.1.8. Appending and Prepending (Override Style Syntax)': It is also possible to append and prepend to shell functions and BitBake-style Python functions. See [3.5.1. Shell Functions] and [3.5.2. BitBake Style Python Functions] for examples of how to do this. Add this to the end of '3.5.1. Shell Functions': Overrides and override-style operators like "_append" and "_prepend" can also be applied to shell functions. Most commonly, this would be used in a .bbappend to modify functions in the main recipe. It can also be used to modify functions inherited from classes. As an example, consider the following snippet: do_foo() { bbplain first fn } fn_prepend() { bbplain second } fn() { bbplain third } do_foo_append() { bbplain fourth } The output from do_foo would be the following: recipename do_foo: first recipename do_foo: second recipename do_foo: third recipename do_foo: fourth Note { Overrides and override-style operators can be applied to any shell function, not just [tasks](http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#tasks). } 'bitbake -e recipename' can be used to view the final assembled function after all overrides have been applied. Add this to the end of '3.5.2. BitBake Style Python Functions': Like with shell functions, overrides and override-style operators can also be applied to BitBake-style Python functions. As an example, consider the following snippet: python do_foo_prepend() { bb.plain("first") } python do_foo() { bb.plain("second") } python do_foo_append() { bb.plain("third") } The output from do_foo would be the following: recipename do_foo: first recipename do_foo: second recipename do_foo: third 'bitbake -e recipename' can be used to view the final assembled function after all overrides have been applied. Cheers, Ulf