bitbake: bitbake-user-manual: Clarified override-style operators.

Fixes [YOCTO #9985]

Made the following changes:

 * Section Removal (Override Style Syntax):  Added a small
   qualifying sentence at the end to further define behavior

 * Added new section "Override Style Operation Advantages":
   This section provides some rationale behind the "_append"
   style operations.

 * Section "Examples": Changed an example to use the "="
   operator rather than the "+=" operator.

(Bitbake rev: 797d9627baad9ccd3d55e825c0d705311f631f78)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Scott Rifenbark 2016-07-21 10:37:09 -07:00 committed by Richard Purdie
parent d1e3f0bb16
commit 6aaf379119
1 changed files with 56 additions and 2 deletions

View File

@ -278,6 +278,60 @@
"789 123456" and <filename>FOO2</filename> becomes
"ghi abcdef".
</para>
<para>
Like <filename>_append</filename> and
<filename>_prepend</filename>, <filename>_remove</filename>
is deferred until after parsing completes.
</para>
</section>
<section id='override-style-operation-advantages'>
<title>Override Style Operation Advantages</title>
<para>
An advantage of the override style operations
"_append", "_prepend", and "_remove" as compared to the
"+=" and "=+" operators is that the override style
operators provide guaranteed operations.
For example, consider a class iilename>foo.bbclass</filename>
that needs to add the value "val" to the variable
<filename>FOO</filename>, and a recipe that uses
<filename>foo.bbclass</filename> as follows:
<literallayout class='monospaced'>
inherit foo
FOO = "initial"
</literallayout>
If <filename>foo.bbclass</filename> uses the "+=" operator,
as follows, then the final value of <filename>FOO</filename>
will be "initial", which is not what is desired:
<literallayout class='monospaced'>
FOO += "val"
</literallayout>
If, on the other hand, <filename>foo.bbclass</filename>
uses the "_append" operator, then the final value of
<filename>FOO</filename> will be "initial val", as intended:
<literallayout class='monospaced'>
FOO_append = " val"
</literallayout>
<note>
It is never necessary to use "+=" together with "_append".
The following sequence of assignments appepnds "barbaz" to
<filename>FOO</filename>:
<literallayout class='monospaced'>
FOO_append = "bar"
FOO_append = "baz"
</literallayout>
The only effect of changing the second assignment in the
previous example is to add a space before "baz" in the
appended value (due to how the "+=" operator works.
</note>
Another advantage of the override style operations is that
you can combine them with other overrides as described in the
"<link linkend='conditional-syntax-overrides'>Conditional Syntax (Overrides)</link>"
section.
</para>
</section>
<section id='variable-flag-syntax'>
@ -564,7 +618,7 @@
OVERRIDES = "foo"
A = "Y"
A_foo_append = "Z"
A_foo_append += "X"
A_foo_append = "X"
</literallayout>
For this case, before any overrides are resolved,
<filename>A</filename> is set to "Y" using an immediate assignment.