summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJacob Kroon <jacob.kroon@gmail.com>2022-09-13 04:26:35 -1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-16 17:53:22 +0100
commitdf626c9cc073b9046af72ec7b8af3efbb79a7d36 (patch)
treee01750f4b3c982225a309c7be0bf69a63ddcccd2 /bitbake
parentf58e385b99ea4871a6ac2b13dad93dc9c455df6f (diff)
downloadpoky-df626c9cc073b9046af72ec7b8af3efbb79a7d36.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: f28dbdf80a7fc2febca227f8cb2b474f5058281e) 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> (cherry picked from commit 8189f58d0449d16f162b6e8d98c4e5edc6bff875) Signed-off-by: Steve Sakoman <steve@sakoman.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---------------------------------