From 480096ca93c0a649ebfff68dfc7d9bbe8eb2ea2d Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Thu, 21 Jul 2016 09:49:08 -0700 Subject: bitbake-user-manual: Updated the variable expansion section. Fixes [YOCTO #9984] Added more detail to the examples that show the effects of variable expanison. Signed-off-by: Scott Rifenbark --- .../bitbake-user-manual-metadata.xml | 43 ++++++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'doc') diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml b/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml index 879e096b0..3a234e7b7 100644 --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml @@ -50,22 +50,41 @@ Variable Expansion - BitBake supports variables referencing one another's - contents using a syntax that is similar to shell scripting. - Following is an example that results in A - containing "aval" and B evaluating to - "preavalpost" based on that current value of - A. + 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" - You should realize that whenever B is - referenced, its evaluation will depend on the state of - A at that time. - Thus, later evaluations of B in the - previous example could result in different values - depending on the value of A. + + 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 following example 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 (i.e. ":="). -- cgit 1.2.3-korg