| Summary: | Suggested clarification of the '3.1.2. Variable Expansion' section | ||
|---|---|---|---|
| Product: | [Documentation] BitBake User Manual | Reporter: | ulfalizer |
| Component: | bitbake-manual | Assignee: | Scott Rifenbark <srifenbark> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | Medium | CC: | bluelightning, sgw, srifenbark |
| Version: | 2.2 | ||
| Target Milestone: | 2.2 M3 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | 01 August 2016: RESOLVED | ||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | Done (doc changes complete) | |
Hmm... was supposed to be *'s at the end too:
A = "${B} baz"
B = "${C} bar"
C = "foo"
*At this point, ${A} equals "foo bar baz"*
C = "qux"
*At this point, ${A} equals "qux bar baz"*
B = "norf"
*At this point, ${A} equals "norf baz"*
Ulf, Here is the new section - http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#variable-expansion. Thanks, Scott Looks good. Thanks, Ulf Thought of one more thing that might be nice to add to the end of 3.1.11. Inline Python Variable Expansion:
Note {
Inline Python expressions work just like variable expansions insofar as the '=' and ':=' operators are concerned. Given the following assignment, <code>foo()</code> will be called each time FOO is expanded:
FOO = "${@foo()}"
Contrast this with the following immediate assignment, where <code>foo()</code> is only called once, while the assignment is parsed:
FOO := "${@foo()}"
}
Here is the new note: http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#inline-python-variable-expansion Thanks, Scott Looks good to me. Thanks, Ulf Ulf, Closing the bug out. thanks, Scott Hello, I noticed that this change (and maybe others too) disappeared from the BitBake User Manual. Was that an error? Cheers, Ulf (In reply to comment #8) > Hello, > > I noticed that this change (and maybe others too) disappeared from the > BitBake User Manual. Was that an error? > > Cheers, > Ulf At least 9985 disappeared as well. Ulf, Ok - I was trying to sync up my working repo with the actual upstream bitbake repo, which holds the docs. In doing so, I did a "git pull" and apparently the changes I had made have not been merged into the actual upstream yet (they will be as Richard Purdie gets to these but not always right away). I rebuilt the manual from my poky-contrib/srifenbark/bb-manual area and the changes are there... they are not lost. Just not merged yet. You can check those links out again to verify. Sorry. Scott (In reply to comment #10) > Ulf, > > Ok - I was trying to sync up my working repo with the actual upstream > bitbake repo, which holds the docs. In doing so, I did a "git pull" and > apparently the changes I had made have not been merged into the actual > upstream yet (they will be as Richard Purdie gets to these but not always > right away). > > I rebuilt the manual from my poky-contrib/srifenbark/bb-manual area and the > changes are there... they are not lost. Just not merged yet. > > You can check those links out again to verify. > > Sorry. > > Scott OK, no worries. Just wanted to make sure they hadn't been accidentally deleted. Might've lead to a PITA later. :) Cheers, Ulf Ha - yes, it could have. |
Hello Scott, I've seen people being confused about the behavior of '=' when variables in the right-hand side are changed after the assignment. Rewriting/expanding '3.1.2. Variable Expansion' as follows might help: 3.1.2. Variable expansion Variables can reference the contents of other variables using a syntax that is similar to variable expansion in Bourne shells. The following assignments result in A containing "aval" and B evaluating to "preavalpost". A = "aval" B = "pre${A}post" Note { Unlike in Bourne shells, the curly braces are mandatory: Only ${FOO} and not $FOO is recognized as an expansion of FOO. } The '=' operator does not immediately expand variable references in the right-hand side. Instead, expansion is deferred until the variable assigned to is actually used. The result depends on the current values of the referenced variables. The example below should clarify this behavior: A = "${B} baz" B = "${C} bar" C = "foo" *At this point, ${A} equals "foo bar baz" C = "qux" *At this point, ${A} equals "qux bar baz" B = "norf" *At this point, ${A} equals "norf baz" Contrast this behavior with the ':=' (immediate variable expansion) operator, which is described below.