summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Rifenbark <srifenbark@gmail.com>2016-07-21 09:49:08 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-02 15:22:14 +0100
commitd1e3f0bb16bf669f2775d44d8e3ce91928ab74f1 (patch)
treea8e46da41909bcec7fb2856154eb05b8abdd2c0d
parent2652217970dc6d031ee7673406a4e0fb92e9a92a (diff)
downloadpoky-d1e3f0bb16bf669f2775d44d8e3ce91928ab74f1.tar.gz
bitbake: bitbake-user-manual: Updated the variable expansion section.
Fixes [YOCTO #9984] Added more detail to the examples that show the effects of variable expanison. (Bitbake rev: 480096ca93c0a649ebfff68dfc7d9bbe8eb2ea2d) Signed-off-by: Scott Rifenbark <srifenbark@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml43
1 files changed, 31 insertions, 12 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
index 879e096b08..3a234e7b7d 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
@@ -50,22 +50,41 @@
50 <title>Variable Expansion</title> 50 <title>Variable Expansion</title>
51 51
52 <para> 52 <para>
53 BitBake supports variables referencing one another's 53 Variables can reference the contents of other variables
54 contents using a syntax that is similar to shell scripting. 54 using a syntax that is similar to variable expansion in
55 Following is an example that results in <filename>A</filename> 55 Bourne shells.
56 containing "aval" and <filename>B</filename> evaluating to 56 The following assignments
57 "preavalpost" based on that current value of 57 result in A containing "aval" and B evaluating to "preavalpost".
58 <filename>A</filename>.
59 <literallayout class='monospaced'> 58 <literallayout class='monospaced'>
60 A = "aval" 59 A = "aval"
61 B = "pre${A}post" 60 B = "pre${A}post"
62 </literallayout> 61 </literallayout>
63 You should realize that whenever <filename>B</filename> is 62 <note>
64 referenced, its evaluation will depend on the state of 63 Unlike in Bourne shells, the curly braces are mandatory:
65 <filename>A</filename> at that time. 64 Only <filename>${FOO}</filename> and not
66 Thus, later evaluations of <filename>B</filename> in the 65 <filename>$FOO</filename> is recognized as an expansion of
67 previous example could result in different values 66 <filename>FOO</filename>.
68 depending on the value of <filename>A</filename>. 67 </note>
68 The "=" operator does not immediately expand variable
69 references in the right-hand side.
70 Instead, expansion is deferred until the variable assigned to
71 is actually used.
72 The result depends on the current values of the referenced
73 variables.
74 The following example should clarify this behavior:
75 <literallayout class='monospaced'>
76 A = "${B} baz"
77 B = "${C} bar"
78 C = "foo"
79 *At this point, ${A} equals "foo bar baz"*
80 C = "qux"
81 *At this point, ${A} equals "qux bar baz"*
82 B = "norf"
83 *At this point, ${A} equals "norf baz"*
84 </literallayout>
85 Contrast this behavior with the
86 <link linkend='immediate-variable-expansion'>immediate variable expansion</link>
87 operator (i.e. ":=").
69 </para> 88 </para>
70 </section> 89 </section>
71 90