summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJacob Kroon <jacob.kroon@gmail.com>2022-06-15 11:23:45 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-21 20:50:57 +0100
commit1c020325647d7c7e7ad77bfdf2fdafbe0e2b62ab (patch)
tree8ee81fece9bbc782a739cbee79643d0a4cab6656 /bitbake
parent5aca7a8f10e16c402a1f2625f9c34a3accb9c6cc (diff)
downloadpoky-1c020325647d7c7e7ad77bfdf2fdafbe0e2b62ab.tar.gz
bitbake: bitbake-user-manual: Correct description of the ??= operator
Stating that the assignment is done at the end of parsing is misleading. The weak default value is the value which a variable will expand to if no value has been assigned to it using any of the assignment operators. (Bitbake rev: 8189f58d0449d16f162b6e8d98c4e5edc6bff875) Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst55
1 files changed, 39 insertions, 16 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index af4b135867..337821612c 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -195,22 +195,45 @@ value. However, if ``A`` is not set, the variable is set to "aval".
195Setting a weak default value (??=) 195Setting a weak default value (??=)
196---------------------------------- 196----------------------------------
197 197
198It is possible to use a "weaker" assignment than in the previous section 198The weak default value of a variable is the value which that variable
199by using the "??=" operator. This assignment behaves identical to "?=" 199will expand to if no value has been assigned to it via any of the other
200except that the assignment is made at the end of the parsing process 200assignment operators. The "??=" operator takes effect immediately, replacing
201rather than immediately. Consequently, when multiple "??=" assignments 201any previously defined weak default value. Here is an example::
202exist, the last one is used. Also, any "=" or "?=" assignment will 202
203override the value set with "??=". Here is an example:: 203 W ??= "x"
204 204 A := "${W}" # Immediate variable expansion
205 A ??= "somevalue" 205 W ??= "y"
206 A ??= "someothervalue" 206 B := "${W}" # Immediate variable expansion
207 207 W ??= "z"
208If ``A`` is set before the above statements are 208 C = "${W}"
209parsed, the variable retains its value. If ``A`` is not set, the 209 W ?= "i"
210variable is set to "someothervalue". 210
211 211After parsing we will have::
212Again, this assignment is a "lazy" or "weak" assignment because it does 212
213not occur until the end of the parsing process. 213 A = "x"
214 B = "y"
215 C = "i"
216 W = "i"
217
218Appending and prepending non-override style will not substitute the weak
219default value, which means that after parsing::
220
221 W ??= "x"
222 W += "y"
223
224we will have::
225
226 W = " y"
227
228On the other hand, override-style appends/prepends/removes are applied after
229any active weak default value has been substituted::
230
231 W ??= "x"
232 W:append = "y"
233
234After parsing we will have::
235
236 W = "xy"
214 237
215Immediate variable expansion (:=) 238Immediate variable expansion (:=)
216--------------------------------- 239---------------------------------