summaryrefslogtreecommitdiffstats
path: root/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst')
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst422
1 files changed, 253 insertions, 169 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 615c9f9ce1..58975f4c88 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -91,9 +91,10 @@ level changes:
Variables that are exported to the environment are preceded by the
string "export" in the command's output.
-- For recipe changes, use the following::
+- To find changes to a given variable in a specific recipe, use the
+ following::
- $ bitbake recipe -e \| grep VARIABLE="
+ $ bitbake recipename -e | grep VARIABLENAME=\"
This command checks to see if the variable actually makes
it into a specific recipe.
@@ -103,15 +104,15 @@ Line Joining
Outside of :ref:`functions <bitbake-user-manual/bitbake-user-manual-metadata:functions>`,
BitBake joins any line ending in
-a backslash character ("\") with the following line before parsing
-statements. The most common use for the "\" character is to split
+a backslash character ("\\") with the following line before parsing
+statements. The most common use for the "\\" character is to split
variable assignments over multiple lines, as in the following example::
FOO = "bar \
baz \
qaz"
-Both the "\" character and the newline
+Both the "\\" character and the newline
character that follow it are removed when joining lines. Thus, no
newline characters end up in the value of ``FOO``.
@@ -124,7 +125,7 @@ Consider this additional example where the two assignments both assign
.. note::
- BitBake does not interpret escape sequences like "\n" in variable
+ BitBake does not interpret escape sequences like "\\n" in variable
values. For these to have an effect, the value must be passed to some
utility that interprets escape sequences, such as
``printf`` or ``echo -n``.
@@ -158,7 +159,7 @@ behavior::
C = "qux"
*At this point, ${A} equals "qux bar baz"*
B = "norf"
- *At this point, ${A} equals "norf baz"\*
+ *At this point, ${A} equals "norf baz"*
Contrast this behavior with the
:ref:`bitbake-user-manual/bitbake-user-manual-metadata:immediate variable
@@ -194,22 +195,45 @@ value. However, if ``A`` is not set, the variable is set to "aval".
Setting a weak default value (??=)
----------------------------------
-It is possible to use a "weaker" assignment than in the previous section
-by using the "??=" operator. This assignment behaves identical to "?="
-except that the assignment is made at the end of the parsing process
-rather than immediately. Consequently, when multiple "??=" assignments
-exist, the last one is used. Also, any "=" or "?=" assignment will
-override the value set with "??=". Here is an example::
+The weak default value of a variable is the value which that variable
+will expand to if no value has been assigned to it via any of the other
+assignment operators. The "??=" operator takes effect immediately, replacing
+any previously defined weak default value. Here is an example::
- A ??= "somevalue"
- A ??= "someothervalue"
+ W ??= "x"
+ A := "${W}" # Immediate variable expansion
+ W ??= "y"
+ B := "${W}" # Immediate variable expansion
+ W ??= "z"
+ C = "${W}"
+ W ?= "i"
-If ``A`` is set before the above statements are
-parsed, the variable retains its value. If ``A`` is not set, the
-variable is set to "someothervalue".
+After parsing we will have::
-Again, this assignment is a "lazy" or "weak" assignment because it does
-not occur until the end of the parsing process.
+ A = "x"
+ B = "y"
+ C = "i"
+ W = "i"
+
+Appending and prepending non-override style will not substitute the weak
+default value, which means that after parsing::
+
+ W ??= "x"
+ W += "y"
+
+we will have::
+
+ W = " y"
+
+On the other hand, override-style appends/prepends/removes are applied after
+any active weak default value has been substituted::
+
+ W ??= "x"
+ W:append = "y"
+
+After parsing we will have::
+
+ W = "xy"
Immediate variable expansion (:=)
---------------------------------
@@ -225,7 +249,7 @@ immediately, rather than when the variable is actually used::
C := "${C}append"
In this example, ``A`` contains "test 123", even though the final value
-of ``T`` is "456". The variable ``B`` will end up containing "456
+of :term:`T` is "456". The variable :term:`B` will end up containing "456
cvalappend". This is because references to undefined variables are
preserved as is during (immediate)expansion. This is in contrast to GNU
Make, where undefined variables expand to nothing. The variable ``C``
@@ -248,7 +272,7 @@ examples::
C = "cval"
C =+ "test"
-The variable ``B`` contains "bval additionaldata" and ``C`` contains "test
+The variable :term:`B` contains "bval additionaldata" and ``C`` contains "test
cval".
.. _appending-and-prepending-without-spaces:
@@ -267,7 +291,7 @@ examples::
C = "cval"
C =. "test"
-The variable ``B`` contains "bvaladditionaldata" and ``C`` contains
+The variable :term:`B` contains "bvaladditionaldata" and ``C`` contains
"testcval".
Appending and Prepending (Override Style Syntax)
@@ -281,13 +305,13 @@ operators in that their effects are applied at variable expansion time
rather than being immediately applied. Here are some examples::
B = "bval"
- B_append = " additional data"
+ B:append = " additional data"
C = "cval"
- C_prepend = "additional data "
+ C:prepend = "additional data "
D = "dval"
- D_append = "additional data"
+ D:append = "additional data"
-The variable ``B``
+The variable :term:`B`
becomes "bval additional data" and ``C`` becomes "additional data cval".
The variable ``D`` becomes "dvaladditional data".
@@ -295,6 +319,10 @@ The variable ``D`` becomes "dvaladditional data".
You must control all spacing when you use the override syntax.
+.. note::
+
+ The overrides are applied in this order, ":append", ":prepend", ":remove".
+
It is also possible to append and prepend to shell functions and
BitBake-style Python functions. See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:shell functions`" and ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:bitbake-style python functions`"
sections for examples.
@@ -306,16 +334,17 @@ Removal (Override Style Syntax)
You can remove values from lists using the removal override style
syntax. Specifying a value for removal causes all occurrences of that
-value to be removed from the variable.
+value to be removed from the variable. Unlike ":append" and ":prepend",
+there is no need to add a leading or trailing space to the value.
When you use this syntax, BitBake expects one or more strings.
Surrounding spaces and spacing are preserved. Here is an example::
FOO = "123 456 789 123456 123 456 123 456"
- FOO_remove = "123"
- FOO_remove = "456"
+ FOO:remove = "123"
+ FOO:remove = "456"
FOO2 = " abc def ghi abcdef abc def abc def def"
- FOO2_remove = "\
+ FOO2:remove = "\
def \
abc \
ghi \
@@ -324,14 +353,36 @@ Surrounding spaces and spacing are preserved. Here is an example::
The variable ``FOO`` becomes
" 789 123456 " and ``FOO2`` becomes " abcdef ".
-Like "_append" and "_prepend", "_remove" is applied at variable
+Like ":append" and ":prepend", ":remove" is applied at variable
expansion time.
+.. note::
+
+ The overrides are applied in this order, ":append", ":prepend", ":remove".
+ This implies it is not possible to re-append previously removed strings.
+ However, one can undo a ":remove" by using an intermediate variable whose
+ content is passed to the ":remove" so that modifying the intermediate
+ variable equals to keeping the string in::
+
+ FOOREMOVE = "123 456 789"
+ FOO:remove = "${FOOREMOVE}"
+ ...
+ FOOREMOVE = "123 789"
+
+ This expands to ``FOO:remove = "123 789"``.
+
+.. note::
+
+ Override application order may not match variable parse history, i.e.
+ the output of ``bitbake -e`` may contain ":remove" before ":append",
+ but the result will be removed string, because ":remove" is handled
+ last.
+
Override Style Operation Advantages
-----------------------------------
-An advantage of the override style operations "_append", "_prepend", and
-"_remove" as compared to the "+=" and "=+" operators is that the
+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 ``foo.bbclass`` that needs to add the value "val" to
the variable ``FOO``, and a recipe that uses ``foo.bbclass`` as follows::
@@ -346,18 +397,18 @@ not what is desired::
FOO += "val"
If, on the other hand, ``foo.bbclass``
-uses the "_append" operator, then the final value of ``FOO`` will be
+uses the ":append" operator, then the final value of ``FOO`` will be
"initial val", as intended::
- FOO_append = " val"
+ FOO:append = " val"
.. note::
- It is never necessary to use "+=" together with "_append". The following
+ It is never necessary to use "+=" together with ":append". The following
sequence of assignments appends "barbaz" to FOO::
- FOO_append = "bar"
- FOO_append = "baz"
+ FOO:append = "bar"
+ FOO:append = "baz"
The only effect of changing the second assignment in the previous
@@ -378,8 +429,8 @@ You can find more out about variable flags in general in the
You can define, append, and prepend values to variable flags. All the
standard syntax operations previously mentioned work for variable flags
-except for override style syntax (i.e. "_prepend", "_append", and
-"_remove").
+except for override style syntax (i.e. ":prepend", ":append", and
+":remove").
Here are some examples showing how to set variable flags::
@@ -397,6 +448,12 @@ documentation to a BitBake variable as follows::
CACHE[doc] = "The directory holding the cache of the metadata."
+.. note::
+
+ Variable flag names starting with an underscore (``_``) character
+ are allowed but are ignored by ``d.getVarFlags("VAR")``
+ in Python code. Such flag names are used internally by BitBake.
+
Inline Python Variable Expansion
--------------------------------
@@ -412,8 +469,8 @@ variables from BitBake's internal data dictionary, ``d``. The following
lines select the values of a package name and its version number,
respectively::
- PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
- PV = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
+ PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
+ PV = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
.. note::
@@ -496,40 +553,40 @@ Conditional Syntax (Overrides)
BitBake uses :term:`OVERRIDES` to control what
variables are overridden after BitBake parses recipes and configuration
-files. This section describes how you can use ``OVERRIDES`` as
+files. This section describes how you can use :term:`OVERRIDES` as
conditional metadata, talks about key expansion in relationship to
-``OVERRIDES``, and provides some examples to help with understanding.
+:term:`OVERRIDES`, and provides some examples to help with understanding.
Conditional Metadata
--------------------
-You can use ``OVERRIDES`` to conditionally select a specific version of
+You can use :term:`OVERRIDES` to conditionally select a specific version of
a variable and to conditionally append or prepend the value of a
variable.
.. note::
- Overrides can only use lower-case characters. Additionally,
- underscores are not permitted in override names as they are used to
+ Overrides can only use lower-case characters, digits and dashes.
+ In particular, colons are not permitted in override names as they are used to
separate overrides from each other and from the variable name.
-- *Selecting a Variable:* The ``OVERRIDES`` variable is a
+- *Selecting a Variable:* The :term:`OVERRIDES` variable is a
colon-character-separated list that contains items for which you want
to satisfy conditions. Thus, if you have a variable that is
- conditional on "arm", and "arm" is in ``OVERRIDES``, then the
+ conditional on "arm", and "arm" is in :term:`OVERRIDES`, then the
"arm"-specific version of the variable is used rather than the
non-conditional version. Here is an example::
OVERRIDES = "architecture:os:machine"
TEST = "default"
- TEST_os = "osspecific"
- TEST_nooverride = "othercondvalue"
+ TEST:os = "osspecific"
+ TEST:nooverride = "othercondvalue"
- In this example, the ``OVERRIDES``
+ In this example, the :term:`OVERRIDES`
variable lists three overrides: "architecture", "os", and "machine".
The variable ``TEST`` by itself has a default value of "default". You
select the os-specific version of the ``TEST`` variable by appending
- the "os" override to the variable (i.e. ``TEST_os``).
+ the "os" override to the variable (i.e. ``TEST:os``).
To better understand this, consider a practical example that assumes
an OpenEmbedded metadata-based Linux kernel recipe file. The
@@ -538,36 +595,36 @@ variable.
that value based on the architecture of the build::
KBRANCH = "standard/base"
- KBRANCH_qemuarm = "standard/arm-versatile-926ejs"
- KBRANCH_qemumips = "standard/mti-malta32"
- KBRANCH_qemuppc = "standard/qemuppc"
- KBRANCH_qemux86 = "standard/common-pc/base"
- KBRANCH_qemux86-64 = "standard/common-pc-64/base"
- KBRANCH_qemumips64 = "standard/mti-malta64"
+ KBRANCH:qemuarm = "standard/arm-versatile-926ejs"
+ KBRANCH:qemumips = "standard/mti-malta32"
+ KBRANCH:qemuppc = "standard/qemuppc"
+ KBRANCH:qemux86 = "standard/common-pc/base"
+ KBRANCH:qemux86-64 = "standard/common-pc-64/base"
+ KBRANCH:qemumips64 = "standard/mti-malta64"
- *Appending and Prepending:* BitBake also supports append and prepend
operations to variable values based on whether a specific item is
- listed in ``OVERRIDES``. Here is an example::
+ listed in :term:`OVERRIDES`. Here is an example::
DEPENDS = "glibc ncurses"
OVERRIDES = "machine:local"
- DEPENDS_append_machine = "libmad"
+ DEPENDS:append:machine = "libmad"
- In this example, ``DEPENDS`` becomes "glibc ncurses libmad".
+ In this example, :term:`DEPENDS` becomes "glibc ncurses libmad".
Again, using an OpenEmbedded metadata-based kernel recipe file as an
example, the following lines will conditionally append to the
``KERNEL_FEATURES`` variable based on the architecture::
- KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
- KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
- KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
+ KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}"
+ KERNEL_FEATURES:append:qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
+ KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
- *Setting a Variable for a Single Task:* BitBake supports setting a
variable just for the duration of a single task. Here is an example::
- FOO_task-configure = "val 1"
- FOO_task-compile = "val 2"
+ FOO:task-configure = "val 1"
+ FOO:task-compile = "val 2"
In the
previous example, ``FOO`` has the value "val 1" while the
@@ -580,9 +637,19 @@ variable.
``do_compile`` task.
You can also use this syntax with other combinations (e.g.
- "``_prepend``") as shown in the following example::
+ "``:prepend``") as shown in the following example::
+
+ EXTRA_OEMAKE:prepend:task-compile = "${PARALLEL_MAKE} "
+
+.. note::
+
+ Before BitBake 1.52 (Honister 3.4), the syntax for :term:`OVERRIDES`
+ used ``_`` instead of ``:``, so you will still find a lot of documentation
+ using ``_append``, ``_prepend``, and ``_remove``, for example.
- EXTRA_OEMAKE_prepend_task-compile = "${PARALLEL_MAKE} "
+ For details, see the
+ :yocto_docs:`Overrides Syntax Changes </migration-guides/migration-3.4.html#override-syntax-changes>`
+ section in the Yocto Project manual migration notes.
Key Expansion
-------------
@@ -612,33 +679,33 @@ users.
There is often confusion concerning the order in which overrides and
various "append" operators take effect. Recall that an append or prepend
-operation using "_append" and "_prepend" does not result in an immediate
+operation using ":append" and ":prepend" does not result in an immediate
assignment as would "+=", ".=", "=+", or "=.". Consider the following
example::
OVERRIDES = "foo"
A = "Z"
- A_foo_append = "X"
+ A:foo:append = "X"
For this case,
``A`` is unconditionally set to "Z" and "X" is unconditionally and
-immediately appended to the variable ``A_foo``. Because overrides have
-not been applied yet, ``A_foo`` is set to "X" due to the append and
+immediately appended to the variable ``A:foo``. Because overrides have
+not been applied yet, ``A:foo`` is set to "X" due to the append and
``A`` simply equals "Z".
Applying overrides, however, changes things. Since "foo" is listed in
-``OVERRIDES``, the conditional variable ``A`` is replaced with the "foo"
-version, which is equal to "X". So effectively, ``A_foo`` replaces
+:term:`OVERRIDES`, the conditional variable ``A`` is replaced with the "foo"
+version, which is equal to "X". So effectively, ``A:foo`` replaces
``A``.
This next example changes the order of the override and the append::
OVERRIDES = "foo"
A = "Z"
- A_append_foo = "X"
+ A:append:foo = "X"
For this case, before
-overrides are handled, ``A`` is set to "Z" and ``A_append_foo`` is set
+overrides are handled, ``A`` is set to "Z" and ``A:append:foo`` is set
to "X". Once the override for "foo" is applied, however, ``A`` gets
appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces
are not appended.
@@ -648,21 +715,21 @@ back as in the first example::
OVERRIDES = "foo"
A = "Y"
- A_foo_append = "Z"
- A_foo_append = "X"
+ A:foo:append = "Z"
+ A:foo:append = "X"
For this case, before any overrides are resolved,
``A`` is set to "Y" using an immediate assignment. After this immediate
-assignment, ``A_foo`` is set to "Z", and then further appended with "X"
+assignment, ``A:foo`` is set to "Z", and then further appended with "X"
leaving the variable set to "ZX". Finally, applying the override for
"foo" results in the conditional variable ``A`` becoming "ZX" (i.e.
-``A`` is replaced with ``A_foo``).
+``A`` is replaced with ``A:foo``).
This final example mixes in some varying operators::
A = "1"
- A_append = "2"
- A_append = "3"
+ A:append = "2"
+ A:append = "3"
A += "4"
A .= "5"
@@ -670,7 +737,7 @@ For this case, the type of append
operators are affecting the order of assignments as BitBake passes
through the code multiple times. Initially, ``A`` is set to "1 45"
because of the three statements that use immediate operators. After
-these assignments are made, BitBake applies the "_append" operations.
+these assignments are made, BitBake applies the ":append" operations.
Those operations result in ``A`` becoming "1 4523".
Sharing Functionality
@@ -686,7 +753,7 @@ share the task.
This section presents the mechanisms BitBake provides to allow you to
share functionality between recipes. Specifically, the mechanisms
-include ``include``, ``inherit``, ``INHERIT``, and ``require``
+include ``include``, ``inherit``, :term:`INHERIT`, and ``require``
directives.
Locating Include and Class Files
@@ -702,7 +769,7 @@ current directory for ``include`` and ``require`` directives.
In order for include and class files to be found by BitBake, they need
to be located in a "classes" subdirectory that can be found in
-``BBPATH``.
+:term:`BBPATH`.
``inherit`` Directive
---------------------
@@ -725,7 +792,7 @@ functionality for using Autotools that could be shared across recipes::
inherit autotools
In this case, BitBake would search for the directory
-``classes/autotools.bbclass`` in ``BBPATH``.
+``classes/autotools.bbclass`` in :term:`BBPATH`.
.. note::
@@ -752,7 +819,7 @@ parsed. One way to achieve a conditional inherit in this case is to use
overrides::
VARIABLE = ""
- VARIABLE_someoverride = "myclass"
+ VARIABLE:someoverride = "myclass"
Another method is by using anonymous Python. Here is an example::
@@ -780,7 +847,7 @@ BitBake understands the ``include`` directive. This directive causes
BitBake to parse whatever file you specify, and to insert that file at
that location. The directive is much like its equivalent in Make except
that if the path specified on the include line is a relative path,
-BitBake locates the first file it can find within ``BBPATH``.
+BitBake locates the first file it can find within :term:`BBPATH`.
The include directive is a more generic method of including
functionality as compared to the :ref:`inherit <bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` directive>`
@@ -822,7 +889,7 @@ does not suit a ``.bbclass`` file.
Similar to how BitBake handles :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>`, if
the path specified on the require line is a relative path, BitBake
-locates the first file it can find within ``BBPATH``.
+locates the first file it can find within :term:`BBPATH`.
As an example, suppose you have two versions of a recipe (e.g.
``foo_1.2.2.bb`` and ``foo_2.0.0.bb``) where each version contains some
@@ -851,7 +918,7 @@ As an example, suppose you needed to inherit a class file called
This configuration directive causes the named class to be inherited at
the point of the directive during parsing. As with the ``inherit``
directive, the ``.bbclass`` file must be located in a "classes"
-subdirectory in one of the directories specified in ``BBPATH``.
+subdirectory in one of the directories specified in :term:`BBPATH`.
.. note::
@@ -893,7 +960,7 @@ Regardless of the type of function, you can only define them in class
Shell Functions
---------------
-Functions written in shell script and executed either directly as
+Functions written in shell script are executed either directly as
functions, tasks, or both. They can also be called by other shell
functions. Here is an example shell function definition::
@@ -907,7 +974,7 @@ rules. The scripts are executed by ``/bin/sh``, which may not be a bash
shell but might be something such as ``dash``. You should not use
Bash-specific script (bashisms).
-Overrides and override-style operators like ``_append`` and ``_prepend``
+Overrides and override-style operators like ``:append`` and ``:prepend``
can also be applied to shell functions. Most commonly, this application
would be used in a ``.bbappend`` file to modify functions in the main
recipe. It can also be used to modify functions inherited from classes.
@@ -919,7 +986,7 @@ As an example, consider the following::
fn
}
- fn_prepend() {
+ fn:prepend() {
bbplain second
}
@@ -927,7 +994,7 @@ As an example, consider the following::
bbplain third
}
- do_foo_append() {
+ do_foo:append() {
bbplain fourth
}
@@ -943,7 +1010,7 @@ Running ``do_foo`` prints the following::
Overrides and override-style operators can be applied to any shell
function, not just :ref:`tasks <bitbake-user-manual/bitbake-user-manual-metadata:tasks>`.
-You can use the ``bitbake -e`` recipename command to view the final
+You can use the ``bitbake -e recipename`` command to view the final
assembled function after all overrides have been applied.
BitBake-Style Python Functions
@@ -977,7 +1044,7 @@ override-style operators to BitBake-style Python functions.
As an example, consider the following::
- python do_foo_prepend() {
+ python do_foo:prepend() {
bb.plain("first")
}
@@ -985,7 +1052,7 @@ As an example, consider the following::
bb.plain("second")
}
- python do_foo_append() {
+ python do_foo:append() {
bb.plain("third")
}
@@ -995,7 +1062,7 @@ Running ``do_foo`` prints the following::
recipename do_foo: second
recipename do_foo: third
-You can use the ``bitbake -e`` recipename command to view
+You can use the ``bitbake -e recipename`` command to view
the final assembled function after all overrides have been applied.
Python Functions
@@ -1015,7 +1082,7 @@ is an example::
SOMECONDITION = "1"
DEPENDS = "${@get_depends(d)}"
-This would result in ``DEPENDS`` containing ``dependencywithcond``.
+This would result in :term:`DEPENDS` containing ``dependencywithcond``.
Here are some things to know about Python functions:
@@ -1134,12 +1201,12 @@ equivalent to the following snippet::
values set for the variables within the anonymous functions become
available to tasks, which always run after parsing.
-Overrides and override-style operators such as "``_append``" are applied
+Overrides and override-style operators such as "``:append``" are applied
before anonymous functions run. In the following example, ``FOO`` ends
up with the value "foo from anonymous"::
FOO = "foo"
- FOO_append = " from outside"
+ FOO:append = " from outside"
python () {
d.setVar("FOO", "foo from anonymous")
@@ -1164,7 +1231,7 @@ To understand the benefits of this feature, consider the basic scenario
where a class defines a task function and your recipe inherits the
class. In this basic scenario, your recipe inherits the task function as
defined in the class. If desired, your recipe can add to the start and
-end of the function by using the "_prepend" or "_append" operations
+end of the function by using the ":prepend" or ":append" operations
respectively, or it can redefine the function completely. However, if it
redefines the function, there is no means for it to call the class
version of the function. ``EXPORT_FUNCTIONS`` provides a mechanism that
@@ -1342,8 +1409,8 @@ the build machine cannot influence the build.
.. note::
By default, BitBake cleans the environment to include only those
- things exported or listed in its whitelist to ensure that the build
- environment is reproducible and consistent. You can prevent this
+ things exported or listed in its passthrough list to ensure that the
+ build environment is reproducible and consistent. You can prevent this
"cleaning" by setting the :term:`BB_PRESERVE_ENV` variable.
Consequently, if you do want something to get passed into the build task
@@ -1351,14 +1418,14 @@ environment, you must take these two steps:
#. Tell BitBake to load what you want from the environment into the
datastore. You can do so through the
- :term:`BB_ENV_WHITELIST` and
- :term:`BB_ENV_EXTRAWHITE` variables. For
+ :term:`BB_ENV_PASSTHROUGH` and
+ :term:`BB_ENV_PASSTHROUGH_ADDITIONS` variables. For
example, assume you want to prevent the build system from accessing
- your ``$HOME/.ccache`` directory. The following command "whitelists"
- the environment variable ``CCACHE_DIR`` causing BitBake to allow that
- variable into the datastore::
+ your ``$HOME/.ccache`` directory. The following command adds the
+ the environment variable ``CCACHE_DIR`` to BitBake's passthrough
+ list to allow that variable into the datastore::
- export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE CCACHE_DIR"
+ export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS CCACHE_DIR"
#. Tell BitBake to export what you have loaded into the datastore to the
task environment of every running task. Loading something from the
@@ -1375,14 +1442,14 @@ environment, you must take these two steps:
A side effect of the previous steps is that BitBake records the
variable as a dependency of the build process in things like the
setscene checksums. If doing so results in unnecessary rebuilds of
- tasks, you can whitelist the variable so that the setscene code
+ tasks, you can also flag the variable so that the setscene code
ignores the dependency when it creates checksums.
Sometimes, it is useful to be able to obtain information from the
original execution environment. BitBake saves a copy of the original
environment into a special variable named :term:`BB_ORIGENV`.
-The ``BB_ORIGENV`` variable returns a datastore object that can be
+The :term:`BB_ORIGENV` variable returns a datastore object that can be
queried using the standard datastore operators such as
``getVar(, False)``. The datastore object is useful, for example, to
find the original ``DISPLAY`` variable. Here is an example::
@@ -1429,12 +1496,35 @@ functionality of the task:
directory listed is used as the current working directory for the
task.
+- ``[file-checksums]``: Controls the file dependencies for a task. The
+ baseline file list is the set of files associated with
+ :term:`SRC_URI`. May be used to set additional dependencies on
+ files not associated with :term:`SRC_URI`.
+
+ The value set to the list is a file-boolean pair where the first
+ value is the file name and the second is whether or not it
+ physically exists on the filesystem. ::
+
+ do_configure[file-checksums] += "${MY_DIRPATH}/my-file.txt:True"
+
+ It is important to record any paths which the task looked at and
+ which didn't exist. This means that if these do exist at a later
+ time, the task can be rerun with the new additional files. The
+ "exists" True or False value after the path allows this to be
+ handled.
+
- ``[lockfiles]``: Specifies one or more lockfiles to lock while the
task executes. Only one task may hold a lockfile, and any task that
attempts to lock an already locked file will block until the lock is
released. You can use this variable flag to accomplish mutual
exclusion.
+- ``[network]``: When set to "1", allows a task to access the network. By
+ default, only the ``do_fetch`` task is granted network access. Recipes
+ shouldn't access the network outside of ``do_fetch`` as it usually
+ undermines fetcher source mirroring, image and licence manifests, software
+ auditing and supply chain security.
+
- ``[noexec]``: When set to "1", marks the task as being empty, with
no execution required. You can use the ``[noexec]`` flag to set up
tasks as dependency placeholders, or to disable tasks defined
@@ -1467,7 +1557,7 @@ functionality of the task:
can result in unpredictable behavior.
- Setting the varflag to a value greater than the value used in
- the ``BB_NUMBER_THREADS`` variable causes ``number_threads`` to
+ the :term:`BB_NUMBER_THREADS` variable causes ``number_threads`` to
have no effect.
- ``[postfuncs]``: List of functions to call after the completion of
@@ -1537,7 +1627,7 @@ intent is to make it easy to do things like email notification on build
failures.
Following is an example event handler that prints the name of the event
-and the content of the ``FILE`` variable::
+and the content of the :term:`FILE` variable::
addhandler myclass_eventhandler
python myclass_eventhandler() {
@@ -1576,7 +1666,7 @@ might have an interest in viewing:
- ``bb.event.ConfigParsed()``: Fired when the base configuration; which
consists of ``bitbake.conf``, ``base.bbclass`` and any global
- ``INHERIT`` statements; has been parsed. You can see multiple such
+ :term:`INHERIT` statements; has been parsed. You can see multiple such
events when each of the workers parse the base configuration or if
the server changes configuration and reparses. Any given datastore
only has one such event executed against it, however. If
@@ -1647,13 +1737,18 @@ user interfaces:
.. _variants-class-extension-mechanism:
-Variants - Class Extension Mechanism
-====================================
+Variants --- Class Extension Mechanism
+======================================
+
+BitBake supports multiple incarnations of a recipe file via the
+:term:`BBCLASSEXTEND` variable.
-BitBake supports two features that facilitate creating from a single
-recipe file multiple incarnations of that recipe file where all
-incarnations are buildable. These features are enabled through the
-:term:`BBCLASSEXTEND` and :term:`BBVERSIONS` variables.
+The :term:`BBCLASSEXTEND` variable is a space separated list of classes used
+to "extend" the recipe for each variant. Here is an example that results in a
+second incarnation of the current recipe being available. This second
+incarnation will have the "native" class inherited. ::
+
+ BBCLASSEXTEND = "native"
.. note::
@@ -1663,34 +1758,6 @@ incarnations are buildable. These features are enabled through the
class. For specific examples, see the OE-Core native , nativesdk , and
multilib classes.
-- ``BBCLASSEXTEND``: This variable is a space separated list of
- classes used to "extend" the recipe for each variant. Here is an
- example that results in a second incarnation of the current recipe
- being available. This second incarnation will have the "native" class
- inherited. ::
-
- BBCLASSEXTEND = "native"
-
-- ``BBVERSIONS``: This variable allows a single recipe to build
- multiple versions of a project from a single recipe file. You can
- also specify conditional metadata (using the
- :term:`OVERRIDES` mechanism) for a single
- version, or an optionally named range of versions. Here is an
- example::
-
- BBVERSIONS = "1.0 2.0 git"
- SRC_URI_git = "git://someurl/somepath.git"
-
- BBVERSIONS = "1.0.[0-6]:1.0.0+ 1.0.[7-9]:1.0.7+"
- SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;patch=1"
-
- The name of the range defaults to the original version of the recipe. For
- example, in OpenEmbedded, the recipe file ``foo_1.0.0+.bb`` creates a default
- name range of ``1.0.0+``. This is useful because the range name is not only
- placed into overrides, but it is also made available for the metadata to use
- in the variable that defines the base recipe versions for use in ``file://``
- search paths (:term:`FILESPATH`).
-
Dependencies
============
@@ -1756,13 +1823,13 @@ Build Dependencies
BitBake uses the :term:`DEPENDS` variable to manage
build time dependencies. The ``[deptask]`` varflag for tasks signifies
-the task of each item listed in ``DEPENDS`` that must complete before
+the task of each item listed in :term:`DEPENDS` that must complete before
that task can be executed. Here is an example::
do_configure[deptask] = "do_populate_sysroot"
In this example, the ``do_populate_sysroot`` task
-of each item in ``DEPENDS`` must complete before ``do_configure`` can
+of each item in :term:`DEPENDS` must complete before ``do_configure`` can
execute.
Runtime Dependencies
@@ -1771,8 +1838,8 @@ Runtime Dependencies
BitBake uses the :term:`PACKAGES`, :term:`RDEPENDS`, and :term:`RRECOMMENDS`
variables to manage runtime dependencies.
-The ``PACKAGES`` variable lists runtime packages. Each of those packages
-can have ``RDEPENDS`` and ``RRECOMMENDS`` runtime dependencies. The
+The :term:`PACKAGES` variable lists runtime packages. Each of those packages
+can have :term:`RDEPENDS` and :term:`RRECOMMENDS` runtime dependencies. The
``[rdeptask]`` flag for tasks is used to signify the task of each item
runtime dependency which must have completed before that task can be
executed. ::
@@ -1780,9 +1847,9 @@ executed. ::
do_package_qa[rdeptask] = "do_packagedata"
In the previous
-example, the ``do_packagedata`` task of each item in ``RDEPENDS`` must
+example, the ``do_packagedata`` task of each item in :term:`RDEPENDS` must
have completed before ``do_package_qa`` can execute.
-Although ``RDEPENDS`` contains entries from the
+Although :term:`RDEPENDS` contains entries from the
runtime dependency namespace, BitBake knows how to map them back
to the build-time dependency namespace, in which the tasks are defined.
@@ -1825,7 +1892,7 @@ Inter-Task Dependencies
BitBake uses the ``[depends]`` flag in a more generic form to manage
inter-task dependencies. This more generic form allows for
inter-dependency checks for specific tasks rather than checks for the
-data in ``DEPENDS``. Here is an example::
+data in :term:`DEPENDS`. Here is an example::
do_patch[depends] = "quilt-native:do_populate_sysroot"
@@ -1911,6 +1978,33 @@ looking at the source code of the ``bb`` module, which is in
the commonly used functions ``bb.utils.contains()`` and
``bb.utils.mkdirhier()``, which come with docstrings.
+Extending Python Library Code
+-----------------------------
+
+If you wish to add your own Python library code (e.g. to provide
+functions/classes you can use from Python functions in the metadata)
+you can do so from any layer using the ``addpylib`` directive.
+This directive is typically added to your layer configuration (
+``conf/layer.conf``) although it will be handled in any ``.conf`` file.
+
+Usage is of the form::
+
+ addpylib <directory> <namespace>
+
+Where <directory> specifies the directory to add to the library path.
+The specified <namespace> is imported automatically, and if the imported
+module specifies an attribute named ``BBIMPORTS``, that list of
+sub-modules is iterated and imported too.
+
+Testing and Debugging BitBake Python code
+-----------------------------------------
+
+The OpenEmbedded build system implements a convenient ``pydevshell`` target which
+you can use to access the BitBake datastore and experiment with your own Python
+code. See :yocto_docs:`Using a Python Development Shell
+</dev-manual/python-development-shell.html#using-a-python-development-shell>` in the Yocto
+Project manual for details.
+
Task Checksums and Setscene
===========================
@@ -1943,16 +2037,6 @@ The following list describes related variables:
Specifies a function BitBake calls that determines whether BitBake
requires a setscene dependency to be met.
-- :term:`BB_SETSCENE_VERIFY_FUNCTION2`:
- Specifies a function to call that verifies the list of planned task
- execution before the main task execution happens.
-
-- :term:`BB_STAMP_POLICY`: Defines the mode
- for comparing timestamps of stamp files.
-
-- :term:`BB_STAMP_WHITELIST`: Lists stamp
- files that are looked at when the stamp policy is "whitelist".
-
- :term:`BB_TASKHASH`: Within an executing task,
this variable holds the hash of the task as returned by the currently
enabled signature generator.
@@ -1967,7 +2051,7 @@ Wildcard Support in Variables
=============================
Support for wildcard use in variables varies depending on the context in
-which it is used. For example, some variables and file names allow
+which it is used. For example, some variables and filenames allow
limited use of wildcards through the "``%``" and "``*``" characters.
Other variables or names support Python's
`glob <https://docs.python.org/3/library/glob.html>`_ syntax,