summaryrefslogtreecommitdiffstats
path: root/bitbake/doc/bitbake-user-manual
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/doc/bitbake-user-manual')
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst182
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst314
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst195
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst228
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst59
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst731
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables-context.rst91
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst894
8 files changed, 1799 insertions, 895 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst
index d74e768f69..d58fbb32ea 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst
@@ -16,7 +16,7 @@ data, or simply return information about the execution environment.
16 16
17This chapter describes BitBake's execution process from start to finish 17This chapter describes BitBake's execution process from start to finish
18when you use it to create an image. The execution process is launched 18when you use it to create an image. The execution process is launched
19using the following command form: :: 19using the following command form::
20 20
21 $ bitbake target 21 $ bitbake target
22 22
@@ -32,7 +32,7 @@ the BitBake command and its options, see ":ref:`The BitBake Command
32 your project's ``local.conf`` configuration file. 32 your project's ``local.conf`` configuration file.
33 33
34 A common method to determine this value for your build host is to run 34 A common method to determine this value for your build host is to run
35 the following: :: 35 the following::
36 36
37 $ grep processor /proc/cpuinfo 37 $ grep processor /proc/cpuinfo
38 38
@@ -40,7 +40,7 @@ the BitBake command and its options, see ":ref:`The BitBake Command
40 the number of processors, which takes into account hyper-threading. 40 the number of processors, which takes into account hyper-threading.
41 Thus, a quad-core build host with hyper-threading most likely shows 41 Thus, a quad-core build host with hyper-threading most likely shows
42 eight processors, which is the value you would then assign to 42 eight processors, which is the value you would then assign to
43 ``BB_NUMBER_THREADS``. 43 :term:`BB_NUMBER_THREADS`.
44 44
45 A possibly simpler solution is that some Linux distributions (e.g. 45 A possibly simpler solution is that some Linux distributions (e.g.
46 Debian and Ubuntu) provide the ``ncpus`` command. 46 Debian and Ubuntu) provide the ``ncpus`` command.
@@ -65,13 +65,13 @@ data itself is of various types:
65 65
66The ``layer.conf`` files are used to construct key variables such as 66The ``layer.conf`` files are used to construct key variables such as
67:term:`BBPATH` and :term:`BBFILES`. 67:term:`BBPATH` and :term:`BBFILES`.
68``BBPATH`` is used to search for configuration and class files under the 68:term:`BBPATH` is used to search for configuration and class files under the
69``conf`` and ``classes`` directories, respectively. ``BBFILES`` is used 69``conf`` and ``classes`` directories, respectively. :term:`BBFILES` is used
70to locate both recipe and recipe append files (``.bb`` and 70to locate both recipe and recipe append files (``.bb`` and
71``.bbappend``). If there is no ``bblayers.conf`` file, it is assumed the 71``.bbappend``). If there is no ``bblayers.conf`` file, it is assumed the
72user has set the ``BBPATH`` and ``BBFILES`` directly in the environment. 72user has set the :term:`BBPATH` and :term:`BBFILES` directly in the environment.
73 73
74Next, the ``bitbake.conf`` file is located using the ``BBPATH`` variable 74Next, the ``bitbake.conf`` file is located using the :term:`BBPATH` variable
75that was just constructed. The ``bitbake.conf`` file may also include 75that was just constructed. The ``bitbake.conf`` file may also include
76other configuration files using the ``include`` or ``require`` 76other configuration files using the ``include`` or ``require``
77directives. 77directives.
@@ -79,8 +79,8 @@ directives.
79Prior to parsing configuration files, BitBake looks at certain 79Prior to parsing configuration files, BitBake looks at certain
80variables, including: 80variables, including:
81 81
82- :term:`BB_ENV_WHITELIST` 82- :term:`BB_ENV_PASSTHROUGH`
83- :term:`BB_ENV_EXTRAWHITE` 83- :term:`BB_ENV_PASSTHROUGH_ADDITIONS`
84- :term:`BB_PRESERVE_ENV` 84- :term:`BB_PRESERVE_ENV`
85- :term:`BB_ORIGENV` 85- :term:`BB_ORIGENV`
86- :term:`BITBAKE_UI` 86- :term:`BITBAKE_UI`
@@ -104,7 +104,7 @@ BitBake first searches the current working directory for an optional
104contain a :term:`BBLAYERS` variable that is a 104contain a :term:`BBLAYERS` variable that is a
105space-delimited list of 'layer' directories. Recall that if BitBake 105space-delimited list of 'layer' directories. Recall that if BitBake
106cannot find a ``bblayers.conf`` file, then it is assumed the user has 106cannot find a ``bblayers.conf`` file, then it is assumed the user has
107set the ``BBPATH`` and ``BBFILES`` variables directly in the 107set the :term:`BBPATH` and :term:`BBFILES` variables directly in the
108environment. 108environment.
109 109
110For each directory (layer) in this list, a ``conf/layer.conf`` file is 110For each directory (layer) in this list, a ``conf/layer.conf`` file is
@@ -114,7 +114,7 @@ files automatically set up :term:`BBPATH` and other
114variables correctly for a given build directory. 114variables correctly for a given build directory.
115 115
116BitBake then expects to find the ``conf/bitbake.conf`` file somewhere in 116BitBake then expects to find the ``conf/bitbake.conf`` file somewhere in
117the user-specified ``BBPATH``. That configuration file generally has 117the user-specified :term:`BBPATH`. That configuration file generally has
118include directives to pull in any other metadata such as files specific 118include directives to pull in any other metadata such as files specific
119to the architecture, the machine, the local environment, and so forth. 119to the architecture, the machine, the local environment, and so forth.
120 120
@@ -135,11 +135,11 @@ The ``base.bbclass`` file is always included. Other classes that are
135specified in the configuration using the 135specified in the configuration using the
136:term:`INHERIT` variable are also included. BitBake 136:term:`INHERIT` variable are also included. BitBake
137searches for class files in a ``classes`` subdirectory under the paths 137searches for class files in a ``classes`` subdirectory under the paths
138in ``BBPATH`` in the same way as configuration files. 138in :term:`BBPATH` in the same way as configuration files.
139 139
140A good way to get an idea of the configuration files and the class files 140A good way to get an idea of the configuration files and the class files
141used in your execution environment is to run the following BitBake 141used in your execution environment is to run the following BitBake
142command: :: 142command::
143 143
144 $ bitbake -e > mybb.log 144 $ bitbake -e > mybb.log
145 145
@@ -155,7 +155,7 @@ execution environment.
155 pair of curly braces in a shell function, the closing curly brace 155 pair of curly braces in a shell function, the closing curly brace
156 must not be located at the start of the line without leading spaces. 156 must not be located at the start of the line without leading spaces.
157 157
158 Here is an example that causes BitBake to produce a parsing error: :: 158 Here is an example that causes BitBake to produce a parsing error::
159 159
160 fakeroot create_shar() { 160 fakeroot create_shar() {
161 cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh 161 cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh
@@ -184,13 +184,13 @@ Locating and Parsing Recipes
184During the configuration phase, BitBake will have set 184During the configuration phase, BitBake will have set
185:term:`BBFILES`. BitBake now uses it to construct a 185:term:`BBFILES`. BitBake now uses it to construct a
186list of recipes to parse, along with any append files (``.bbappend``) to 186list of recipes to parse, along with any append files (``.bbappend``) to
187apply. ``BBFILES`` is a space-separated list of available files and 187apply. :term:`BBFILES` is a space-separated list of available files and
188supports wildcards. An example would be: :: 188supports wildcards. An example would be::
189 189
190 BBFILES = "/path/to/bbfiles/*.bb /path/to/appends/*.bbappend" 190 BBFILES = "/path/to/bbfiles/*.bb /path/to/appends/*.bbappend"
191 191
192BitBake parses each 192BitBake parses each
193recipe and append file located with ``BBFILES`` and stores the values of 193recipe and append file located with :term:`BBFILES` and stores the values of
194various variables into the datastore. 194various variables into the datastore.
195 195
196.. note:: 196.. note::
@@ -201,18 +201,18 @@ For each file, a fresh copy of the base configuration is made, then the
201recipe is parsed line by line. Any inherit statements cause BitBake to 201recipe is parsed line by line. Any inherit statements cause BitBake to
202find and then parse class files (``.bbclass``) using 202find and then parse class files (``.bbclass``) using
203:term:`BBPATH` as the search path. Finally, BitBake 203:term:`BBPATH` as the search path. Finally, BitBake
204parses in order any append files found in ``BBFILES``. 204parses in order any append files found in :term:`BBFILES`.
205 205
206One common convention is to use the recipe filename to define pieces of 206One common convention is to use the recipe filename to define pieces of
207metadata. For example, in ``bitbake.conf`` the recipe name and version 207metadata. For example, in ``bitbake.conf`` the recipe name and version
208are used to set the variables :term:`PN` and 208are used to set the variables :term:`PN` and
209:term:`PV`: :: 209:term:`PV`::
210 210
211 PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}" 211 PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
212 PV = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}" 212 PV = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
213 213
214In this example, a recipe called "something_1.2.3.bb" would set 214In this example, a recipe called "something_1.2.3.bb" would set
215``PN`` to "something" and ``PV`` to "1.2.3". 215:term:`PN` to "something" and :term:`PV` to "1.2.3".
216 216
217By the time parsing is complete for a recipe, BitBake has a list of 217By the time parsing is complete for a recipe, BitBake has a list of
218tasks that the recipe defines and a set of data consisting of keys and 218tasks that the recipe defines and a set of data consisting of keys and
@@ -228,7 +228,7 @@ and then reload it.
228Where possible, subsequent BitBake commands reuse this cache of recipe 228Where possible, subsequent BitBake commands reuse this cache of recipe
229information. The validity of this cache is determined by first computing 229information. The validity of this cache is determined by first computing
230a checksum of the base configuration data (see 230a checksum of the base configuration data (see
231:term:`BB_HASHCONFIG_WHITELIST`) and 231:term:`BB_HASHCONFIG_IGNORE_VARS`) and
232then checking if the checksum matches. If that checksum matches what is 232then checking if the checksum matches. If that checksum matches what is
233in the cache and the recipe and class files have not changed, BitBake is 233in the cache and the recipe and class files have not changed, BitBake is
234able to use the cache. BitBake then reloads the cached information about 234able to use the cache. BitBake then reloads the cached information about
@@ -238,13 +238,14 @@ Recipe file collections exist to allow the user to have multiple
238repositories of ``.bb`` files that contain the same exact package. For 238repositories of ``.bb`` files that contain the same exact package. For
239example, one could easily use them to make one's own local copy of an 239example, one could easily use them to make one's own local copy of an
240upstream repository, but with custom modifications that one does not 240upstream repository, but with custom modifications that one does not
241want upstream. Here is an example: :: 241want upstream. Here is an example::
242 242
243 BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb" 243 BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb"
244 BBFILE_COLLECTIONS = "upstream local" 244 BBFILE_COLLECTIONS = "upstream local"
245 BBFILE_PATTERN_upstream = "^/stuff/openembedded/" 245 BBFILE_PATTERN_upstream = "^/stuff/openembedded/"
246 BBFILE_PATTERN_local = "^/stuff/openembedded.modified/" 246 BBFILE_PATTERN_local = "^/stuff/openembedded.modified/"
247 BBFILE_PRIORITY_upstream = "5" BBFILE_PRIORITY_local = "10" 247 BBFILE_PRIORITY_upstream = "5"
248 BBFILE_PRIORITY_local = "10"
248 249
249.. note:: 250.. note::
250 251
@@ -259,21 +260,21 @@ Providers
259 260
260Assuming BitBake has been instructed to execute a target and that all 261Assuming BitBake has been instructed to execute a target and that all
261the recipe files have been parsed, BitBake starts to figure out how to 262the recipe files have been parsed, BitBake starts to figure out how to
262build the target. BitBake looks through the ``PROVIDES`` list for each 263build the target. BitBake looks through the :term:`PROVIDES` list for each
263of the recipes. A ``PROVIDES`` list is the list of names by which the 264of the recipes. A :term:`PROVIDES` list is the list of names by which the
264recipe can be known. Each recipe's ``PROVIDES`` list is created 265recipe can be known. Each recipe's :term:`PROVIDES` list is created
265implicitly through the recipe's :term:`PN` variable and 266implicitly through the recipe's :term:`PN` variable and
266explicitly through the recipe's :term:`PROVIDES` 267explicitly through the recipe's :term:`PROVIDES`
267variable, which is optional. 268variable, which is optional.
268 269
269When a recipe uses ``PROVIDES``, that recipe's functionality can be 270When a recipe uses :term:`PROVIDES`, that recipe's functionality can be
270found under an alternative name or names other than the implicit ``PN`` 271found under an alternative name or names other than the implicit :term:`PN`
271name. As an example, suppose a recipe named ``keyboard_1.0.bb`` 272name. As an example, suppose a recipe named ``keyboard_1.0.bb``
272contained the following: :: 273contained the following::
273 274
274 PROVIDES += "fullkeyboard" 275 PROVIDES += "fullkeyboard"
275 276
276The ``PROVIDES`` 277The :term:`PROVIDES`
277list for this recipe becomes "keyboard", which is implicit, and 278list for this recipe becomes "keyboard", which is implicit, and
278"fullkeyboard", which is explicit. Consequently, the functionality found 279"fullkeyboard", which is explicit. Consequently, the functionality found
279in ``keyboard_1.0.bb`` can be found under two different names. 280in ``keyboard_1.0.bb`` can be found under two different names.
@@ -283,14 +284,14 @@ in ``keyboard_1.0.bb`` can be found under two different names.
283Preferences 284Preferences
284=========== 285===========
285 286
286The ``PROVIDES`` list is only part of the solution for figuring out a 287The :term:`PROVIDES` list is only part of the solution for figuring out a
287target's recipes. Because targets might have multiple providers, BitBake 288target's recipes. Because targets might have multiple providers, BitBake
288needs to prioritize providers by determining provider preferences. 289needs to prioritize providers by determining provider preferences.
289 290
290A common example in which a target has multiple providers is 291A common example in which a target has multiple providers is
291"virtual/kernel", which is on the ``PROVIDES`` list for each kernel 292"virtual/kernel", which is on the :term:`PROVIDES` list for each kernel
292recipe. Each machine often selects the best kernel provider by using a 293recipe. Each machine often selects the best kernel provider by using a
293line similar to the following in the machine configuration file: :: 294line similar to the following in the machine configuration file::
294 295
295 PREFERRED_PROVIDER_virtual/kernel = "linux-yocto" 296 PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
296 297
@@ -308,10 +309,10 @@ specify a particular version. You can influence the order by using the
308:term:`DEFAULT_PREFERENCE` variable. 309:term:`DEFAULT_PREFERENCE` variable.
309 310
310By default, files have a preference of "0". Setting 311By default, files have a preference of "0". Setting
311``DEFAULT_PREFERENCE`` to "-1" makes the recipe unlikely to be used 312:term:`DEFAULT_PREFERENCE` to "-1" makes the recipe unlikely to be used
312unless it is explicitly referenced. Setting ``DEFAULT_PREFERENCE`` to 313unless it is explicitly referenced. Setting :term:`DEFAULT_PREFERENCE` to
313"1" makes it likely the recipe is used. ``PREFERRED_VERSION`` overrides 314"1" makes it likely the recipe is used. :term:`PREFERRED_VERSION` overrides
314any ``DEFAULT_PREFERENCE`` setting. ``DEFAULT_PREFERENCE`` is often used 315any :term:`DEFAULT_PREFERENCE` setting. :term:`DEFAULT_PREFERENCE` is often used
315to mark newer and more experimental recipe versions until they have 316to mark newer and more experimental recipe versions until they have
316undergone sufficient testing to be considered stable. 317undergone sufficient testing to be considered stable.
317 318
@@ -330,7 +331,7 @@ If the first recipe is named ``a_1.1.bb``, then the
330 331
331Thus, if a recipe named ``a_1.2.bb`` exists, BitBake will choose 1.2 by 332Thus, if a recipe named ``a_1.2.bb`` exists, BitBake will choose 1.2 by
332default. However, if you define the following variable in a ``.conf`` 333default. However, if you define the following variable in a ``.conf``
333file that BitBake parses, you can change that preference: :: 334file that BitBake parses, you can change that preference::
334 335
335 PREFERRED_VERSION_a = "1.1" 336 PREFERRED_VERSION_a = "1.1"
336 337
@@ -393,7 +394,7 @@ ready to run, those tasks have all their dependencies met, and the
393thread threshold has not been exceeded. 394thread threshold has not been exceeded.
394 395
395It is worth noting that you can greatly speed up the build time by 396It is worth noting that you can greatly speed up the build time by
396properly setting the ``BB_NUMBER_THREADS`` variable. 397properly setting the :term:`BB_NUMBER_THREADS` variable.
397 398
398As each task completes, a timestamp is written to the directory 399As each task completes, a timestamp is written to the directory
399specified by the :term:`STAMP` variable. On subsequent 400specified by the :term:`STAMP` variable. On subsequent
@@ -434,7 +435,7 @@ BitBake writes a shell script to
434executes the script. The generated shell script contains all the 435executes the script. The generated shell script contains all the
435exported variables, and the shell functions with all variables expanded. 436exported variables, and the shell functions with all variables expanded.
436Output from the shell script goes to the file 437Output from the shell script goes to the file
437``${T}/log.do_taskname.pid``. Looking at the expanded shell functions in 438``${``\ :term:`T`\ ``}/log.do_taskname.pid``. Looking at the expanded shell functions in
438the run file and the output in the log files is a useful debugging 439the run file and the output in the log files is a useful debugging
439technique. 440technique.
440 441
@@ -476,7 +477,7 @@ changes because it should not affect the output for target packages. The
476simplistic approach for excluding the working directory is to set it to 477simplistic approach for excluding the working directory is to set it to
477some fixed value and create the checksum for the "run" script. BitBake 478some fixed value and create the checksum for the "run" script. BitBake
478goes one step better and uses the 479goes one step better and uses the
479:term:`BB_HASHBASE_WHITELIST` variable 480:term:`BB_BASEHASH_IGNORE_VARS` variable
480to define a list of variables that should never be included when 481to define a list of variables that should never be included when
481generating the signatures. 482generating the signatures.
482 483
@@ -497,7 +498,7 @@ to the task.
497 498
498Like the working directory case, situations exist where dependencies 499Like the working directory case, situations exist where dependencies
499should be ignored. For these cases, you can instruct the build process 500should be ignored. For these cases, you can instruct the build process
500to ignore a dependency by using a line like the following: :: 501to ignore a dependency by using a line like the following::
501 502
502 PACKAGE_ARCHS[vardepsexclude] = "MACHINE" 503 PACKAGE_ARCHS[vardepsexclude] = "MACHINE"
503 504
@@ -507,7 +508,7 @@ even if it does reference it.
507 508
508Equally, there are cases where we need to add dependencies BitBake is 509Equally, there are cases where we need to add dependencies BitBake is
509not able to find. You can accomplish this by using a line like the 510not able to find. You can accomplish this by using a line like the
510following: :: 511following::
511 512
512 PACKAGE_ARCHS[vardeps] = "MACHINE" 513 PACKAGE_ARCHS[vardeps] = "MACHINE"
513 514
@@ -522,7 +523,7 @@ it cannot figure out dependencies.
522Thus far, this section has limited discussion to the direct inputs into 523Thus far, this section has limited discussion to the direct inputs into
523a task. Information based on direct inputs is referred to as the 524a task. Information based on direct inputs is referred to as the
524"basehash" in the code. However, there is still the question of a task's 525"basehash" in the code. However, there is still the question of a task's
525indirect inputs - the things that were already built and present in the 526indirect inputs --- the things that were already built and present in the
526build directory. The checksum (or signature) for a particular task needs 527build directory. The checksum (or signature) for a particular task needs
527to add the hashes of all the tasks on which the particular task depends. 528to add the hashes of all the tasks on which the particular task depends.
528Choosing which dependencies to add is a policy decision. However, the 529Choosing which dependencies to add is a policy decision. However, the
@@ -533,11 +534,11 @@ At the code level, there are a variety of ways both the basehash and the
533dependent task hashes can be influenced. Within the BitBake 534dependent task hashes can be influenced. Within the BitBake
534configuration file, we can give BitBake some extra information to help 535configuration file, we can give BitBake some extra information to help
535it construct the basehash. The following statement effectively results 536it construct the basehash. The following statement effectively results
536in a list of global variable dependency excludes - variables never 537in a list of global variable dependency excludes --- variables never
537included in any checksum. This example uses variables from OpenEmbedded 538included in any checksum. This example uses variables from OpenEmbedded
538to help illustrate the concept: :: 539to help illustrate the concept::
539 540
540 BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR \ 541 BB_BASEHASH_IGNORE_VARS ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR \
541 SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL \ 542 SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL \
542 USER FILESPATH STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE PRSERV_HOST \ 543 USER FILESPATH STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE PRSERV_HOST \
543 PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \ 544 PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \
@@ -551,23 +552,22 @@ through dependency chains are more complex and are generally
551accomplished with a Python function. The code in 552accomplished with a Python function. The code in
552``meta/lib/oe/sstatesig.py`` shows two examples of this and also 553``meta/lib/oe/sstatesig.py`` shows two examples of this and also
553illustrates how you can insert your own policy into the system if so 554illustrates how you can insert your own policy into the system if so
554desired. This file defines the two basic signature generators 555desired. This file defines the basic signature generator
555OpenEmbedded-Core uses: "OEBasic" and "OEBasicHash". By default, there 556OpenEmbedded-Core uses: "OEBasicHash". By default, there
556is a dummy "noop" signature handler enabled in BitBake. This means that 557is a dummy "noop" signature handler enabled in BitBake. This means that
557behavior is unchanged from previous versions. ``OE-Core`` uses the 558behavior is unchanged from previous versions. ``OE-Core`` uses the
558"OEBasicHash" signature handler by default through this setting in the 559"OEBasicHash" signature handler by default through this setting in the
559``bitbake.conf`` file: :: 560``bitbake.conf`` file::
560 561
561 BB_SIGNATURE_HANDLER ?= "OEBasicHash" 562 BB_SIGNATURE_HANDLER ?= "OEBasicHash"
562 563
563The "OEBasicHash" ``BB_SIGNATURE_HANDLER`` is the same as the "OEBasic" 564The main feature of the "OEBasicHash" :term:`BB_SIGNATURE_HANDLER` is that
564version but adds the task hash to the stamp files. This results in any 565it adds the task hash to the stamp files. Thanks to this, any metadata
565metadata change that changes the task hash, automatically causing the 566change will change the task hash, automatically causing the task to be run
566task to be run again. This removes the need to bump 567again. This removes the need to bump :term:`PR` values, and changes to
567:term:`PR` values, and changes to metadata automatically 568metadata automatically ripple across the build.
568ripple across the build.
569 569
570It is also worth noting that the end result of these signature 570It is also worth noting that the end result of signature
571generators is to make some dependency and hash information available to 571generators is to make some dependency and hash information available to
572the build. This information includes: 572the build. This information includes:
573 573
@@ -577,10 +577,7 @@ the build. This information includes:
577- ``BB_BASEHASH_``\ *filename:taskname*: The base hashes for each 577- ``BB_BASEHASH_``\ *filename:taskname*: The base hashes for each
578 dependent task. 578 dependent task.
579 579
580- ``BBHASHDEPS_``\ *filename:taskname*: The task dependencies for 580- :term:`BB_TASKHASH`: The hash of the currently running task.
581 each task.
582
583- ``BB_TASKHASH``: The hash of the currently running task.
584 581
585It is worth noting that BitBake's "-S" option lets you debug BitBake's 582It is worth noting that BitBake's "-S" option lets you debug BitBake's
586processing of signatures. The options passed to -S allow different 583processing of signatures. The options passed to -S allow different
@@ -589,10 +586,11 @@ or possibly those defined in the metadata/signature handler itself. The
589simplest parameter to pass is "none", which causes a set of signature 586simplest parameter to pass is "none", which causes a set of signature
590information to be written out into ``STAMPS_DIR`` corresponding to the 587information to be written out into ``STAMPS_DIR`` corresponding to the
591targets specified. The other currently available parameter is 588targets specified. The other currently available parameter is
592"printdiff", which causes BitBake to try to establish the closest 589"printdiff", which causes BitBake to try to establish the most recent
593signature match it can (e.g. in the sstate cache) and then run 590signature match it can (e.g. in the sstate cache) and then run
594``bitbake-diffsigs`` over the matches to determine the stamps and delta 591compare the matched signatures to determine the stamps and delta
595where these two stamp trees diverge. 592where these two stamp trees diverge. This can be used to determine why
593tasks need to be re-run in situations where that is not expected.
596 594
597.. note:: 595.. note::
598 596
@@ -647,13 +645,6 @@ compiled binary. To handle this, BitBake calls the
647each successful setscene task to know whether or not it needs to obtain 645each successful setscene task to know whether or not it needs to obtain
648the dependencies of that task. 646the dependencies of that task.
649 647
650Finally, after all the setscene tasks have executed, BitBake calls the
651function listed in
652:term:`BB_SETSCENE_VERIFY_FUNCTION2`
653with the list of tasks BitBake thinks has been "covered". The metadata
654can then ensure that this list is correct and can inform BitBake that it
655wants specific tasks to be run regardless of the setscene result.
656
657You can find more information on setscene metadata in the 648You can find more information on setscene metadata in the
658:ref:`bitbake-user-manual/bitbake-user-manual-metadata:task checksums and setscene` 649:ref:`bitbake-user-manual/bitbake-user-manual-metadata:task checksums and setscene`
659section. 650section.
@@ -666,7 +657,7 @@ builds are when execute, bitbake also supports user defined
666configuration of the `Python 657configuration of the `Python
667logging <https://docs.python.org/3/library/logging.html>`__ facilities 658logging <https://docs.python.org/3/library/logging.html>`__ facilities
668through the :term:`BB_LOGCONFIG` variable. This 659through the :term:`BB_LOGCONFIG` variable. This
669variable defines a json or yaml `logging 660variable defines a JSON or YAML `logging
670configuration <https://docs.python.org/3/library/logging.config.html>`__ 661configuration <https://docs.python.org/3/library/logging.config.html>`__
671that will be intelligently merged into the default configuration. The 662that will be intelligently merged into the default configuration. The
672logging configuration is merged using the following rules: 663logging configuration is merged using the following rules:
@@ -700,9 +691,9 @@ logging configuration is merged using the following rules:
700 adds a filter called ``BitBake.defaultFilter``, both filters will be 691 adds a filter called ``BitBake.defaultFilter``, both filters will be
701 applied to the logger 692 applied to the logger
702 693
703As an example, consider the following user logging configuration file 694As a first example, you can create a ``hashequiv.json`` user logging
704which logs all Hash Equivalence related messages of VERBOSE or higher to 695configuration file to log all Hash Equivalence related messages of ``VERBOSE``
705a file called ``hashequiv.log`` :: 696or higher priority to a file called ``hashequiv.log``::
706 697
707 { 698 {
708 "version": 1, 699 "version": 1,
@@ -731,3 +722,40 @@ a file called ``hashequiv.log`` ::
731 } 722 }
732 } 723 }
733 } 724 }
725
726Then set the :term:`BB_LOGCONFIG` variable in ``conf/local.conf``::
727
728 BB_LOGCONFIG = "hashequiv.json"
729
730Another example is this ``warn.json`` file to log all ``WARNING`` and
731higher priority messages to a ``warn.log`` file::
732
733 {
734 "version": 1,
735 "formatters": {
736 "warnlogFormatter": {
737 "()": "bb.msg.BBLogFormatter",
738 "format": "%(levelname)s: %(message)s"
739 }
740 },
741
742 "handlers": {
743 "warnlog": {
744 "class": "logging.FileHandler",
745 "formatter": "warnlogFormatter",
746 "level": "WARNING",
747 "filename": "warn.log"
748 }
749 },
750
751 "loggers": {
752 "BitBake": {
753 "handlers": ["warnlog"]
754 }
755 },
756
757 "@disable_existing_loggers": false
758 }
759
760Note that BitBake's helper classes for structured logging are implemented in
761``lib/bb/msg.py``.
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
index 6760b10828..a2c2432db1 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
@@ -27,7 +27,7 @@ and unpacking the files is often optionally followed by patching.
27Patching, however, is not covered by this module. 27Patching, however, is not covered by this module.
28 28
29The code to execute the first part of this process, a fetch, looks 29The code to execute the first part of this process, a fetch, looks
30something like the following: :: 30something like the following::
31 31
32 src_uri = (d.getVar('SRC_URI') or "").split() 32 src_uri = (d.getVar('SRC_URI') or "").split()
33 fetcher = bb.fetch2.Fetch(src_uri, d) 33 fetcher = bb.fetch2.Fetch(src_uri, d)
@@ -37,12 +37,12 @@ This code sets up an instance of the fetch class. The instance uses a
37space-separated list of URLs from the :term:`SRC_URI` 37space-separated list of URLs from the :term:`SRC_URI`
38variable and then calls the ``download`` method to download the files. 38variable and then calls the ``download`` method to download the files.
39 39
40The instantiation of the fetch class is usually followed by: :: 40The instantiation of the fetch class is usually followed by::
41 41
42 rootdir = l.getVar('WORKDIR') 42 rootdir = l.getVar('UNPACKDIR')
43 fetcher.unpack(rootdir) 43 fetcher.unpack(rootdir)
44 44
45This code unpacks the downloaded files to the specified by ``WORKDIR``. 45This code unpacks the downloaded files to the specified by ``UNPACKDIR``.
46 46
47.. note:: 47.. note::
48 48
@@ -51,7 +51,7 @@ This code unpacks the downloaded files to the specified by ``WORKDIR``.
51 examine the OpenEmbedded class file ``base.bbclass`` 51 examine the OpenEmbedded class file ``base.bbclass``
52 . 52 .
53 53
54The ``SRC_URI`` and ``WORKDIR`` variables are not hardcoded into the 54The :term:`SRC_URI` and ``UNPACKDIR`` variables are not hardcoded into the
55fetcher, since those fetcher methods can be (and are) called with 55fetcher, since those fetcher methods can be (and are) called with
56different variable names. In OpenEmbedded for example, the shared state 56different variable names. In OpenEmbedded for example, the shared state
57(sstate) code uses the fetch module to fetch the sstate files. 57(sstate) code uses the fetch module to fetch the sstate files.
@@ -64,38 +64,38 @@ URLs by looking for source files in a specific search order:
64 :term:`PREMIRRORS` variable. 64 :term:`PREMIRRORS` variable.
65 65
66- *Source URI:* If pre-mirrors fail, BitBake uses the original URL (e.g 66- *Source URI:* If pre-mirrors fail, BitBake uses the original URL (e.g
67 from ``SRC_URI``). 67 from :term:`SRC_URI`).
68 68
69- *Mirror Sites:* If fetch failures occur, BitBake next uses mirror 69- *Mirror Sites:* If fetch failures occur, BitBake next uses mirror
70 locations as defined by the :term:`MIRRORS` variable. 70 locations as defined by the :term:`MIRRORS` variable.
71 71
72For each URL passed to the fetcher, the fetcher calls the submodule that 72For each URL passed to the fetcher, the fetcher calls the submodule that
73handles that particular URL type. This behavior can be the source of 73handles that particular URL type. This behavior can be the source of
74some confusion when you are providing URLs for the ``SRC_URI`` variable. 74some confusion when you are providing URLs for the :term:`SRC_URI` variable.
75Consider the following two URLs: :: 75Consider the following two URLs::
76 76
77 http://git.yoctoproject.org/git/poky;protocol=git 77 https://git.yoctoproject.org/git/poky;protocol=git
78 git://git.yoctoproject.org/git/poky;protocol=http 78 git://git.yoctoproject.org/git/poky;protocol=http
79 79
80In the former case, the URL is passed to the ``wget`` fetcher, which does not 80In the former case, the URL is passed to the ``wget`` fetcher, which does not
81understand "git". Therefore, the latter case is the correct form since the Git 81understand "git". Therefore, the latter case is the correct form since the Git
82fetcher does know how to use HTTP as a transport. 82fetcher does know how to use HTTP as a transport.
83 83
84Here are some examples that show commonly used mirror definitions: :: 84Here are some examples that show commonly used mirror definitions::
85 85
86 PREMIRRORS ?= "\ 86 PREMIRRORS ?= "\
87 bzr://.*/.\* http://somemirror.org/sources/ \\n \ 87 bzr://.*/.\* http://somemirror.org/sources/ \
88 cvs://.*/.\* http://somemirror.org/sources/ \\n \ 88 cvs://.*/.\* http://somemirror.org/sources/ \
89 git://.*/.\* http://somemirror.org/sources/ \\n \ 89 git://.*/.\* http://somemirror.org/sources/ \
90 hg://.*/.\* http://somemirror.org/sources/ \\n \ 90 hg://.*/.\* http://somemirror.org/sources/ \
91 osc://.*/.\* http://somemirror.org/sources/ \\n \ 91 osc://.*/.\* http://somemirror.org/sources/ \
92 p4://.*/.\* http://somemirror.org/sources/ \\n \ 92 p4://.*/.\* http://somemirror.org/sources/ \
93 svn://.*/.\* http://somemirror.org/sources/ \\n" 93 svn://.*/.\* http://somemirror.org/sources/"
94 94
95 MIRRORS =+ "\ 95 MIRRORS =+ "\
96 ftp://.*/.\* http://somemirror.org/sources/ \\n \ 96 ftp://.*/.\* http://somemirror.org/sources/ \
97 http://.*/.\* http://somemirror.org/sources/ \\n \ 97 http://.*/.\* http://somemirror.org/sources/ \
98 https://.*/.\* http://somemirror.org/sources/ \\n" 98 https://.*/.\* http://somemirror.org/sources/"
99 99
100It is useful to note that BitBake 100It is useful to note that BitBake
101supports cross-URLs. It is possible to mirror a Git repository on an 101supports cross-URLs. It is possible to mirror a Git repository on an
@@ -110,26 +110,26 @@ which is specified by the :term:`DL_DIR` variable.
110File integrity is of key importance for reproducing builds. For 110File integrity is of key importance for reproducing builds. For
111non-local archive downloads, the fetcher code can verify SHA-256 and MD5 111non-local archive downloads, the fetcher code can verify SHA-256 and MD5
112checksums to ensure the archives have been downloaded correctly. You can 112checksums to ensure the archives have been downloaded correctly. You can
113specify these checksums by using the ``SRC_URI`` variable with the 113specify these checksums by using the :term:`SRC_URI` variable with the
114appropriate varflags as follows: :: 114appropriate varflags as follows::
115 115
116 SRC_URI[md5sum] = "value" 116 SRC_URI[md5sum] = "value"
117 SRC_URI[sha256sum] = "value" 117 SRC_URI[sha256sum] = "value"
118 118
119You can also specify the checksums as 119You can also specify the checksums as
120parameters on the ``SRC_URI`` as shown below: :: 120parameters on the :term:`SRC_URI` as shown below::
121 121
122 SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d" 122 SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d"
123 123
124If multiple URIs exist, you can specify the checksums either directly as 124If multiple URIs exist, you can specify the checksums either directly as
125in the previous example, or you can name the URLs. The following syntax 125in the previous example, or you can name the URLs. The following syntax
126shows how you name the URIs: :: 126shows how you name the URIs::
127 127
128 SRC_URI = "http://example.com/foobar.tar.bz2;name=foo" 128 SRC_URI = "http://example.com/foobar.tar.bz2;name=foo"
129 SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d 129 SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d
130 130
131After a file has been downloaded and 131After a file has been downloaded and
132has had its checksum checked, a ".done" stamp is placed in ``DL_DIR``. 132has had its checksum checked, a ".done" stamp is placed in :term:`DL_DIR`.
133BitBake uses this stamp during subsequent builds to avoid downloading or 133BitBake uses this stamp during subsequent builds to avoid downloading or
134comparing a checksum for the file again. 134comparing a checksum for the file again.
135 135
@@ -144,6 +144,10 @@ download without a checksum triggers an error message. The
144make any attempted network access a fatal error, which is useful for 144make any attempted network access a fatal error, which is useful for
145checking that mirrors are complete as well as other things. 145checking that mirrors are complete as well as other things.
146 146
147If :term:`BB_CHECK_SSL_CERTS` is set to ``0`` then SSL certificate checking will
148be disabled. This variable defaults to ``1`` so SSL certificates are normally
149checked.
150
147.. _bb-the-unpack: 151.. _bb-the-unpack:
148 152
149The Unpack 153The Unpack
@@ -163,8 +167,8 @@ govern the behavior of the unpack stage:
163- *dos:* Applies to ``.zip`` and ``.jar`` files and specifies whether 167- *dos:* Applies to ``.zip`` and ``.jar`` files and specifies whether
164 to use DOS line ending conversion on text files. 168 to use DOS line ending conversion on text files.
165 169
166- *basepath:* Instructs the unpack stage to strip the specified 170- *striplevel:* Strip specified number of leading components (levels)
167 directories from the source path when unpacking. 171 from file names on extraction
168 172
169- *subdir:* Unpacks the specific URL to the specified subdirectory 173- *subdir:* Unpacks the specific URL to the specified subdirectory
170 within the root directory. 174 within the root directory.
@@ -204,7 +208,7 @@ time the ``download()`` method is called.
204If you specify a directory, the entire directory is unpacked. 208If you specify a directory, the entire directory is unpacked.
205 209
206Here are a couple of example URLs, the first relative and the second 210Here are a couple of example URLs, the first relative and the second
207absolute: :: 211absolute::
208 212
209 SRC_URI = "file://relativefile.patch" 213 SRC_URI = "file://relativefile.patch"
210 SRC_URI = "file:///Users/ich/very_important_software" 214 SRC_URI = "file:///Users/ich/very_important_software"
@@ -225,7 +229,12 @@ downloaded file is useful for avoiding collisions in
225:term:`DL_DIR` when dealing with multiple files that 229:term:`DL_DIR` when dealing with multiple files that
226have the same name. 230have the same name.
227 231
228Some example URLs are as follows: :: 232If a username and password are specified in the ``SRC_URI``, a Basic
233Authorization header will be added to each request, including across redirects.
234To instead limit the Authorization header to the first request, add
235"redirectauth=0" to the list of parameters.
236
237Some example URLs are as follows::
229 238
230 SRC_URI = "http://oe.handhelds.org/not_there.aac" 239 SRC_URI = "http://oe.handhelds.org/not_there.aac"
231 SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac" 240 SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac"
@@ -235,15 +244,13 @@ Some example URLs are as follows: ::
235 244
236 Because URL parameters are delimited by semi-colons, this can 245 Because URL parameters are delimited by semi-colons, this can
237 introduce ambiguity when parsing URLs that also contain semi-colons, 246 introduce ambiguity when parsing URLs that also contain semi-colons,
238 for example: 247 for example::
239 ::
240 248
241 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47" 249 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47"
242 250
243 251
244 Such URLs should should be modified by replacing semi-colons with '&' 252 Such URLs should should be modified by replacing semi-colons with '&'
245 characters: 253 characters::
246 ::
247 254
248 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47" 255 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47"
249 256
@@ -251,8 +258,7 @@ Some example URLs are as follows: ::
251 In most cases this should work. Treating semi-colons and '&' in 258 In most cases this should work. Treating semi-colons and '&' in
252 queries identically is recommended by the World Wide Web Consortium 259 queries identically is recommended by the World Wide Web Consortium
253 (W3C). Note that due to the nature of the URL, you may have to 260 (W3C). Note that due to the nature of the URL, you may have to
254 specify the name of the downloaded file as well: 261 specify the name of the downloaded file as well::
255 ::
256 262
257 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47;downloadfilename=myfile.bz2" 263 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47;downloadfilename=myfile.bz2"
258 264
@@ -321,7 +327,7 @@ The supported parameters are as follows:
321 327
322- *"port":* The port to which the CVS server connects. 328- *"port":* The port to which the CVS server connects.
323 329
324Some example URLs are as follows: :: 330Some example URLs are as follows::
325 331
326 SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext" 332 SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
327 SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat" 333 SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
@@ -363,7 +369,7 @@ The supported parameters are as follows:
363 username is different than the username used in the main URL, which 369 username is different than the username used in the main URL, which
364 is passed to the subversion command. 370 is passed to the subversion command.
365 371
366Following are three examples using svn: :: 372Following are three examples using svn::
367 373
368 SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667" 374 SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667"
369 SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh" 375 SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh"
@@ -390,6 +396,19 @@ This fetcher supports the following parameters:
390 protocol is "file". You can also use "http", "https", "ssh" and 396 protocol is "file". You can also use "http", "https", "ssh" and
391 "rsync". 397 "rsync".
392 398
399 .. note::
400
401 When ``protocol`` is "ssh", the URL expected in :term:`SRC_URI` differs
402 from the one that is typically passed to ``git clone`` command and provided
403 by the Git server to fetch from. For example, the URL returned by GitLab
404 server for ``mesa`` when cloning over SSH is
405 ``git@gitlab.freedesktop.org:mesa/mesa.git``, however the expected URL in
406 :term:`SRC_URI` is the following::
407
408 SRC_URI = "git://git@gitlab.freedesktop.org/mesa/mesa.git;branch=main;protocol=ssh;..."
409
410 Note the ``:`` character changed for a ``/`` before the path to the project.
411
393- *"nocheckout":* Tells the fetcher to not checkout source code when 412- *"nocheckout":* Tells the fetcher to not checkout source code when
394 unpacking when set to "1". Set this option for the URL where there is 413 unpacking when set to "1". Set this option for the URL where there is
395 a custom routine to checkout code. The default is "0". 414 a custom routine to checkout code. The default is "0".
@@ -405,17 +424,17 @@ This fetcher supports the following parameters:
405 424
406- *"nobranch":* Tells the fetcher to not check the SHA validation for 425- *"nobranch":* Tells the fetcher to not check the SHA validation for
407 the branch when set to "1". The default is "0". Set this option for 426 the branch when set to "1". The default is "0". Set this option for
408 the recipe that refers to the commit that is valid for a tag instead 427 the recipe that refers to the commit that is valid for any namespace
409 of the branch. 428 (branch, tag, ...) instead of the branch.
410 429
411- *"bareclone":* Tells the fetcher to clone a bare clone into the 430- *"bareclone":* Tells the fetcher to clone a bare clone into the
412 destination directory without checking out a working tree. Only the 431 destination directory without checking out a working tree. Only the
413 raw Git metadata is provided. This parameter implies the "nocheckout" 432 raw Git metadata is provided. This parameter implies the "nocheckout"
414 parameter as well. 433 parameter as well.
415 434
416- *"branch":* The branch(es) of the Git tree to clone. If unset, this 435- *"branch":* The branch(es) of the Git tree to clone. Unless
417 is assumed to be "master". The number of branch parameters much match 436 "nobranch" is set to "1", this is a mandatory parameter. The number of
418 the number of name parameters. 437 branch parameters must match the number of name parameters.
419 438
420- *"rev":* The revision to use for the checkout. The default is 439- *"rev":* The revision to use for the checkout. The default is
421 "master". 440 "master".
@@ -436,10 +455,28 @@ This fetcher supports the following parameters:
436 parameter implies no branch and only works when the transfer protocol 455 parameter implies no branch and only works when the transfer protocol
437 is ``file://``. 456 is ``file://``.
438 457
439Here are some example URLs: :: 458Here are some example URLs::
459
460 SRC_URI = "git://github.com/fronteed/icheck.git;protocol=https;branch=${PV};tag=${PV}"
461 SRC_URI = "git://github.com/asciidoc/asciidoc-py;protocol=https;branch=main"
462 SRC_URI = "git://git@gitlab.freedesktop.org/mesa/mesa.git;branch=main;protocol=ssh;..."
463
464.. note::
440 465
441 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;tag=version-1" 466 Specifying passwords directly in ``git://`` urls is not supported.
442 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http" 467 There are several reasons: :term:`SRC_URI` is often written out to logs and
468 other places, and that could easily leak passwords; it is also all too
469 easy to share metadata without removing passwords. SSH keys, ``~/.netrc``
470 and ``~/.ssh/config`` files can be used as alternatives.
471
472Using tags with the git fetcher may cause surprising behaviour. Bitbake needs to
473resolve the tag to a specific revision and to do that, it has to connect to and use
474the upstream repository. This is because the revision the tags point at can change and
475we've seen cases of this happening in well known public repositories. This can mean
476many more network connections than expected and recipes may be reparsed at every build.
477Source mirrors will also be bypassed as the upstream repository is the only source
478of truth to resolve the revision accurately. For these reasons, whilst the fetcher
479can support tags, we recommend being specific about revisions in recipes.
443 480
444.. _gitsm-fetcher: 481.. _gitsm-fetcher:
445 482
@@ -475,7 +512,7 @@ repository.
475 512
476To use this fetcher, make sure your recipe has proper 513To use this fetcher, make sure your recipe has proper
477:term:`SRC_URI`, :term:`SRCREV`, and 514:term:`SRC_URI`, :term:`SRCREV`, and
478:term:`PV` settings. Here is an example: :: 515:term:`PV` settings. Here is an example::
479 516
480 SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module" 517 SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module"
481 SRCREV = "EXAMPLE_CLEARCASE_TAG" 518 SRCREV = "EXAMPLE_CLEARCASE_TAG"
@@ -484,7 +521,7 @@ To use this fetcher, make sure your recipe has proper
484The fetcher uses the ``rcleartool`` or 521The fetcher uses the ``rcleartool`` or
485``cleartool`` remote client, depending on which one is available. 522``cleartool`` remote client, depending on which one is available.
486 523
487Following are options for the ``SRC_URI`` statement: 524Following are options for the :term:`SRC_URI` statement:
488 525
489- *vob*: The name, which must include the prepending "/" character, 526- *vob*: The name, which must include the prepending "/" character,
490 of the ClearCase VOB. This option is required. 527 of the ClearCase VOB. This option is required.
@@ -497,7 +534,7 @@ Following are options for the ``SRC_URI`` statement:
497 The module and vob options are combined to create the load rule in the 534 The module and vob options are combined to create the load rule in the
498 view config spec. As an example, consider the vob and module values from 535 view config spec. As an example, consider the vob and module values from
499 the SRC_URI statement at the start of this section. Combining those values 536 the SRC_URI statement at the start of this section. Combining those values
500 results in the following: :: 537 results in the following::
501 538
502 load /example_vob/example_module 539 load /example_vob/example_module
503 540
@@ -546,32 +583,32 @@ password if you do not wish to keep those values in a recipe itself. If
546you choose not to use ``P4CONFIG``, or to explicitly set variables that 583you choose not to use ``P4CONFIG``, or to explicitly set variables that
547``P4CONFIG`` can contain, you can specify the ``P4PORT`` value, which is 584``P4CONFIG`` can contain, you can specify the ``P4PORT`` value, which is
548the server's URL and port number, and you can specify a username and 585the server's URL and port number, and you can specify a username and
549password directly in your recipe within ``SRC_URI``. 586password directly in your recipe within :term:`SRC_URI`.
550 587
551Here is an example that relies on ``P4CONFIG`` to specify the server URL 588Here is an example that relies on ``P4CONFIG`` to specify the server URL
552and port, username, and password, and fetches the Head Revision: :: 589and port, username, and password, and fetches the Head Revision::
553 590
554 SRC_URI = "p4://example-depot/main/source/..." 591 SRC_URI = "p4://example-depot/main/source/..."
555 SRCREV = "${AUTOREV}" 592 SRCREV = "${AUTOREV}"
556 PV = "p4-${SRCPV}" 593 PV = "p4-${SRCPV}"
557 S = "${WORKDIR}/p4" 594 S = "${UNPACKDIR}/p4"
558 595
559Here is an example that specifies the server URL and port, username, and 596Here is an example that specifies the server URL and port, username, and
560password, and fetches a Revision based on a Label: :: 597password, and fetches a Revision based on a Label::
561 598
562 P4PORT = "tcp:p4server.example.net:1666" 599 P4PORT = "tcp:p4server.example.net:1666"
563 SRC_URI = "p4://user:passwd@example-depot/main/source/..." 600 SRC_URI = "p4://user:passwd@example-depot/main/source/..."
564 SRCREV = "release-1.0" 601 SRCREV = "release-1.0"
565 PV = "p4-${SRCPV}" 602 PV = "p4-${SRCPV}"
566 S = "${WORKDIR}/p4" 603 S = "${UNPACKDIR}/p4"
567 604
568.. note:: 605.. note::
569 606
570 You should always set S to "${WORKDIR}/p4" in your recipe. 607 You should always set S to "${UNPACKDIR}/p4" in your recipe.
571 608
572By default, the fetcher strips the depot location from the local file paths. In 609By default, the fetcher strips the depot location from the local file paths. In
573the above example, the content of ``example-depot/main/source/`` will be placed 610the above example, the content of ``example-depot/main/source/`` will be placed
574in ``${WORKDIR}/p4``. For situations where preserving parts of the remote depot 611in ``${UNPACKDIR}/p4``. For situations where preserving parts of the remote depot
575paths locally is desirable, the fetcher supports two parameters: 612paths locally is desirable, the fetcher supports two parameters:
576 613
577- *"module":* 614- *"module":*
@@ -583,7 +620,7 @@ paths locally is desirable, the fetcher supports two parameters:
583 paths locally for the specified location, even in combination with the 620 paths locally for the specified location, even in combination with the
584 ``module`` parameter. 621 ``module`` parameter.
585 622
586Here is an example use of the the ``module`` parameter: :: 623Here is an example use of the the ``module`` parameter::
587 624
588 SRC_URI = "p4://user:passwd@example-depot/main;module=source/..." 625 SRC_URI = "p4://user:passwd@example-depot/main;module=source/..."
589 626
@@ -591,7 +628,7 @@ In this case, the content of the top-level directory ``source/`` will be fetched
591to ``${P4DIR}``, including the directory itself. The top-level directory will 628to ``${P4DIR}``, including the directory itself. The top-level directory will
592be accesible at ``${P4DIR}/source/``. 629be accesible at ``${P4DIR}/source/``.
593 630
594Here is an example use of the the ``remotepath`` parameter: :: 631Here is an example use of the the ``remotepath`` parameter::
595 632
596 SRC_URI = "p4://user:passwd@example-depot/main;module=source/...;remotepath=keep" 633 SRC_URI = "p4://user:passwd@example-depot/main;module=source/...;remotepath=keep"
597 634
@@ -619,11 +656,166 @@ This fetcher supports the following parameters:
619 656
620- *"manifest":* Name of the manifest file (default: ``default.xml``). 657- *"manifest":* Name of the manifest file (default: ``default.xml``).
621 658
622Here are some example URLs: :: 659Here are some example URLs::
623 660
624 SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml" 661 SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml"
625 SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml" 662 SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml"
626 663
664.. _az-fetcher:
665
666Az Fetcher (``az://``)
667--------------------------
668
669This submodule fetches data from an
670`Azure Storage account <https://docs.microsoft.com/en-us/azure/storage/>`__ ,
671it inherits its functionality from the HTTP wget fetcher, but modifies its
672behavior to accomodate the usage of a
673`Shared Access Signature (SAS) <https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview>`__
674for non-public data.
675
676Such functionality is set by the variable:
677
678- :term:`AZ_SAS`: The Azure Storage Shared Access Signature provides secure
679 delegate access to resources, if this variable is set, the Az Fetcher will
680 use it when fetching artifacts from the cloud.
681
682You can specify the AZ_SAS variable prefixed with a ? as shown below::
683
684 AZ_SAS = "?se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>"
685
686Here is an example URL::
687
688 SRC_URI = "az://<azure-storage-account>.blob.core.windows.net/<foo_container>/<bar_file>"
689
690It can also be used when setting mirrors definitions using the :term:`PREMIRRORS` variable.
691
692.. _gcp-fetcher:
693
694GCP Fetcher (``gs://``)
695--------------------------
696
697This submodule fetches data from a
698`Google Cloud Storage Bucket <https://cloud.google.com/storage/docs/buckets>`__.
699It uses the `Google Cloud Storage Python Client <https://cloud.google.com/python/docs/reference/storage/latest>`__
700to check the status of objects in the bucket and download them.
701The use of the Python client makes it substantially faster than using command
702line tools such as gsutil.
703
704The fetcher requires the Google Cloud Storage Python Client to be installed, along
705with the gsutil tool.
706
707The fetcher requires that the machine has valid credentials for accessing the
708chosen bucket. Instructions for authentication can be found in the
709`Google Cloud documentation <https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev>`__.
710
711If it used from the OpenEmbedded build system, the fetcher can be used for
712fetching sstate artifacts from a GCS bucket by specifying the
713``SSTATE_MIRRORS`` variable as shown below::
714
715 SSTATE_MIRRORS ?= "\
716 file://.* gs://<bucket name>/PATH \
717 "
718
719The fetcher can also be used in recipes::
720
721 SRC_URI = "gs://<bucket name>/<foo_container>/<bar_file>"
722
723However, the checksum of the file should be also be provided::
724
725 SRC_URI[sha256sum] = "<sha256 string>"
726
727.. _crate-fetcher:
728
729Crate Fetcher (``crate://``)
730----------------------------
731
732This submodule fetches code for
733`Rust language "crates" <https://doc.rust-lang.org/reference/glossary.html?highlight=crate#crate>`__
734corresponding to Rust libraries and programs to compile. Such crates are typically shared
735on https://crates.io/ but this fetcher supports other crate registries too.
736
737The format for the :term:`SRC_URI` setting must be::
738
739 SRC_URI = "crate://REGISTRY/NAME/VERSION"
740
741Here is an example URL::
742
743 SRC_URI = "crate://crates.io/glob/0.2.11"
744
745.. _npm-fetcher:
746
747NPM Fetcher (``npm://``)
748------------------------
749
750This submodule fetches source code from an
751`NPM <https://en.wikipedia.org/wiki/Npm_(software)>`__
752Javascript package registry.
753
754The format for the :term:`SRC_URI` setting must be::
755
756 SRC_URI = "npm://some.registry.url;ParameterA=xxx;ParameterB=xxx;..."
757
758This fetcher supports the following parameters:
759
760- *"package":* The NPM package name. This is a mandatory parameter.
761
762- *"version":* The NPM package version. This is a mandatory parameter.
763
764- *"downloadfilename":* Specifies the filename used when storing the downloaded file.
765
766- *"destsuffix":* Specifies the directory to use to unpack the package (default: ``npm``).
767
768Note that NPM fetcher only fetches the package source itself. The dependencies
769can be fetched through the `npmsw-fetcher`_.
770
771Here is an example URL with both fetchers::
772
773 SRC_URI = " \
774 npm://registry.npmjs.org/;package=cute-files;version=${PV} \
775 npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \
776 "
777
778See :yocto_docs:`Creating Node Package Manager (NPM) Packages
779</dev-manual/packages.html#creating-node-package-manager-npm-packages>`
780in the Yocto Project manual for details about using
781:yocto_docs:`devtool <https://docs.yoctoproject.org/ref-manual/devtool-reference.html>`
782to automatically create a recipe from an NPM URL.
783
784.. _npmsw-fetcher:
785
786NPM shrinkwrap Fetcher (``npmsw://``)
787-------------------------------------
788
789This submodule fetches source code from an
790`NPM shrinkwrap <https://docs.npmjs.com/cli/v8/commands/npm-shrinkwrap>`__
791description file, which lists the dependencies
792of an NPM package while locking their versions.
793
794The format for the :term:`SRC_URI` setting must be::
795
796 SRC_URI = "npmsw://some.registry.url;ParameterA=xxx;ParameterB=xxx;..."
797
798This fetcher supports the following parameters:
799
800- *"dev":* Set this parameter to ``1`` to install "devDependencies".
801
802- *"destsuffix":* Specifies the directory to use to unpack the dependencies
803 (``${S}`` by default).
804
805Note that the shrinkwrap file can also be provided by the recipe for
806the package which has such dependencies, for example::
807
808 SRC_URI = " \
809 npm://registry.npmjs.org/;package=cute-files;version=${PV} \
810 npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \
811 "
812
813Such a file can automatically be generated using
814:yocto_docs:`devtool <https://docs.yoctoproject.org/ref-manual/devtool-reference.html>`
815as described in the :yocto_docs:`Creating Node Package Manager (NPM) Packages
816</dev-manual/packages.html#creating-node-package-manager-npm-packages>`
817section of the Yocto Project.
818
627Other Fetchers 819Other Fetchers
628-------------- 820--------------
629 821
@@ -633,10 +825,10 @@ Fetch submodules also exist for the following:
633 825
634- Mercurial (``hg://``) 826- Mercurial (``hg://``)
635 827
636- npm (``npm://``)
637
638- OSC (``osc://``) 828- OSC (``osc://``)
639 829
830- S3 (``s3://``)
831
640- Secure FTP (``sftp://``) 832- Secure FTP (``sftp://``)
641 833
642- Secure Shell (``ssh://``) 834- Secure Shell (``ssh://``)
@@ -649,4 +841,4 @@ submodules. However, you might find the code helpful and readable.
649Auto Revisions 841Auto Revisions
650============== 842==============
651 843
652We need to document ``AUTOREV`` and ``SRCREV_FORMAT`` here. 844We need to document ``AUTOREV`` and :term:`SRCREV_FORMAT` here.
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst
index e3fd321588..654196ca24 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst
@@ -18,28 +18,32 @@ it.
18Obtaining BitBake 18Obtaining BitBake
19================= 19=================
20 20
21See the :ref:`bitbake-user-manual/bitbake-user-manual-hello:obtaining bitbake` section for 21See the :ref:`bitbake-user-manual/bitbake-user-manual-intro:obtaining bitbake` section for
22information on how to obtain BitBake. Once you have the source code on 22information on how to obtain BitBake. Once you have the source code on
23your machine, the BitBake directory appears as follows: :: 23your machine, the BitBake directory appears as follows::
24 24
25 $ ls -al 25 $ ls -al
26 total 100 26 total 108
27 drwxrwxr-x. 9 wmat wmat 4096 Jan 31 13:44 . 27 drwxr-xr-x 9 fawkh 10000 4096 feb 24 12:10 .
28 drwxrwxr-x. 3 wmat wmat 4096 Feb 4 10:45 .. 28 drwx------ 36 fawkh 10000 4096 mar 2 17:00 ..
29 -rw-rw-r--. 1 wmat wmat 365 Nov 26 04:55 AUTHORS 29 -rw-r--r-- 1 fawkh 10000 365 feb 24 12:10 AUTHORS
30 drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 bin 30 drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 bin
31 drwxrwxr-x. 4 wmat wmat 4096 Jan 31 13:44 build 31 -rw-r--r-- 1 fawkh 10000 16501 feb 24 12:10 ChangeLog
32 -rw-rw-r--. 1 wmat wmat 16501 Nov 26 04:55 ChangeLog 32 drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 classes
33 drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 classes 33 drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 conf
34 drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 conf 34 drwxr-xr-x 5 fawkh 10000 4096 feb 24 12:10 contrib
35 drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 contrib 35 drwxr-xr-x 6 fawkh 10000 4096 feb 24 12:10 doc
36 -rw-rw-r--. 1 wmat wmat 17987 Nov 26 04:55 COPYING 36 drwxr-xr-x 8 fawkh 10000 4096 mar 2 16:26 .git
37 drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 doc 37 -rw-r--r-- 1 fawkh 10000 31 feb 24 12:10 .gitattributes
38 -rw-rw-r--. 1 wmat wmat 69 Nov 26 04:55 .gitignore 38 -rw-r--r-- 1 fawkh 10000 392 feb 24 12:10 .gitignore
39 -rw-rw-r--. 1 wmat wmat 849 Nov 26 04:55 HEADER 39 drwxr-xr-x 13 fawkh 10000 4096 feb 24 12:11 lib
40 drwxrwxr-x. 5 wmat wmat 4096 Jan 31 13:44 lib 40 -rw-r--r-- 1 fawkh 10000 1224 feb 24 12:10 LICENSE
41 -rw-rw-r--. 1 wmat wmat 195 Nov 26 04:55 MANIFEST.in 41 -rw-r--r-- 1 fawkh 10000 15394 feb 24 12:10 LICENSE.GPL-2.0-only
42 -rw-rw-r--. 1 wmat wmat 2887 Nov 26 04:55 TODO 42 -rw-r--r-- 1 fawkh 10000 1286 feb 24 12:10 LICENSE.MIT
43 -rw-r--r-- 1 fawkh 10000 229 feb 24 12:10 MANIFEST.in
44 -rw-r--r-- 1 fawkh 10000 2413 feb 24 12:10 README
45 -rw-r--r-- 1 fawkh 10000 43 feb 24 12:10 toaster-requirements.txt
46 -rw-r--r-- 1 fawkh 10000 2887 feb 24 12:10 TODO
43 47
44At this point, you should have BitBake cloned to a directory that 48At this point, you should have BitBake cloned to a directory that
45matches the previous listing except for dates and user names. 49matches the previous listing except for dates and user names.
@@ -49,10 +53,10 @@ Setting Up the BitBake Environment
49 53
50First, you need to be sure that you can run BitBake. Set your working 54First, you need to be sure that you can run BitBake. Set your working
51directory to where your local BitBake files are and run the following 55directory to where your local BitBake files are and run the following
52command: :: 56command::
53 57
54 $ ./bin/bitbake --version 58 $ ./bin/bitbake --version
55 BitBake Build Tool Core version 1.23.0, bitbake version 1.23.0 59 BitBake Build Tool Core version 2.3.1
56 60
57The console output tells you what version 61The console output tells you what version
58you are running. 62you are running.
@@ -61,14 +65,14 @@ The recommended method to run BitBake is from a directory of your
61choice. To be able to run BitBake from any directory, you need to add 65choice. To be able to run BitBake from any directory, you need to add
62the executable binary to your binary to your shell's environment 66the executable binary to your binary to your shell's environment
63``PATH`` variable. First, look at your current ``PATH`` variable by 67``PATH`` variable. First, look at your current ``PATH`` variable by
64entering the following: :: 68entering the following::
65 69
66 $ echo $PATH 70 $ echo $PATH
67 71
68Next, add the directory location 72Next, add the directory location
69for the BitBake binary to the ``PATH``. Here is an example that adds the 73for the BitBake binary to the ``PATH``. Here is an example that adds the
70``/home/scott-lenovo/bitbake/bin`` directory to the front of the 74``/home/scott-lenovo/bitbake/bin`` directory to the front of the
71``PATH`` variable: :: 75``PATH`` variable::
72 76
73 $ export PATH=/home/scott-lenovo/bitbake/bin:$PATH 77 $ export PATH=/home/scott-lenovo/bitbake/bin:$PATH
74 78
@@ -99,7 +103,7 @@ discussion mailing list about the BitBake build tool.
99 103
100 This example was inspired by and drew heavily from 104 This example was inspired by and drew heavily from
101 `Mailing List post - The BitBake equivalent of "Hello, World!" 105 `Mailing List post - The BitBake equivalent of "Hello, World!"
102 <http://www.mail-archive.com/yocto@yoctoproject.org/msg09379.html>`_. 106 <https://www.mail-archive.com/yocto@yoctoproject.org/msg09379.html>`_.
103 107
104As stated earlier, the goal of this example is to eventually compile 108As stated earlier, the goal of this example is to eventually compile
105"Hello World". However, it is unknown what BitBake needs and what you 109"Hello World". However, it is unknown what BitBake needs and what you
@@ -116,7 +120,7 @@ Following is the complete "Hello World" example.
116 120
117#. **Create a Project Directory:** First, set up a directory for the 121#. **Create a Project Directory:** First, set up a directory for the
118 "Hello World" project. Here is how you can do so in your home 122 "Hello World" project. Here is how you can do so in your home
119 directory: :: 123 directory::
120 124
121 $ mkdir ~/hello 125 $ mkdir ~/hello
122 $ cd ~/hello 126 $ cd ~/hello
@@ -127,41 +131,26 @@ Following is the complete "Hello World" example.
127 directory is a good way to isolate your project. 131 directory is a good way to isolate your project.
128 132
129#. **Run BitBake:** At this point, you have nothing but a project 133#. **Run BitBake:** At this point, you have nothing but a project
130 directory. Run the ``bitbake`` command and see what it does: :: 134 directory. Run the ``bitbake`` command and see what it does::
131 135
132 $ bitbake 136 $ bitbake
133 The BBPATH variable is not set and bitbake did not 137 ERROR: The BBPATH variable is not set and bitbake did not find a conf/bblayers.conf file in the expected location.
134 find a conf/bblayers.conf file in the expected location.
135 Maybe you accidentally invoked bitbake from the wrong directory? 138 Maybe you accidentally invoked bitbake from the wrong directory?
136 DEBUG: Removed the following variables from the environment:
137 GNOME_DESKTOP_SESSION_ID, XDG_CURRENT_DESKTOP,
138 GNOME_KEYRING_CONTROL, DISPLAY, SSH_AGENT_PID, LANG, no_proxy,
139 XDG_SESSION_PATH, XAUTHORITY, SESSION_MANAGER, SHLVL,
140 MANDATORY_PATH, COMPIZ_CONFIG_PROFILE, WINDOWID, EDITOR,
141 GPG_AGENT_INFO, SSH_AUTH_SOCK, GDMSESSION, GNOME_KEYRING_PID,
142 XDG_SEAT_PATH, XDG_CONFIG_DIRS, LESSOPEN, DBUS_SESSION_BUS_ADDRESS,
143 _, XDG_SESSION_COOKIE, DESKTOP_SESSION, LESSCLOSE, DEFAULTS_PATH,
144 UBUNTU_MENUPROXY, OLDPWD, XDG_DATA_DIRS, COLORTERM, LS_COLORS
145
146 The majority of this output is specific to environment variables that
147 are not directly relevant to BitBake. However, the very first
148 message regarding the ``BBPATH`` variable and the
149 ``conf/bblayers.conf`` file is relevant.
150 139
151 When you run BitBake, it begins looking for metadata files. The 140 When you run BitBake, it begins looking for metadata files. The
152 :term:`BBPATH` variable is what tells BitBake where 141 :term:`BBPATH` variable is what tells BitBake where
153 to look for those files. ``BBPATH`` is not set and you need to set 142 to look for those files. :term:`BBPATH` is not set and you need to set
154 it. Without ``BBPATH``, BitBake cannot find any configuration files 143 it. Without :term:`BBPATH`, BitBake cannot find any configuration files
155 (``.conf``) or recipe files (``.bb``) at all. BitBake also cannot 144 (``.conf``) or recipe files (``.bb``) at all. BitBake also cannot
156 find the ``bitbake.conf`` file. 145 find the ``bitbake.conf`` file.
157 146
158#. **Setting BBPATH:** For this example, you can set ``BBPATH`` in 147#. **Setting BBPATH:** For this example, you can set :term:`BBPATH` in
159 the same manner that you set ``PATH`` earlier in the appendix. You 148 the same manner that you set ``PATH`` earlier in the appendix. You
160 should realize, though, that it is much more flexible to set the 149 should realize, though, that it is much more flexible to set the
161 ``BBPATH`` variable up in a configuration file for each project. 150 :term:`BBPATH` variable up in a configuration file for each project.
162 151
163 From your shell, enter the following commands to set and export the 152 From your shell, enter the following commands to set and export the
164 ``BBPATH`` variable: :: 153 :term:`BBPATH` variable::
165 154
166 $ BBPATH="projectdirectory" 155 $ BBPATH="projectdirectory"
167 $ export BBPATH 156 $ export BBPATH
@@ -175,24 +164,18 @@ Following is the complete "Hello World" example.
175 ("~") character as BitBake does not expand that character as the 164 ("~") character as BitBake does not expand that character as the
176 shell would. 165 shell would.
177 166
178#. **Run BitBake:** Now that you have ``BBPATH`` defined, run the 167#. **Run BitBake:** Now that you have :term:`BBPATH` defined, run the
179 ``bitbake`` command again: :: 168 ``bitbake`` command again::
180 169
181 $ bitbake 170 $ bitbake
182 ERROR: Traceback (most recent call last): 171 ERROR: Unable to parse /home/scott-lenovo/bitbake/lib/bb/parse/__init__.py
183 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped 172 Traceback (most recent call last):
184 return func(fn, *args) 173 File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 127, in resolve_file(fn='conf/bitbake.conf', d=<bb.data_smart.DataSmart object at 0x7f22919a3df0>):
185 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 173, in parse_config_file 174 if not newfn:
186 return bb.parse.handle(fn, data, include) 175 > raise IOError(errno.ENOENT, "file %s not found in %s" % (fn, bbpath))
187 File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 99, in handle 176 fn = newfn
188 return h['handle'](fn, data, include) 177 FileNotFoundError: [Errno 2] file conf/bitbake.conf not found in <projectdirectory>
189 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 120, in handle 178
190 abs_fn = resolve_file(fn, data)
191 File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 117, in resolve_file
192 raise IOError("file %s not found in %s" % (fn, bbpath))
193 IOError: file conf/bitbake.conf not found in /home/scott-lenovo/hello
194
195 ERROR: Unable to parse conf/bitbake.conf: file conf/bitbake.conf not found in /home/scott-lenovo/hello
196 179
197 This sample output shows that BitBake could not find the 180 This sample output shows that BitBake could not find the
198 ``conf/bitbake.conf`` file in the project directory. This file is 181 ``conf/bitbake.conf`` file in the project directory. This file is
@@ -205,18 +188,18 @@ Following is the complete "Hello World" example.
205 recipe files. For this example, you need to create the file in your 188 recipe files. For this example, you need to create the file in your
206 project directory and define some key BitBake variables. For more 189 project directory and define some key BitBake variables. For more
207 information on the ``bitbake.conf`` file, see 190 information on the ``bitbake.conf`` file, see
208 http://git.openembedded.org/bitbake/tree/conf/bitbake.conf. 191 https://git.openembedded.org/bitbake/tree/conf/bitbake.conf.
209 192
210 Use the following commands to create the ``conf`` directory in the 193 Use the following commands to create the ``conf`` directory in the
211 project directory: :: 194 project directory::
212 195
213 $ mkdir conf 196 $ mkdir conf
214 197
215 From within the ``conf`` directory, 198 From within the ``conf`` directory,
216 use some editor to create the ``bitbake.conf`` so that it contains 199 use some editor to create the ``bitbake.conf`` so that it contains
217 the following: :: 200 the following::
218 201
219 PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}" 202 PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
220 203
221 TMPDIR = "${TOPDIR}/tmp" 204 TMPDIR = "${TOPDIR}/tmp"
222 CACHE = "${TMPDIR}/cache" 205 CACHE = "${TMPDIR}/cache"
@@ -226,12 +209,12 @@ Following is the complete "Hello World" example.
226 209
227 .. note:: 210 .. note::
228 211
229 Without a value for PN , the variables STAMP , T , and B , prevent more 212 Without a value for :term:`PN`, the variables :term:`STAMP`, :term:`T`, and :term:`B`, prevent more
230 than one recipe from working. You can fix this by either setting PN to 213 than one recipe from working. You can fix this by either setting :term:`PN` to
231 have a value similar to what OpenEmbedded and BitBake use in the default 214 have a value similar to what OpenEmbedded and BitBake use in the default
232 bitbake.conf file (see previous example). Or, by manually updating each 215 ``bitbake.conf`` file (see previous example). Or, by manually updating each
233 recipe to set PN . You will also need to include PN as part of the STAMP 216 recipe to set :term:`PN`. You will also need to include :term:`PN` as part of the :term:`STAMP`,
234 , T , and B variable definitions in the local.conf file. 217 :term:`T`, and :term:`B` variable definitions in the ``local.conf`` file.
235 218
236 The ``TMPDIR`` variable establishes a directory that BitBake uses 219 The ``TMPDIR`` variable establishes a directory that BitBake uses
237 for build output and intermediate files other than the cached 220 for build output and intermediate files other than the cached
@@ -251,21 +234,17 @@ Following is the complete "Hello World" example.
251 glossary. 234 glossary.
252 235
253#. **Run BitBake:** After making sure that the ``conf/bitbake.conf`` file 236#. **Run BitBake:** After making sure that the ``conf/bitbake.conf`` file
254 exists, you can run the ``bitbake`` command again: :: 237 exists, you can run the ``bitbake`` command again::
255 238
256 $ bitbake 239 $ bitbake
257 ERROR: Traceback (most recent call last): 240 ERROR: Unable to parse /home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py
258 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped 241 Traceback (most recent call last):
259 return func(fn, *args) 242 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py", line 67, in inherit(files=['base'], fn='configuration INHERITs', lineno=0, d=<bb.data_smart.DataSmart object at 0x7fab6815edf0>):
260 File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 177, in _inherit 243 if not os.path.exists(file):
261 bb.parse.BBHandler.inherit(bbclass, "configuration INHERITs", 0, data) 244 > raise ParseError("Could not inherit file %s" % (file), fn, lineno)
262 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py", line 92, in inherit 245
263 include(fn, file, lineno, d, "inherit") 246 bb.parse.ParseError: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
264 File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 100, in include 247
265 raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
266 ParseError: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
267
268 ERROR: Unable to parse base: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
269 248
270 In the sample output, 249 In the sample output,
271 BitBake could not find the ``classes/base.bbclass`` file. You need 250 BitBake could not find the ``classes/base.bbclass`` file. You need
@@ -278,20 +257,23 @@ Following is the complete "Hello World" example.
278 in the ``classes`` directory of the project (i.e ``hello/classes`` 257 in the ``classes`` directory of the project (i.e ``hello/classes``
279 in this example). 258 in this example).
280 259
281 Create the ``classes`` directory as follows: :: 260 Create the ``classes`` directory as follows::
282 261
283 $ cd $HOME/hello 262 $ cd $HOME/hello
284 $ mkdir classes 263 $ mkdir classes
285 264
286 Move to the ``classes`` directory and then create the 265 Move to the ``classes`` directory and then create the
287 ``base.bbclass`` file by inserting this single line: addtask build 266 ``base.bbclass`` file by inserting this single line::
267
268 addtask build
269
288 The minimal task that BitBake runs is the ``do_build`` task. This is 270 The minimal task that BitBake runs is the ``do_build`` task. This is
289 all the example needs in order to build the project. Of course, the 271 all the example needs in order to build the project. Of course, the
290 ``base.bbclass`` can have much more depending on which build 272 ``base.bbclass`` can have much more depending on which build
291 environments BitBake is supporting. 273 environments BitBake is supporting.
292 274
293#. **Run BitBake:** After making sure that the ``classes/base.bbclass`` 275#. **Run BitBake:** After making sure that the ``classes/base.bbclass``
294 file exists, you can run the ``bitbake`` command again: :: 276 file exists, you can run the ``bitbake`` command again::
295 277
296 $ bitbake 278 $ bitbake
297 Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information. 279 Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.
@@ -314,7 +296,7 @@ Following is the complete "Hello World" example.
314 Minimally, you need a recipe file and a layer configuration file in 296 Minimally, you need a recipe file and a layer configuration file in
315 your layer. The configuration file needs to be in the ``conf`` 297 your layer. The configuration file needs to be in the ``conf``
316 directory inside the layer. Use these commands to set up the layer 298 directory inside the layer. Use these commands to set up the layer
317 and the ``conf`` directory: :: 299 and the ``conf`` directory::
318 300
319 $ cd $HOME 301 $ cd $HOME
320 $ mkdir mylayer 302 $ mkdir mylayer
@@ -322,20 +304,29 @@ Following is the complete "Hello World" example.
322 $ mkdir conf 304 $ mkdir conf
323 305
324 Move to the ``conf`` directory and create a ``layer.conf`` file that has the 306 Move to the ``conf`` directory and create a ``layer.conf`` file that has the
325 following: :: 307 following::
326 308
327 BBPATH .= ":${LAYERDIR}" 309 BBPATH .= ":${LAYERDIR}"
328 BBFILES += "${LAYERDIR}/\*.bb" 310 BBFILES += "${LAYERDIR}/*.bb"
329 BBFILE_COLLECTIONS += "mylayer" 311 BBFILE_COLLECTIONS += "mylayer"
330 `BBFILE_PATTERN_mylayer := "^${LAYERDIR_RE}/" 312 BBFILE_PATTERN_mylayer := "^${LAYERDIR_RE}/"
313 LAYERSERIES_CORENAMES = "hello_world_example"
314 LAYERSERIES_COMPAT_mylayer = "hello_world_example"
331 315
332 For information on these variables, click on :term:`BBFILES`, 316 For information on these variables, click on :term:`BBFILES`,
333 :term:`LAYERDIR`, :term:`BBFILE_COLLECTIONS` or :term:`BBFILE_PATTERN_mylayer <BBFILE_PATTERN>` 317 :term:`LAYERDIR`, :term:`BBFILE_COLLECTIONS`, :term:`BBFILE_PATTERN_mylayer <BBFILE_PATTERN>`
334 to go to the definitions in the glossary. 318 or :term:`LAYERSERIES_COMPAT` to go to the definitions in the glossary.
319
320 .. note::
321
322 We are setting both ``LAYERSERIES_CORENAMES`` and :term:`LAYERSERIES_COMPAT` in this particular case, because we
323 are using bitbake without OpenEmbedded.
324 You should usually just use :term:`LAYERSERIES_COMPAT` to specify the OE-Core versions for which your layer
325 is compatible, and add the meta-openembedded layer to your project.
335 326
336 You need to create the recipe file next. Inside your layer at the 327 You need to create the recipe file next. Inside your layer at the
337 top-level, use an editor and create a recipe file named 328 top-level, use an editor and create a recipe file named
338 ``printhello.bb`` that has the following: :: 329 ``printhello.bb`` that has the following::
339 330
340 DESCRIPTION = "Prints Hello World" 331 DESCRIPTION = "Prints Hello World"
341 PN = 'printhello' 332 PN = 'printhello'
@@ -356,7 +347,7 @@ Following is the complete "Hello World" example.
356 follow the links to the glossary. 347 follow the links to the glossary.
357 348
358#. **Run BitBake With a Target:** Now that a BitBake target exists, run 349#. **Run BitBake With a Target:** Now that a BitBake target exists, run
359 the command and provide that target: :: 350 the command and provide that target::
360 351
361 $ cd $HOME/hello 352 $ cd $HOME/hello
362 $ bitbake printhello 353 $ bitbake printhello
@@ -376,7 +367,7 @@ Following is the complete "Hello World" example.
376 ``hello/conf`` for this example). 367 ``hello/conf`` for this example).
377 368
378 Set your working directory to the ``hello/conf`` directory and then 369 Set your working directory to the ``hello/conf`` directory and then
379 create the ``bblayers.conf`` file so that it contains the following: :: 370 create the ``bblayers.conf`` file so that it contains the following::
380 371
381 BBLAYERS ?= " \ 372 BBLAYERS ?= " \
382 /home/<you>/mylayer \ 373 /home/<you>/mylayer \
@@ -386,15 +377,17 @@ Following is the complete "Hello World" example.
386 377
387#. **Run BitBake With a Target:** Now that you have supplied the 378#. **Run BitBake With a Target:** Now that you have supplied the
388 ``bblayers.conf`` file, run the ``bitbake`` command and provide the 379 ``bblayers.conf`` file, run the ``bitbake`` command and provide the
389 target: :: 380 target::
390 381
391 $ bitbake printhello 382 $ bitbake printhello
383 Loading cache: 100% |
384 Loaded 0 entries from dependency cache.
392 Parsing recipes: 100% |##################################################################################| 385 Parsing recipes: 100% |##################################################################################|
393 Time: 00:00:00
394 Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 0 masked, 0 errors. 386 Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 0 masked, 0 errors.
395 NOTE: Resolving any missing task queue dependencies 387 NOTE: Resolving any missing task queue dependencies
396 NOTE: Preparing RunQueue 388 Initialising tasks: 100% |###############################################################################|
397 NOTE: Executing RunQueue Tasks 389 NOTE: No setscene tasks
390 NOTE: Executing Tasks
398 ******************** 391 ********************
399 * * 392 * *
400 * Hello, World! * 393 * Hello, World! *
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst
index 6f9d392935..539bb62d81 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst
@@ -27,7 +27,7 @@ Linux software stacks using a task-oriented approach.
27Conceptually, BitBake is similar to GNU Make in some regards but has 27Conceptually, BitBake is similar to GNU Make in some regards but has
28significant differences: 28significant differences:
29 29
30- BitBake executes tasks according to provided metadata that builds up 30- BitBake executes tasks according to the provided metadata that builds up
31 the tasks. Metadata is stored in recipe (``.bb``) and related recipe 31 the tasks. Metadata is stored in recipe (``.bb``) and related recipe
32 "append" (``.bbappend``) files, configuration (``.conf``) and 32 "append" (``.bbappend``) files, configuration (``.conf``) and
33 underlying include (``.inc``) files, and in class (``.bbclass``) 33 underlying include (``.inc``) files, and in class (``.bbclass``)
@@ -60,11 +60,10 @@ member Chris Larson split the project into two distinct pieces:
60- OpenEmbedded, a metadata set utilized by BitBake 60- OpenEmbedded, a metadata set utilized by BitBake
61 61
62Today, BitBake is the primary basis of the 62Today, BitBake is the primary basis of the
63`OpenEmbedded <http://www.openembedded.org/>`__ project, which is being 63`OpenEmbedded <https://www.openembedded.org/>`__ project, which is being
64used to build and maintain Linux distributions such as the `Angstrom 64used to build and maintain Linux distributions such as the `Poky
65Distribution <http://www.angstrom-distribution.org/>`__, and which is 65Reference Distribution <https://www.yoctoproject.org/software-item/poky/>`__,
66also being used as the build tool for Linux projects such as the `Yocto 66developed under the umbrella of the `Yocto Project <https://www.yoctoproject.org>`__.
67Project <http://www.yoctoproject.org>`__.
68 67
69Prior to BitBake, no other build tool adequately met the needs of an 68Prior to BitBake, no other build tool adequately met the needs of an
70aspiring embedded Linux distribution. All of the build systems used by 69aspiring embedded Linux distribution. All of the build systems used by
@@ -248,13 +247,13 @@ underlying, similarly-named recipe files.
248 247
249When you name an append file, you can use the "``%``" wildcard character 248When you name an append file, you can use the "``%``" wildcard character
250to allow for matching recipe names. For example, suppose you have an 249to allow for matching recipe names. For example, suppose you have an
251append file named as follows: :: 250append file named as follows::
252 251
253 busybox_1.21.%.bbappend 252 busybox_1.21.%.bbappend
254 253
255That append file 254That append file
256would match any ``busybox_1.21.``\ x\ ``.bb`` version of the recipe. So, 255would match any ``busybox_1.21.``\ x\ ``.bb`` version of the recipe. So,
257the append file would match the following recipe names: :: 256the append file would match the following recipe names::
258 257
259 busybox_1.21.1.bb 258 busybox_1.21.1.bb
260 busybox_1.21.2.bb 259 busybox_1.21.2.bb
@@ -290,7 +289,7 @@ You can obtain BitBake several different ways:
290 are using. The metadata is generally backwards compatible but not 289 are using. The metadata is generally backwards compatible but not
291 forward compatible. 290 forward compatible.
292 291
293 Here is an example that clones the BitBake repository: :: 292 Here is an example that clones the BitBake repository::
294 293
295 $ git clone git://git.openembedded.org/bitbake 294 $ git clone git://git.openembedded.org/bitbake
296 295
@@ -298,7 +297,7 @@ You can obtain BitBake several different ways:
298 Git repository into a directory called ``bitbake``. Alternatively, 297 Git repository into a directory called ``bitbake``. Alternatively,
299 you can designate a directory after the ``git clone`` command if you 298 you can designate a directory after the ``git clone`` command if you
300 want to call the new directory something other than ``bitbake``. Here 299 want to call the new directory something other than ``bitbake``. Here
301 is an example that names the directory ``bbdev``: :: 300 is an example that names the directory ``bbdev``::
302 301
303 $ git clone git://git.openembedded.org/bitbake bbdev 302 $ git clone git://git.openembedded.org/bitbake bbdev
304 303
@@ -317,9 +316,9 @@ You can obtain BitBake several different ways:
317 method for getting BitBake. Cloning the repository makes it easier 316 method for getting BitBake. Cloning the repository makes it easier
318 to update as patches are added to the stable branches. 317 to update as patches are added to the stable branches.
319 318
320 The following example downloads a snapshot of BitBake version 1.17.0: :: 319 The following example downloads a snapshot of BitBake version 1.17.0::
321 320
322 $ wget http://git.openembedded.org/bitbake/snapshot/bitbake-1.17.0.tar.gz 321 $ wget https://git.openembedded.org/bitbake/snapshot/bitbake-1.17.0.tar.gz
323 $ tar zxpvf bitbake-1.17.0.tar.gz 322 $ tar zxpvf bitbake-1.17.0.tar.gz
324 323
325 After extraction of the tarball using 324 After extraction of the tarball using
@@ -347,43 +346,87 @@ execution examples.
347Usage and syntax 346Usage and syntax
348---------------- 347----------------
349 348
350Following is the usage and syntax for BitBake: :: 349Following is the usage and syntax for BitBake::
351 350
352 $ bitbake -h 351 $ bitbake -h
353 Usage: bitbake [options] [recipename/target recipe:do_task ...] 352 usage: bitbake [-s] [-e] [-g] [-u UI] [--version] [-h] [-f] [-c CMD]
354 353 [-C INVALIDATE_STAMP] [--runall RUNALL] [--runonly RUNONLY]
355 Executes the specified task (default is 'build') for a given set of target recipes (.bb files). 354 [--no-setscene] [--skip-setscene] [--setscene-only] [-n] [-p]
356 It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which 355 [-k] [-P] [-S SIGNATURE_HANDLER] [--revisions-changed]
357 will provide the layer, BBFILES and other configuration information. 356 [-b BUILDFILE] [-D] [-l DEBUG_DOMAINS] [-v] [-q]
357 [-w WRITEEVENTLOG] [-B BIND] [-T SERVER_TIMEOUT]
358 [--remote-server REMOTE_SERVER] [-m] [--token XMLRPCTOKEN]
359 [--observe-only] [--status-only] [--server-only] [-r PREFILE]
360 [-R POSTFILE] [-I EXTRA_ASSUME_PROVIDED]
361 [recipename/target ...]
362
363 It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH
364 which will provide the layer, BBFILES and other configuration information.
365
366 General options:
367 recipename/target Execute the specified task (default is 'build') for
368 these target recipes (.bb files).
369 -s, --show-versions Show current and preferred versions of all recipes.
370 -e, --environment Show the global or per-recipe environment complete
371 with information about where variables were
372 set/changed.
373 -g, --graphviz Save dependency tree information for the specified
374 targets in the dot syntax.
375 -u UI, --ui UI The user interface to use (knotty, ncurses, taskexp,
376 taskexp_ncurses or teamcity - default knotty).
377 --version Show programs version and exit.
378 -h, --help Show this help message and exit.
358 379
359 Options: 380 Task control options:
360 --version show program's version number and exit
361 -h, --help show this help message and exit
362 -b BUILDFILE, --buildfile=BUILDFILE
363 Execute tasks from a specific .bb recipe directly.
364 WARNING: Does not handle any dependencies from other
365 recipes.
366 -k, --continue Continue as much as possible after an error. While the
367 target that failed and anything depending on it cannot
368 be built, as much as possible will be built before
369 stopping.
370 -f, --force Force the specified targets/task to run (invalidating 381 -f, --force Force the specified targets/task to run (invalidating
371 any existing stamp file). 382 any existing stamp file).
372 -c CMD, --cmd=CMD Specify the task to execute. The exact options 383 -c CMD, --cmd CMD Specify the task to execute. The exact options
373 available depend on the metadata. Some examples might 384 available depend on the metadata. Some examples might
374 be 'compile' or 'populate_sysroot' or 'listtasks' may 385 be 'compile' or 'populate_sysroot' or 'listtasks' may
375 give a list of the tasks available. 386 give a list of the tasks available.
376 -C INVALIDATE_STAMP, --clear-stamp=INVALIDATE_STAMP 387 -C INVALIDATE_STAMP, --clear-stamp INVALIDATE_STAMP
377 Invalidate the stamp for the specified task such as 388 Invalidate the stamp for the specified task such as
378 'compile' and then run the default task for the 389 'compile' and then run the default task for the
379 specified target(s). 390 specified target(s).
380 -r PREFILE, --read=PREFILE 391 --runall RUNALL Run the specified task for any recipe in the taskgraph
381 Read the specified file before bitbake.conf. 392 of the specified target (even if it wouldn't otherwise
382 -R POSTFILE, --postread=POSTFILE 393 have run).
383 Read the specified file after bitbake.conf. 394 --runonly RUNONLY Run only the specified task within the taskgraph of
384 -v, --verbose Enable tracing of shell tasks (with 'set -x'). Also 395 the specified targets (and any task dependencies those
385 print bb.note(...) messages to stdout (in addition to 396 tasks may have).
386 writing them to ${T}/log.do_&lt;task&gt;). 397 --no-setscene Do not run any setscene tasks. sstate will be ignored
398 and everything needed, built.
399 --skip-setscene Skip setscene tasks if they would be executed. Tasks
400 previously restored from sstate will be kept, unlike
401 --no-setscene.
402 --setscene-only Only run setscene tasks, don't run any real tasks.
403
404 Execution control options:
405 -n, --dry-run Don't execute, just go through the motions.
406 -p, --parse-only Quit after parsing the BB recipes.
407 -k, --continue Continue as much as possible after an error. While the
408 target that failed and anything depending on it cannot
409 be built, as much as possible will be built before
410 stopping.
411 -P, --profile Profile the command and save reports.
412 -S SIGNATURE_HANDLER, --dump-signatures SIGNATURE_HANDLER
413 Dump out the signature construction information, with
414 no task execution. The SIGNATURE_HANDLER parameter is
415 passed to the handler. Two common values are none and
416 printdiff but the handler may define more/less. none
417 means only dump the signature, printdiff means
418 recursively compare the dumped signature with the most
419 recent one in a local build or sstate cache (can be
420 used to find out why tasks re-run when that is not
421 expected)
422 --revisions-changed Set the exit code depending on whether upstream
423 floating revisions have changed or not.
424 -b BUILDFILE, --buildfile BUILDFILE
425 Execute tasks from a specific .bb recipe directly.
426 WARNING: Does not handle any dependencies from other
427 recipes.
428
429 Logging/output control options:
387 -D, --debug Increase the debug level. You can specify this more 430 -D, --debug Increase the debug level. You can specify this more
388 than once. -D sets the debug level to 1, where only 431 than once. -D sets the debug level to 1, where only
389 bb.debug(1, ...) messages are printed to stdout; -DD 432 bb.debug(1, ...) messages are printed to stdout; -DD
@@ -393,62 +436,47 @@ Following is the usage and syntax for BitBake: ::
393 -D only affects output to stdout. All debug messages 436 -D only affects output to stdout. All debug messages
394 are written to ${T}/log.do_taskname, regardless of the 437 are written to ${T}/log.do_taskname, regardless of the
395 debug level. 438 debug level.
439 -l DEBUG_DOMAINS, --log-domains DEBUG_DOMAINS
440 Show debug logging for the specified logging domains.
441 -v, --verbose Enable tracing of shell tasks (with 'set -x'). Also
442 print bb.note(...) messages to stdout (in addition to
443 writing them to ${T}/log.do_<task>).
396 -q, --quiet Output less log message data to the terminal. You can 444 -q, --quiet Output less log message data to the terminal. You can
397 specify this more than once. 445 specify this more than once.
398 -n, --dry-run Don't execute, just go through the motions. 446 -w WRITEEVENTLOG, --write-log WRITEEVENTLOG
399 -S SIGNATURE_HANDLER, --dump-signatures=SIGNATURE_HANDLER 447 Writes the event log of the build to a bitbake event
400 Dump out the signature construction information, with 448 json file. Use '' (empty string) to assign the name
401 no task execution. The SIGNATURE_HANDLER parameter is 449 automatically.
402 passed to the handler. Two common values are none and 450
403 printdiff but the handler may define more/less. none 451 Server options:
404 means only dump the signature, printdiff means compare 452 -B BIND, --bind BIND The name/address for the bitbake xmlrpc server to bind
405 the dumped signature with the cached one.
406 -p, --parse-only Quit after parsing the BB recipes.
407 -s, --show-versions Show current and preferred versions of all recipes.
408 -e, --environment Show the global or per-recipe environment complete
409 with information about where variables were
410 set/changed.
411 -g, --graphviz Save dependency tree information for the specified
412 targets in the dot syntax.
413 -I EXTRA_ASSUME_PROVIDED, --ignore-deps=EXTRA_ASSUME_PROVIDED
414 Assume these dependencies don't exist and are already
415 provided (equivalent to ASSUME_PROVIDED). Useful to
416 make dependency graphs more appealing
417 -l DEBUG_DOMAINS, --log-domains=DEBUG_DOMAINS
418 Show debug logging for the specified logging domains
419 -P, --profile Profile the command and save reports.
420 -u UI, --ui=UI The user interface to use (knotty, ncurses or taskexp
421 - default knotty).
422 --token=XMLRPCTOKEN Specify the connection token to be used when
423 connecting to a remote server.
424 --revisions-changed Set the exit code depending on whether upstream
425 floating revisions have changed or not.
426 --server-only Run bitbake without a UI, only starting a server
427 (cooker) process.
428 -B BIND, --bind=BIND The name/address for the bitbake xmlrpc server to bind
429 to. 453 to.
430 -T SERVER_TIMEOUT, --idle-timeout=SERVER_TIMEOUT 454 -T SERVER_TIMEOUT, --idle-timeout SERVER_TIMEOUT
431 Set timeout to unload bitbake server due to 455 Set timeout to unload bitbake server due to
432 inactivity, set to -1 means no unload, default: 456 inactivity, set to -1 means no unload, default:
433 Environment variable BB_SERVER_TIMEOUT. 457 Environment variable BB_SERVER_TIMEOUT.
434 --no-setscene Do not run any setscene tasks. sstate will be ignored 458 --remote-server REMOTE_SERVER
435 and everything needed, built.
436 --setscene-only Only run setscene tasks, don't run any real tasks.
437 --remote-server=REMOTE_SERVER
438 Connect to the specified server. 459 Connect to the specified server.
439 -m, --kill-server Terminate any running bitbake server. 460 -m, --kill-server Terminate any running bitbake server.
461 --token XMLRPCTOKEN Specify the connection token to be used when
462 connecting to a remote server.
440 --observe-only Connect to a server as an observing-only client. 463 --observe-only Connect to a server as an observing-only client.
441 --status-only Check the status of the remote bitbake server. 464 --status-only Check the status of the remote bitbake server.
442 -w WRITEEVENTLOG, --write-log=WRITEEVENTLOG 465 --server-only Run bitbake without a UI, only starting a server
443 Writes the event log of the build to a bitbake event 466 (cooker) process.
444 json file. Use '' (empty string) to assign the name 467
445 automatically. 468 Configuration options:
446 --runall=RUNALL Run the specified task for any recipe in the taskgraph 469 -r PREFILE, --read PREFILE
447 of the specified target (even if it wouldn't otherwise 470 Read the specified file before bitbake.conf.
448 have run). 471 -R POSTFILE, --postread POSTFILE
449 --runonly=RUNONLY Run only the specified task within the taskgraph of 472 Read the specified file after bitbake.conf.
450 the specified targets (and any task dependencies those 473 -I EXTRA_ASSUME_PROVIDED, --ignore-deps EXTRA_ASSUME_PROVIDED
451 tasks may have). 474 Assume these dependencies don't exist and are already
475 provided (equivalent to ASSUME_PROVIDED). Useful to
476 make dependency graphs more appealing.
477
478..
479 Bitbake help output generated with "stty columns 80; bin/bitbake -h"
452 480
453.. _bitbake-examples: 481.. _bitbake-examples:
454 482
@@ -469,11 +497,11 @@ default task, which is "build". BitBake obeys inter-task dependencies
469when doing so. 497when doing so.
470 498
471The following command runs the build task, which is the default task, on 499The following command runs the build task, which is the default task, on
472the ``foo_1.0.bb`` recipe file: :: 500the ``foo_1.0.bb`` recipe file::
473 501
474 $ bitbake -b foo_1.0.bb 502 $ bitbake -b foo_1.0.bb
475 503
476The following command runs the clean task on the ``foo.bb`` recipe file: :: 504The following command runs the clean task on the ``foo.bb`` recipe file::
477 505
478 $ bitbake -b foo.bb -c clean 506 $ bitbake -b foo.bb -c clean
479 507
@@ -497,13 +525,13 @@ functionality, or when there are multiple versions of a recipe.
497The ``bitbake`` command, when not using "--buildfile" or "-b" only 525The ``bitbake`` command, when not using "--buildfile" or "-b" only
498accepts a "PROVIDES". You cannot provide anything else. By default, a 526accepts a "PROVIDES". You cannot provide anything else. By default, a
499recipe file generally "PROVIDES" its "packagename" as shown in the 527recipe file generally "PROVIDES" its "packagename" as shown in the
500following example: :: 528following example::
501 529
502 $ bitbake foo 530 $ bitbake foo
503 531
504This next example "PROVIDES" the 532This next example "PROVIDES" the
505package name and also uses the "-c" option to tell BitBake to just 533package name and also uses the "-c" option to tell BitBake to just
506execute the ``do_clean`` task: :: 534execute the ``do_clean`` task::
507 535
508 $ bitbake -c clean foo 536 $ bitbake -c clean foo
509 537
@@ -514,7 +542,7 @@ The BitBake command line supports specifying different tasks for
514individual targets when you specify multiple targets. For example, 542individual targets when you specify multiple targets. For example,
515suppose you had two targets (or recipes) ``myfirstrecipe`` and 543suppose you had two targets (or recipes) ``myfirstrecipe`` and
516``mysecondrecipe`` and you needed BitBake to run ``taskA`` for the first 544``mysecondrecipe`` and you needed BitBake to run ``taskA`` for the first
517recipe and ``taskB`` for the second recipe: :: 545recipe and ``taskB`` for the second recipe::
518 546
519 $ bitbake myfirstrecipe:do_taskA mysecondrecipe:do_taskB 547 $ bitbake myfirstrecipe:do_taskA mysecondrecipe:do_taskB
520 548
@@ -534,13 +562,13 @@ current working directory:
534- ``pn-buildlist``: Shows a simple list of targets that are to be 562- ``pn-buildlist``: Shows a simple list of targets that are to be
535 built. 563 built.
536 564
537To stop depending on common depends, use the "-I" depend option and 565To stop depending on common depends, use the ``-I`` depend option and
538BitBake omits them from the graph. Leaving this information out can 566BitBake omits them from the graph. Leaving this information out can
539produce more readable graphs. This way, you can remove from the graph 567produce more readable graphs. This way, you can remove from the graph
540``DEPENDS`` from inherited classes such as ``base.bbclass``. 568:term:`DEPENDS` from inherited classes such as ``base.bbclass``.
541 569
542Here are two examples that create dependency graphs. The second example 570Here are two examples that create dependency graphs. The second example
543omits depends common in OpenEmbedded from the graph: :: 571omits depends common in OpenEmbedded from the graph::
544 572
545 $ bitbake -g foo 573 $ bitbake -g foo
546 574
@@ -564,7 +592,7 @@ for two separate targets:
564.. image:: figures/bb_multiconfig_files.png 592.. image:: figures/bb_multiconfig_files.png
565 :align: center 593 :align: center
566 594
567The reason for this required file hierarchy is because the ``BBPATH`` 595The reason for this required file hierarchy is because the :term:`BBPATH`
568variable is not constructed until the layers are parsed. Consequently, 596variable is not constructed until the layers are parsed. Consequently,
569using the configuration file as a pre-configuration file is not possible 597using the configuration file as a pre-configuration file is not possible
570unless it is located in the current working directory. 598unless it is located in the current working directory.
@@ -582,17 +610,17 @@ accomplished by setting the
582configuration files for ``target1`` and ``target2`` defined in the build 610configuration files for ``target1`` and ``target2`` defined in the build
583directory. The following statement in the ``local.conf`` file both 611directory. The following statement in the ``local.conf`` file both
584enables BitBake to perform multiple configuration builds and specifies 612enables BitBake to perform multiple configuration builds and specifies
585the two extra multiconfigs: :: 613the two extra multiconfigs::
586 614
587 BBMULTICONFIG = "target1 target2" 615 BBMULTICONFIG = "target1 target2"
588 616
589Once the target configuration files are in place and BitBake has been 617Once the target configuration files are in place and BitBake has been
590enabled to perform multiple configuration builds, use the following 618enabled to perform multiple configuration builds, use the following
591command form to start the builds: :: 619command form to start the builds::
592 620
593 $ bitbake [mc:multiconfigname:]target [[[mc:multiconfigname:]target] ... ] 621 $ bitbake [mc:multiconfigname:]target [[[mc:multiconfigname:]target] ... ]
594 622
595Here is an example for two extra multiconfigs: ``target1`` and ``target2``: :: 623Here is an example for two extra multiconfigs: ``target1`` and ``target2``::
596 624
597 $ bitbake mc::target mc:target1:target mc:target2:target 625 $ bitbake mc::target mc:target1:target mc:target2:target
598 626
@@ -613,12 +641,12 @@ multiconfig.
613 641
614To enable dependencies in a multiple configuration build, you must 642To enable dependencies in a multiple configuration build, you must
615declare the dependencies in the recipe using the following statement 643declare the dependencies in the recipe using the following statement
616form: :: 644form::
617 645
618 task_or_package[mcdepends] = "mc:from_multiconfig:to_multiconfig:recipe_name:task_on_which_to_depend" 646 task_or_package[mcdepends] = "mc:from_multiconfig:to_multiconfig:recipe_name:task_on_which_to_depend"
619 647
620To better show how to use this statement, consider an example with two 648To better show how to use this statement, consider an example with two
621multiconfigs: ``target1`` and ``target2``: :: 649multiconfigs: ``target1`` and ``target2``::
622 650
623 image_task[mcdepends] = "mc:target1:target2:image2:rootfs_task" 651 image_task[mcdepends] = "mc:target1:target2:image2:rootfs_task"
624 652
@@ -629,7 +657,7 @@ completion of the rootfs_task used to build out image2, which is
629associated with the "target2" multiconfig. 657associated with the "target2" multiconfig.
630 658
631Once you set up this dependency, you can build the "target1" multiconfig 659Once you set up this dependency, you can build the "target1" multiconfig
632using a BitBake command as follows: :: 660using a BitBake command as follows::
633 661
634 $ bitbake mc:target1:image1 662 $ bitbake mc:target1:image1
635 663
@@ -639,7 +667,7 @@ the ``rootfs_task`` for the "target2" multiconfig build.
639 667
640Having a recipe depend on the root filesystem of another build might not 668Having a recipe depend on the root filesystem of another build might not
641seem that useful. Consider this change to the statement in the image1 669seem that useful. Consider this change to the statement in the image1
642recipe: :: 670recipe::
643 671
644 image_task[mcdepends] = "mc:target1:target2:image2:image_task" 672 image_task[mcdepends] = "mc:target1:target2:image2:image_task"
645 673
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst
new file mode 100644
index 0000000000..09e353945b
--- /dev/null
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst
@@ -0,0 +1,59 @@
1.. SPDX-License-Identifier: CC-BY-2.5
2
3=================
4Library Functions
5=================
6
7|
8
9This chapter lists common library functions available under the ``lib/``
10directory in BitBake.
11
12These functions can be used in recipes or configuration files with
13:ref:`inline-Python <bitbake-user-manual/bitbake-user-manual-metadata:Inline
14Python Variable Expansion>` or :ref:`Python
15<bitbake-user-manual/bitbake-user-manual-metadata:BitBake-Style Python
16Functions>` functions.
17
18Logging utilities
19=================
20
21Different logging utilities can be used from Python code in recipes or
22configuration files.
23
24The strings passed below can be formatted with ``str.format()``, for example::
25
26 bb.warn("Houston, we have a %s", "bit of a problem")
27
28Formatted string can also be used directly::
29
30 bb.error("%s, we have a %s" % ("Houston", "big problem"))
31
32Python f-strings may also be used::
33
34 h = "Houston"
35 bb.fatal(f"{h}, we have a critical problem")
36
37.. automodule:: bb
38 :members:
39 debug,
40 error,
41 erroronce,
42 fatal,
43 note,
44 plain,
45 verbnote,
46 warn,
47 warnonce,
48
49``bb.utils``
50============
51
52.. automodule:: bb.utils
53 :members:
54 :exclude-members:
55 LogCatcher,
56 PrCtlError,
57 VersionStringException,
58 better_compile,
59 better_exec,
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 7ea68ade72..f60a9d8312 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -26,7 +26,7 @@ assignment. ::
26 VARIABLE = "value" 26 VARIABLE = "value"
27 27
28As expected, if you include leading or 28As expected, if you include leading or
29trailing spaces as part of an assignment, the spaces are retained: :: 29trailing spaces as part of an assignment, the spaces are retained::
30 30
31 VARIABLE = " value" 31 VARIABLE = " value"
32 VARIABLE = "value " 32 VARIABLE = "value "
@@ -40,7 +40,7 @@ blank space (i.e. these are not the same values). ::
40 40
41You can use single quotes instead of double quotes when setting a 41You can use single quotes instead of double quotes when setting a
42variable's value. Doing so allows you to use values that contain the 42variable's value. Doing so allows you to use values that contain the
43double quote character: :: 43double quote character::
44 44
45 VARIABLE = 'I have a " in my value' 45 VARIABLE = 'I have a " in my value'
46 46
@@ -77,7 +77,7 @@ occurs, you can use BitBake to check the actual value of the suspect
77variable. You can make these checks for both configuration and recipe 77variable. You can make these checks for both configuration and recipe
78level changes: 78level changes:
79 79
80- For configuration changes, use the following: :: 80- For configuration changes, use the following::
81 81
82 $ bitbake -e 82 $ bitbake -e
83 83
@@ -91,9 +91,10 @@ level changes:
91 Variables that are exported to the environment are preceded by the 91 Variables that are exported to the environment are preceded by the
92 string "export" in the command's output. 92 string "export" in the command's output.
93 93
94- For recipe changes, use the following: :: 94- To find changes to a given variable in a specific recipe, use the
95 following::
95 96
96 $ bitbake recipe -e \| grep VARIABLE=" 97 $ bitbake recipename -e | grep VARIABLENAME=\"
97 98
98 This command checks to see if the variable actually makes 99 This command checks to see if the variable actually makes
99 it into a specific recipe. 100 it into a specific recipe.
@@ -103,20 +104,20 @@ Line Joining
103 104
104Outside of :ref:`functions <bitbake-user-manual/bitbake-user-manual-metadata:functions>`, 105Outside of :ref:`functions <bitbake-user-manual/bitbake-user-manual-metadata:functions>`,
105BitBake joins any line ending in 106BitBake joins any line ending in
106a backslash character ("\") with the following line before parsing 107a backslash character ("\\") with the following line before parsing
107statements. The most common use for the "\" character is to split 108statements. The most common use for the "\\" character is to split
108variable assignments over multiple lines, as in the following example: :: 109variable assignments over multiple lines, as in the following example::
109 110
110 FOO = "bar \ 111 FOO = "bar \
111 baz \ 112 baz \
112 qaz" 113 qaz"
113 114
114Both the "\" character and the newline 115Both the "\\" character and the newline
115character that follow it are removed when joining lines. Thus, no 116character that follow it are removed when joining lines. Thus, no
116newline characters end up in the value of ``FOO``. 117newline characters end up in the value of ``FOO``.
117 118
118Consider this additional example where the two assignments both assign 119Consider this additional example where the two assignments both assign
119"barbaz" to ``FOO``: :: 120"barbaz" to ``FOO``::
120 121
121 FOO = "barbaz" 122 FOO = "barbaz"
122 FOO = "bar\ 123 FOO = "bar\
@@ -124,7 +125,7 @@ Consider this additional example where the two assignments both assign
124 125
125.. note:: 126.. note::
126 127
127 BitBake does not interpret escape sequences like "\n" in variable 128 BitBake does not interpret escape sequences like "\\n" in variable
128 values. For these to have an effect, the value must be passed to some 129 values. For these to have an effect, the value must be passed to some
129 utility that interprets escape sequences, such as 130 utility that interprets escape sequences, such as
130 ``printf`` or ``echo -n``. 131 ``printf`` or ``echo -n``.
@@ -149,7 +150,7 @@ The "=" operator does not immediately expand variable references in the
149right-hand side. Instead, expansion is deferred until the variable 150right-hand side. Instead, expansion is deferred until the variable
150assigned to is actually used. The result depends on the current values 151assigned to is actually used. The result depends on the current values
151of the referenced variables. The following example should clarify this 152of the referenced variables. The following example should clarify this
152behavior: :: 153behavior::
153 154
154 A = "${B} baz" 155 A = "${B} baz"
155 B = "${C} bar" 156 B = "${C} bar"
@@ -158,7 +159,7 @@ behavior: ::
158 C = "qux" 159 C = "qux"
159 *At this point, ${A} equals "qux bar baz"* 160 *At this point, ${A} equals "qux bar baz"*
160 B = "norf" 161 B = "norf"
161 *At this point, ${A} equals "norf baz"\* 162 *At this point, ${A} equals "norf baz"*
162 163
163Contrast this behavior with the 164Contrast this behavior with the
164:ref:`bitbake-user-manual/bitbake-user-manual-metadata:immediate variable 165:ref:`bitbake-user-manual/bitbake-user-manual-metadata:immediate variable
@@ -177,7 +178,7 @@ Setting a default value (?=)
177You can use the "?=" operator to achieve a "softer" assignment for a 178You can use the "?=" operator to achieve a "softer" assignment for a
178variable. This type of assignment allows you to define a variable if it 179variable. This type of assignment allows you to define a variable if it
179is undefined when the statement is parsed, but to leave the value alone 180is undefined when the statement is parsed, but to leave the value alone
180if the variable has a value. Here is an example: :: 181if the variable has a value. Here is an example::
181 182
182 A ?= "aval" 183 A ?= "aval"
183 184
@@ -194,28 +195,51 @@ value. However, if ``A`` is not set, the variable is set to "aval".
194Setting a weak default value (??=) 195Setting a weak default value (??=)
195---------------------------------- 196----------------------------------
196 197
197It 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
198by using the "??=" operator. This assignment behaves identical to "?=" 199will expand to if no value has been assigned to it via any of the other
199except that the assignment is made at the end of the parsing process 200assignment operators. The "??=" operator takes effect immediately, replacing
200rather than immediately. Consequently, when multiple "??=" assignments 201any previously defined weak default value. Here is an example::
201exist, the last one is used. Also, any "=" or "?=" assignment will
202override the value set with "??=". Here is an example: ::
203 202
204 A ??= "somevalue" 203 W ??= "x"
205 A ??= "someothervalue" 204 A := "${W}" # Immediate variable expansion
205 W ??= "y"
206 B := "${W}" # Immediate variable expansion
207 W ??= "z"
208 C = "${W}"
209 W ?= "i"
206 210
207If ``A`` is set before the above statements are 211After parsing we will have::
208parsed, the variable retains its value. If ``A`` is not set, the
209variable is set to "someothervalue".
210 212
211Again, this assignment is a "lazy" or "weak" assignment because it does 213 A = "x"
212not occur until the end of the parsing process. 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"
213 237
214Immediate variable expansion (:=) 238Immediate variable expansion (:=)
215--------------------------------- 239---------------------------------
216 240
217The ":=" operator results in a variable's contents being expanded 241The ":=" operator results in a variable's contents being expanded
218immediately, rather than when the variable is actually used: :: 242immediately, rather than when the variable is actually used::
219 243
220 T = "123" 244 T = "123"
221 A := "test ${T}" 245 A := "test ${T}"
@@ -225,7 +249,7 @@ immediately, rather than when the variable is actually used: ::
225 C := "${C}append" 249 C := "${C}append"
226 250
227In this example, ``A`` contains "test 123", even though the final value 251In this example, ``A`` contains "test 123", even though the final value
228of ``T`` is "456". The variable ``B`` will end up containing "456 252of :term:`T` is "456". The variable :term:`B` will end up containing "456
229cvalappend". This is because references to undefined variables are 253cvalappend". This is because references to undefined variables are
230preserved as is during (immediate)expansion. This is in contrast to GNU 254preserved as is during (immediate)expansion. This is in contrast to GNU
231Make, where undefined variables expand to nothing. The variable ``C`` 255Make, where undefined variables expand to nothing. The variable ``C``
@@ -241,14 +265,14 @@ the "+=" and "=+" operators. These operators insert a space between the
241current value and prepended or appended value. 265current value and prepended or appended value.
242 266
243These operators take immediate effect during parsing. Here are some 267These operators take immediate effect during parsing. Here are some
244examples: :: 268examples::
245 269
246 B = "bval" 270 B = "bval"
247 B += "additionaldata" 271 B += "additionaldata"
248 C = "cval" 272 C = "cval"
249 C =+ "test" 273 C =+ "test"
250 274
251The variable ``B`` contains "bval additionaldata" and ``C`` contains "test 275The variable :term:`B` contains "bval additionaldata" and ``C`` contains "test
252cval". 276cval".
253 277
254.. _appending-and-prepending-without-spaces: 278.. _appending-and-prepending-without-spaces:
@@ -260,14 +284,14 @@ If you want to append or prepend values without an inserted space, use
260the ".=" and "=." operators. 284the ".=" and "=." operators.
261 285
262These operators take immediate effect during parsing. Here are some 286These operators take immediate effect during parsing. Here are some
263examples: :: 287examples::
264 288
265 B = "bval" 289 B = "bval"
266 B .= "additionaldata" 290 B .= "additionaldata"
267 C = "cval" 291 C = "cval"
268 C =. "test" 292 C =. "test"
269 293
270The variable ``B`` contains "bvaladditionaldata" and ``C`` contains 294The variable :term:`B` contains "bvaladditionaldata" and ``C`` contains
271"testcval". 295"testcval".
272 296
273Appending and Prepending (Override Style Syntax) 297Appending and Prepending (Override Style Syntax)
@@ -278,16 +302,16 @@ style syntax. When you use this syntax, no spaces are inserted.
278 302
279These operators differ from the ":=", ".=", "=.", "+=", and "=+" 303These operators differ from the ":=", ".=", "=.", "+=", and "=+"
280operators in that their effects are applied at variable expansion time 304operators in that their effects are applied at variable expansion time
281rather than being immediately applied. Here are some examples: :: 305rather than being immediately applied. Here are some examples::
282 306
283 B = "bval" 307 B = "bval"
284 B_append = " additional data" 308 B:append = " additional data"
285 C = "cval" 309 C = "cval"
286 C_prepend = "additional data " 310 C:prepend = "additional data "
287 D = "dval" 311 D = "dval"
288 D_append = "additional data" 312 D:append = "additional data"
289 313
290The variable ``B`` 314The variable :term:`B`
291becomes "bval additional data" and ``C`` becomes "additional data cval". 315becomes "bval additional data" and ``C`` becomes "additional data cval".
292The variable ``D`` becomes "dvaladditional data". 316The variable ``D`` becomes "dvaladditional data".
293 317
@@ -295,6 +319,10 @@ The variable ``D`` becomes "dvaladditional data".
295 319
296 You must control all spacing when you use the override syntax. 320 You must control all spacing when you use the override syntax.
297 321
322.. note::
323
324 The overrides are applied in this order, ":append", ":prepend", ":remove".
325
298It is also possible to append and prepend to shell functions and 326It is also possible to append and prepend to shell functions and
299BitBake-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`" 327BitBake-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`"
300sections for examples. 328sections for examples.
@@ -306,16 +334,17 @@ Removal (Override Style Syntax)
306 334
307You can remove values from lists using the removal override style 335You can remove values from lists using the removal override style
308syntax. Specifying a value for removal causes all occurrences of that 336syntax. Specifying a value for removal causes all occurrences of that
309value to be removed from the variable. 337value to be removed from the variable. Unlike ":append" and ":prepend",
338there is no need to add a leading or trailing space to the value.
310 339
311When you use this syntax, BitBake expects one or more strings. 340When you use this syntax, BitBake expects one or more strings.
312Surrounding spaces and spacing are preserved. Here is an example: :: 341Surrounding spaces and spacing are preserved. Here is an example::
313 342
314 FOO = "123 456 789 123456 123 456 123 456" 343 FOO = "123 456 789 123456 123 456 123 456"
315 FOO_remove = "123" 344 FOO:remove = "123"
316 FOO_remove = "456" 345 FOO:remove = "456"
317 FOO2 = " abc def ghi abcdef abc def abc def def" 346 FOO2 = " abc def ghi abcdef abc def abc def def"
318 FOO2_remove = "\ 347 FOO2:remove = "\
319 def \ 348 def \
320 abc \ 349 abc \
321 ghi \ 350 ghi \
@@ -324,40 +353,62 @@ Surrounding spaces and spacing are preserved. Here is an example: ::
324The variable ``FOO`` becomes 353The variable ``FOO`` becomes
325" 789 123456 " and ``FOO2`` becomes " abcdef ". 354" 789 123456 " and ``FOO2`` becomes " abcdef ".
326 355
327Like "_append" and "_prepend", "_remove" is applied at variable 356Like ":append" and ":prepend", ":remove" is applied at variable
328expansion time. 357expansion time.
329 358
359.. note::
360
361 The overrides are applied in this order, ":append", ":prepend", ":remove".
362 This implies it is not possible to re-append previously removed strings.
363 However, one can undo a ":remove" by using an intermediate variable whose
364 content is passed to the ":remove" so that modifying the intermediate
365 variable equals to keeping the string in::
366
367 FOOREMOVE = "123 456 789"
368 FOO:remove = "${FOOREMOVE}"
369 ...
370 FOOREMOVE = "123 789"
371
372 This expands to ``FOO:remove = "123 789"``.
373
374.. note::
375
376 Override application order may not match variable parse history, i.e.
377 the output of ``bitbake -e`` may contain ":remove" before ":append",
378 but the result will be removed string, because ":remove" is handled
379 last.
380
330Override Style Operation Advantages 381Override Style Operation Advantages
331----------------------------------- 382-----------------------------------
332 383
333An advantage of the override style operations "_append", "_prepend", and 384An advantage of the override style operations ":append", ":prepend", and
334"_remove" as compared to the "+=" and "=+" operators is that the 385":remove" as compared to the "+=" and "=+" operators is that the
335override style operators provide guaranteed operations. For example, 386override style operators provide guaranteed operations. For example,
336consider a class ``foo.bbclass`` that needs to add the value "val" to 387consider a class ``foo.bbclass`` that needs to add the value "val" to
337the variable ``FOO``, and a recipe that uses ``foo.bbclass`` as follows: :: 388the variable ``FOO``, and a recipe that uses ``foo.bbclass`` as follows::
338 389
339 inherit foo 390 inherit foo
340 FOO = "initial" 391 FOO = "initial"
341 392
342If ``foo.bbclass`` uses the "+=" operator, 393If ``foo.bbclass`` uses the "+=" operator,
343as follows, then the final value of ``FOO`` will be "initial", which is 394as follows, then the final value of ``FOO`` will be "initial", which is
344not what is desired: :: 395not what is desired::
345 396
346 FOO += "val" 397 FOO += "val"
347 398
348If, on the other hand, ``foo.bbclass`` 399If, on the other hand, ``foo.bbclass``
349uses the "_append" operator, then the final value of ``FOO`` will be 400uses the ":append" operator, then the final value of ``FOO`` will be
350"initial val", as intended: :: 401"initial val", as intended::
351 402
352 FOO_append = " val" 403 FOO:append = " val"
353 404
354.. note:: 405.. note::
355 406
356 It is never necessary to use "+=" together with "_append". The following 407 It is never necessary to use "+=" together with ":append". The following
357 sequence of assignments appends "barbaz" to FOO: :: 408 sequence of assignments appends "barbaz" to FOO::
358 409
359 FOO_append = "bar" 410 FOO:append = "bar"
360 FOO_append = "baz" 411 FOO:append = "baz"
361 412
362 413
363 The only effect of changing the second assignment in the previous 414 The only effect of changing the second assignment in the previous
@@ -378,10 +429,10 @@ You can find more out about variable flags in general in the
378 429
379You can define, append, and prepend values to variable flags. All the 430You can define, append, and prepend values to variable flags. All the
380standard syntax operations previously mentioned work for variable flags 431standard syntax operations previously mentioned work for variable flags
381except for override style syntax (i.e. "_prepend", "_append", and 432except for override style syntax (i.e. ":prepend", ":append", and
382"_remove"). 433":remove").
383 434
384Here are some examples showing how to set variable flags: :: 435Here are some examples showing how to set variable flags::
385 436
386 FOO[a] = "abc" 437 FOO[a] = "abc"
387 FOO[b] = "123" 438 FOO[b] = "123"
@@ -393,15 +444,21 @@ respectively. The ``[a]`` flag becomes "abc 456".
393 444
394No need exists to pre-define variable flags. You can simply start using 445No need exists to pre-define variable flags. You can simply start using
395them. One extremely common application is to attach some brief 446them. One extremely common application is to attach some brief
396documentation to a BitBake variable as follows: :: 447documentation to a BitBake variable as follows::
397 448
398 CACHE[doc] = "The directory holding the cache of the metadata." 449 CACHE[doc] = "The directory holding the cache of the metadata."
399 450
451.. note::
452
453 Variable flag names starting with an underscore (``_``) character
454 are allowed but are ignored by ``d.getVarFlags("VAR")``
455 in Python code. Such flag names are used internally by BitBake.
456
400Inline Python Variable Expansion 457Inline Python Variable Expansion
401-------------------------------- 458--------------------------------
402 459
403You can use inline Python variable expansion to set variables. Here is 460You can use inline Python variable expansion to set variables. Here is
404an example: :: 461an example::
405 462
406 DATE = "${@time.strftime('%Y%m%d',time.gmtime())}" 463 DATE = "${@time.strftime('%Y%m%d',time.gmtime())}"
407 464
@@ -410,21 +467,21 @@ This example results in the ``DATE`` variable being set to the current date.
410Probably the most common use of this feature is to extract the value of 467Probably the most common use of this feature is to extract the value of
411variables from BitBake's internal data dictionary, ``d``. The following 468variables from BitBake's internal data dictionary, ``d``. The following
412lines select the values of a package name and its version number, 469lines select the values of a package name and its version number,
413respectively: :: 470respectively::
414 471
415 PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}" 472 PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
416 PV = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}" 473 PV = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
417 474
418.. note:: 475.. note::
419 476
420 Inline Python expressions work just like variable expansions insofar as the 477 Inline Python expressions work just like variable expansions insofar as the
421 "=" and ":=" operators are concerned. Given the following assignment, foo() 478 "=" and ":=" operators are concerned. Given the following assignment, foo()
422 is called each time FOO is expanded: :: 479 is called each time FOO is expanded::
423 480
424 FOO = "${@foo()}" 481 FOO = "${@foo()}"
425 482
426 Contrast this with the following immediate assignment, where foo() is only 483 Contrast this with the following immediate assignment, where foo() is only
427 called once, while the assignment is parsed: :: 484 called once, while the assignment is parsed::
428 485
429 FOO := "${@foo()}" 486 FOO := "${@foo()}"
430 487
@@ -437,7 +494,7 @@ Unsetting variables
437 494
438It is possible to completely remove a variable or a variable flag from 495It is possible to completely remove a variable or a variable flag from
439BitBake's internal data dictionary by using the "unset" keyword. Here is 496BitBake's internal data dictionary by using the "unset" keyword. Here is
440an example: :: 497an example::
441 498
442 unset DATE 499 unset DATE
443 unset do_fetch[noexec] 500 unset do_fetch[noexec]
@@ -452,7 +509,7 @@ When specifying pathnames for use with BitBake, do not use the tilde
452cause BitBake to not recognize the path since BitBake does not expand 509cause BitBake to not recognize the path since BitBake does not expand
453this character in the same way a shell would. 510this character in the same way a shell would.
454 511
455Instead, provide a fuller path as the following example illustrates: :: 512Instead, provide a fuller path as the following example illustrates::
456 513
457 BBLAYERS ?= " \ 514 BBLAYERS ?= " \
458 /home/scott-lenovo/LayerA \ 515 /home/scott-lenovo/LayerA \
@@ -463,7 +520,7 @@ Exporting Variables to the Environment
463 520
464You can export variables to the environment of running tasks by using 521You can export variables to the environment of running tasks by using
465the ``export`` keyword. For example, in the following example, the 522the ``export`` keyword. For example, in the following example, the
466``do_foo`` task prints "value from the environment" when run: :: 523``do_foo`` task prints "value from the environment" when run::
467 524
468 export ENV_VARIABLE 525 export ENV_VARIABLE
469 ENV_VARIABLE = "value from the environment" 526 ENV_VARIABLE = "value from the environment"
@@ -481,7 +538,7 @@ It does not matter whether ``export ENV_VARIABLE`` appears before or
481after assignments to ``ENV_VARIABLE``. 538after assignments to ``ENV_VARIABLE``.
482 539
483It is also possible to combine ``export`` with setting a value for the 540It is also possible to combine ``export`` with setting a value for the
484variable. Here is an example: :: 541variable. Here is an example::
485 542
486 export ENV_VARIABLE = "variable-value" 543 export ENV_VARIABLE = "variable-value"
487 544
@@ -496,78 +553,78 @@ Conditional Syntax (Overrides)
496 553
497BitBake uses :term:`OVERRIDES` to control what 554BitBake uses :term:`OVERRIDES` to control what
498variables are overridden after BitBake parses recipes and configuration 555variables are overridden after BitBake parses recipes and configuration
499files. This section describes how you can use ``OVERRIDES`` as 556files. This section describes how you can use :term:`OVERRIDES` as
500conditional metadata, talks about key expansion in relationship to 557conditional metadata, talks about key expansion in relationship to
501``OVERRIDES``, and provides some examples to help with understanding. 558:term:`OVERRIDES`, and provides some examples to help with understanding.
502 559
503Conditional Metadata 560Conditional Metadata
504-------------------- 561--------------------
505 562
506You can use ``OVERRIDES`` to conditionally select a specific version of 563You can use :term:`OVERRIDES` to conditionally select a specific version of
507a variable and to conditionally append or prepend the value of a 564a variable and to conditionally append or prepend the value of a
508variable. 565variable.
509 566
510.. note:: 567.. note::
511 568
512 Overrides can only use lower-case characters. Additionally, 569 Overrides can only use lower-case characters, digits and dashes.
513 underscores are not permitted in override names as they are used to 570 In particular, colons are not permitted in override names as they are used to
514 separate overrides from each other and from the variable name. 571 separate overrides from each other and from the variable name.
515 572
516- *Selecting a Variable:* The ``OVERRIDES`` variable is a 573- *Selecting a Variable:* The :term:`OVERRIDES` variable is a
517 colon-character-separated list that contains items for which you want 574 colon-character-separated list that contains items for which you want
518 to satisfy conditions. Thus, if you have a variable that is 575 to satisfy conditions. Thus, if you have a variable that is
519 conditional on "arm", and "arm" is in ``OVERRIDES``, then the 576 conditional on "arm", and "arm" is in :term:`OVERRIDES`, then the
520 "arm"-specific version of the variable is used rather than the 577 "arm"-specific version of the variable is used rather than the
521 non-conditional version. Here is an example: :: 578 non-conditional version. Here is an example::
522 579
523 OVERRIDES = "architecture:os:machine" 580 OVERRIDES = "architecture:os:machine"
524 TEST = "default" 581 TEST = "default"
525 TEST_os = "osspecific" 582 TEST:os = "osspecific"
526 TEST_nooverride = "othercondvalue" 583 TEST:nooverride = "othercondvalue"
527 584
528 In this example, the ``OVERRIDES`` 585 In this example, the :term:`OVERRIDES`
529 variable lists three overrides: "architecture", "os", and "machine". 586 variable lists three overrides: "architecture", "os", and "machine".
530 The variable ``TEST`` by itself has a default value of "default". You 587 The variable ``TEST`` by itself has a default value of "default". You
531 select the os-specific version of the ``TEST`` variable by appending 588 select the os-specific version of the ``TEST`` variable by appending
532 the "os" override to the variable (i.e. ``TEST_os``). 589 the "os" override to the variable (i.e. ``TEST:os``).
533 590
534 To better understand this, consider a practical example that assumes 591 To better understand this, consider a practical example that assumes
535 an OpenEmbedded metadata-based Linux kernel recipe file. The 592 an OpenEmbedded metadata-based Linux kernel recipe file. The
536 following lines from the recipe file first set the kernel branch 593 following lines from the recipe file first set the kernel branch
537 variable ``KBRANCH`` to a default value, then conditionally override 594 variable ``KBRANCH`` to a default value, then conditionally override
538 that value based on the architecture of the build: :: 595 that value based on the architecture of the build::
539 596
540 KBRANCH = "standard/base" 597 KBRANCH = "standard/base"
541 KBRANCH_qemuarm = "standard/arm-versatile-926ejs" 598 KBRANCH:qemuarm = "standard/arm-versatile-926ejs"
542 KBRANCH_qemumips = "standard/mti-malta32" 599 KBRANCH:qemumips = "standard/mti-malta32"
543 KBRANCH_qemuppc = "standard/qemuppc" 600 KBRANCH:qemuppc = "standard/qemuppc"
544 KBRANCH_qemux86 = "standard/common-pc/base" 601 KBRANCH:qemux86 = "standard/common-pc/base"
545 KBRANCH_qemux86-64 = "standard/common-pc-64/base" 602 KBRANCH:qemux86-64 = "standard/common-pc-64/base"
546 KBRANCH_qemumips64 = "standard/mti-malta64" 603 KBRANCH:qemumips64 = "standard/mti-malta64"
547 604
548- *Appending and Prepending:* BitBake also supports append and prepend 605- *Appending and Prepending:* BitBake also supports append and prepend
549 operations to variable values based on whether a specific item is 606 operations to variable values based on whether a specific item is
550 listed in ``OVERRIDES``. Here is an example: :: 607 listed in :term:`OVERRIDES`. Here is an example::
551 608
552 DEPENDS = "glibc ncurses" 609 DEPENDS = "glibc ncurses"
553 OVERRIDES = "machine:local" 610 OVERRIDES = "machine:local"
554 DEPENDS_append_machine = "libmad" 611 DEPENDS:append:machine = "libmad"
555 612
556 In this example, ``DEPENDS`` becomes "glibc ncurses libmad". 613 In this example, :term:`DEPENDS` becomes "glibc ncurses libmad".
557 614
558 Again, using an OpenEmbedded metadata-based kernel recipe file as an 615 Again, using an OpenEmbedded metadata-based kernel recipe file as an
559 example, the following lines will conditionally append to the 616 example, the following lines will conditionally append to the
560 ``KERNEL_FEATURES`` variable based on the architecture: :: 617 ``KERNEL_FEATURES`` variable based on the architecture::
561 618
562 KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}" 619 KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}"
563 KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc" 620 KERNEL_FEATURES:append:qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
564 KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc" 621 KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
565 622
566- *Setting a Variable for a Single Task:* BitBake supports setting a 623- *Setting a Variable for a Single Task:* BitBake supports setting a
567 variable just for the duration of a single task. Here is an example: :: 624 variable just for the duration of a single task. Here is an example::
568 625
569 FOO_task-configure = "val 1" 626 FOO:task-configure = "val 1"
570 FOO_task-compile = "val 2" 627 FOO:task-compile = "val 2"
571 628
572 In the 629 In the
573 previous example, ``FOO`` has the value "val 1" while the 630 previous example, ``FOO`` has the value "val 1" while the
@@ -580,15 +637,25 @@ variable.
580 ``do_compile`` task. 637 ``do_compile`` task.
581 638
582 You can also use this syntax with other combinations (e.g. 639 You can also use this syntax with other combinations (e.g.
583 "``_prepend``") as shown in the following example: :: 640 "``:prepend``") as shown in the following example::
641
642 EXTRA_OEMAKE:prepend:task-compile = "${PARALLEL_MAKE} "
643
644.. note::
584 645
585 EXTRA_OEMAKE_prepend_task-compile = "${PARALLEL_MAKE} " 646 Before BitBake 1.52 (Honister 3.4), the syntax for :term:`OVERRIDES`
647 used ``_`` instead of ``:``, so you will still find a lot of documentation
648 using ``_append``, ``_prepend``, and ``_remove``, for example.
649
650 For details, see the
651 :yocto_docs:`Overrides Syntax Changes </migration-guides/migration-3.4.html#override-syntax-changes>`
652 section in the Yocto Project manual migration notes.
586 653
587Key Expansion 654Key Expansion
588------------- 655-------------
589 656
590Key expansion happens when the BitBake datastore is finalized. To better 657Key expansion happens when the BitBake datastore is finalized. To better
591understand this, consider the following example: :: 658understand this, consider the following example::
592 659
593 A${B} = "X" 660 A${B} = "X"
594 B = "2" 661 B = "2"
@@ -612,57 +679,57 @@ users.
612 679
613There is often confusion concerning the order in which overrides and 680There is often confusion concerning the order in which overrides and
614various "append" operators take effect. Recall that an append or prepend 681various "append" operators take effect. Recall that an append or prepend
615operation using "_append" and "_prepend" does not result in an immediate 682operation using ":append" and ":prepend" does not result in an immediate
616assignment as would "+=", ".=", "=+", or "=.". Consider the following 683assignment as would "+=", ".=", "=+", or "=.". Consider the following
617example: :: 684example::
618 685
619 OVERRIDES = "foo" 686 OVERRIDES = "foo"
620 A = "Z" 687 A = "Z"
621 A_foo_append = "X" 688 A:foo:append = "X"
622 689
623For this case, 690For this case,
624``A`` is unconditionally set to "Z" and "X" is unconditionally and 691``A`` is unconditionally set to "Z" and "X" is unconditionally and
625immediately appended to the variable ``A_foo``. Because overrides have 692immediately appended to the variable ``A:foo``. Because overrides have
626not been applied yet, ``A_foo`` is set to "X" due to the append and 693not been applied yet, ``A:foo`` is set to "X" due to the append and
627``A`` simply equals "Z". 694``A`` simply equals "Z".
628 695
629Applying overrides, however, changes things. Since "foo" is listed in 696Applying overrides, however, changes things. Since "foo" is listed in
630``OVERRIDES``, the conditional variable ``A`` is replaced with the "foo" 697:term:`OVERRIDES`, the conditional variable ``A`` is replaced with the "foo"
631version, which is equal to "X". So effectively, ``A_foo`` replaces 698version, which is equal to "X". So effectively, ``A:foo`` replaces
632``A``. 699``A``.
633 700
634This next example changes the order of the override and the append: :: 701This next example changes the order of the override and the append::
635 702
636 OVERRIDES = "foo" 703 OVERRIDES = "foo"
637 A = "Z" 704 A = "Z"
638 A_append_foo = "X" 705 A:append:foo = "X"
639 706
640For this case, before 707For this case, before
641overrides are handled, ``A`` is set to "Z" and ``A_append_foo`` is set 708overrides are handled, ``A`` is set to "Z" and ``A:append:foo`` is set
642to "X". Once the override for "foo" is applied, however, ``A`` gets 709to "X". Once the override for "foo" is applied, however, ``A`` gets
643appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces 710appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces
644are not appended. 711are not appended.
645 712
646This next example has the order of the appends and overrides reversed 713This next example has the order of the appends and overrides reversed
647back as in the first example: :: 714back as in the first example::
648 715
649 OVERRIDES = "foo" 716 OVERRIDES = "foo"
650 A = "Y" 717 A = "Y"
651 A_foo_append = "Z" 718 A:foo:append = "Z"
652 A_foo_append = "X" 719 A:foo:append = "X"
653 720
654For this case, before any overrides are resolved, 721For this case, before any overrides are resolved,
655``A`` is set to "Y" using an immediate assignment. After this immediate 722``A`` is set to "Y" using an immediate assignment. After this immediate
656assignment, ``A_foo`` is set to "Z", and then further appended with "X" 723assignment, ``A:foo`` is set to "Z", and then further appended with "X"
657leaving the variable set to "ZX". Finally, applying the override for 724leaving the variable set to "ZX". Finally, applying the override for
658"foo" results in the conditional variable ``A`` becoming "ZX" (i.e. 725"foo" results in the conditional variable ``A`` becoming "ZX" (i.e.
659``A`` is replaced with ``A_foo``). 726``A`` is replaced with ``A:foo``).
660 727
661This final example mixes in some varying operators: :: 728This final example mixes in some varying operators::
662 729
663 A = "1" 730 A = "1"
664 A_append = "2" 731 A:append = "2"
665 A_append = "3" 732 A:append = "3"
666 A += "4" 733 A += "4"
667 A .= "5" 734 A .= "5"
668 735
@@ -670,7 +737,7 @@ For this case, the type of append
670operators are affecting the order of assignments as BitBake passes 737operators are affecting the order of assignments as BitBake passes
671through the code multiple times. Initially, ``A`` is set to "1 45" 738through the code multiple times. Initially, ``A`` is set to "1 45"
672because of the three statements that use immediate operators. After 739because of the three statements that use immediate operators. After
673these assignments are made, BitBake applies the "_append" operations. 740these assignments are made, BitBake applies the ":append" operations.
674Those operations result in ``A`` becoming "1 4523". 741Those operations result in ``A`` becoming "1 4523".
675 742
676Sharing Functionality 743Sharing Functionality
@@ -686,8 +753,10 @@ share the task.
686 753
687This section presents the mechanisms BitBake provides to allow you to 754This section presents the mechanisms BitBake provides to allow you to
688share functionality between recipes. Specifically, the mechanisms 755share functionality between recipes. Specifically, the mechanisms
689include ``include``, ``inherit``, ``INHERIT``, and ``require`` 756include ``include``, ``inherit``, :term:`INHERIT`, and ``require``
690directives. 757directives. There is also a higher-level abstraction called
758``configuration fragments`` that is enabled with ``addfragments``
759directive.
691 760
692Locating Include and Class Files 761Locating Include and Class Files
693-------------------------------- 762--------------------------------
@@ -702,7 +771,9 @@ current directory for ``include`` and ``require`` directives.
702 771
703In order for include and class files to be found by BitBake, they need 772In order for include and class files to be found by BitBake, they need
704to be located in a "classes" subdirectory that can be found in 773to be located in a "classes" subdirectory that can be found in
705``BBPATH``. 774:term:`BBPATH`.
775
776.. _ref-bitbake-user-manual-metadata-inherit:
706 777
707``inherit`` Directive 778``inherit`` Directive
708--------------------- 779---------------------
@@ -720,12 +791,12 @@ file and then have your recipe inherit that class file.
720 791
721As an example, your recipes could use the following directive to inherit 792As an example, your recipes could use the following directive to inherit
722an ``autotools.bbclass`` file. The class file would contain common 793an ``autotools.bbclass`` file. The class file would contain common
723functionality for using Autotools that could be shared across recipes: :: 794functionality for using Autotools that could be shared across recipes::
724 795
725 inherit autotools 796 inherit autotools
726 797
727In this case, BitBake would search for the directory 798In this case, BitBake would search for the directory
728``classes/autotools.bbclass`` in ``BBPATH``. 799``classes/autotools.bbclass`` in :term:`BBPATH`.
729 800
730.. note:: 801.. note::
731 802
@@ -734,7 +805,7 @@ In this case, BitBake would search for the directory
734 805
735If you want to use the directive to inherit multiple classes, separate 806If you want to use the directive to inherit multiple classes, separate
736them with spaces. The following example shows how to inherit both the 807them with spaces. The following example shows how to inherit both the
737``buildhistory`` and ``rm_work`` classes: :: 808``buildhistory`` and ``rm_work`` classes::
738 809
739 inherit buildhistory rm_work 810 inherit buildhistory rm_work
740 811
@@ -742,19 +813,43 @@ An advantage with the inherit directive as compared to both the
742:ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>` and :ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>` 813:ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>` and :ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>`
743directives is that you can inherit class files conditionally. You can 814directives is that you can inherit class files conditionally. You can
744accomplish this by using a variable expression after the ``inherit`` 815accomplish this by using a variable expression after the ``inherit``
745statement. Here is an example: :: 816statement.
817
818For inheriting classes conditionally, using the :ref:`inherit_defer
819<ref-bitbake-user-manual-metadata-inherit-defer>` directive is advised as
820:ref:`inherit_defer <ref-bitbake-user-manual-metadata-inherit-defer>` is
821evaluated at the end of parsing.
822
823.. _ref-bitbake-user-manual-metadata-inherit-defer:
824
825``inherit_defer`` Directive
826~~~~~~~~~~~~~~~~~~~~~~~~~~~
827
828The :ref:`inherit_defer <ref-bitbake-user-manual-metadata-inherit-defer>`
829directive works like the :ref:`inherit
830<ref-bitbake-user-manual-metadata-inherit>` directive, except that it is only
831evaluated at the end of parsing. Its usage is recommended when a conditional
832expression is used.
746 833
747 inherit ${VARNAME} 834This allows conditional expressions to be evaluated "late", meaning changes to
835the variable after the line is parsed will take effect. With the :ref:`inherit
836<ref-bitbake-user-manual-metadata-inherit>` directive this is not the case.
837
838Here is an example::
839
840 inherit_defer ${VARNAME}
748 841
749If ``VARNAME`` is 842If ``VARNAME`` is
750going to be set, it needs to be set before the ``inherit`` statement is 843going to be set, it needs to be set before the ``inherit_defer`` statement is
751parsed. One way to achieve a conditional inherit in this case is to use 844parsed. One way to achieve a conditional inherit in this case is to use
752overrides: :: 845overrides::
753 846
754 VARIABLE = "" 847 VARIABLE = ""
755 VARIABLE_someoverride = "myclass" 848 VARIABLE:someoverride = "myclass"
756 849
757Another method is by using anonymous Python. Here is an example: :: 850Another method is by using :ref:`anonymous Python
851<bitbake-user-manual/bitbake-user-manual-metadata:Anonymous Python Functions>`.
852Here is an example::
758 853
759 python () { 854 python () {
760 if condition == value: 855 if condition == value:
@@ -763,11 +858,14 @@ Another method is by using anonymous Python. Here is an example: ::
763 d.setVar('VARIABLE', '') 858 d.setVar('VARIABLE', '')
764 } 859 }
765 860
766Alternatively, you could use an in-line Python expression in the 861Alternatively, you could use an inline Python expression in the
767following form: :: 862following form::
863
864 inherit_defer ${@'classname' if condition else ''}
768 865
769 inherit ${@'classname' if condition else ''} 866Or::
770 inherit ${@functionname(params)} 867
868 inherit_defer ${@bb.utils.contains('VARIABLE', 'something', 'classname', '', d)}
771 869
772In all cases, if the expression evaluates to an 870In all cases, if the expression evaluates to an
773empty string, the statement does not trigger a syntax error because it 871empty string, the statement does not trigger a syntax error because it
@@ -780,7 +878,7 @@ BitBake understands the ``include`` directive. This directive causes
780BitBake to parse whatever file you specify, and to insert that file at 878BitBake to parse whatever file you specify, and to insert that file at
781that location. The directive is much like its equivalent in Make except 879that location. The directive is much like its equivalent in Make except
782that if the path specified on the include line is a relative path, 880that if the path specified on the include line is a relative path,
783BitBake locates the first file it can find within ``BBPATH``. 881BitBake locates the first file it can find within :term:`BBPATH`.
784 882
785The include directive is a more generic method of including 883The include directive is a more generic method of including
786functionality as compared to the :ref:`inherit <bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` directive>` 884functionality as compared to the :ref:`inherit <bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` directive>`
@@ -790,7 +888,7 @@ encapsulated functionality or configuration that does not suit a
790``.bbclass`` file. 888``.bbclass`` file.
791 889
792As an example, suppose you needed a recipe to include some self-test 890As an example, suppose you needed a recipe to include some self-test
793definitions: :: 891definitions::
794 892
795 include test_defs.inc 893 include test_defs.inc
796 894
@@ -802,6 +900,33 @@ definitions: ::
802 of include . Doing so makes sure that an error is produced if the file cannot 900 of include . Doing so makes sure that an error is produced if the file cannot
803 be found. 901 be found.
804 902
903``include_all`` Directive
904-------------------------
905
906The ``include_all`` directive works like the :ref:`include
907<bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>`
908directive but will include all of the files that match the specified path in
909the enabled layers (layers part of :term:`BBLAYERS`).
910
911For example, let's say a ``maintainers.inc`` file is present in different layers
912and is conventionally placed in the ``conf/distro/include`` directory of each
913layer. In that case the ``include_all`` directive can be used to include
914the ``maintainers.inc`` file for all of these layers::
915
916 include_all conf/distro/include/maintainers.inc
917
918In other words, the ``maintainers.inc`` file for each layer is included through
919the :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>`
920directive.
921
922BitBake will iterate through the colon-separated :term:`BBPATH` list to look for
923matching files to include, from left to right. As a consequence, matching files
924are included in that order.
925
926As the ``include_all`` directive uses the :ref:`include
927<bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>`
928directive in the background, no error is produced if no files are matched.
929
805.. _require-inclusion: 930.. _require-inclusion:
806 931
807``require`` Directive 932``require`` Directive
@@ -822,7 +947,7 @@ does not suit a ``.bbclass`` file.
822 947
823Similar to how BitBake handles :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>`, if 948Similar to how BitBake handles :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>`, if
824the path specified on the require line is a relative path, BitBake 949the path specified on the require line is a relative path, BitBake
825locates the first file it can find within ``BBPATH``. 950locates the first file it can find within :term:`BBPATH`.
826 951
827As an example, suppose you have two versions of a recipe (e.g. 952As an example, suppose you have two versions of a recipe (e.g.
828``foo_1.2.2.bb`` and ``foo_2.0.0.bb``) where each version contains some 953``foo_1.2.2.bb`` and ``foo_2.0.0.bb``) where each version contains some
@@ -831,7 +956,7 @@ include file named ``foo.inc`` that contains the common definitions
831needed to build "foo". You need to be sure ``foo.inc`` is located in the 956needed to build "foo". You need to be sure ``foo.inc`` is located in the
832same directory as your two recipe files as well. Once these conditions 957same directory as your two recipe files as well. Once these conditions
833are set up, you can share the functionality using a ``require`` 958are set up, you can share the functionality using a ``require``
834directive from within each recipe: :: 959directive from within each recipe::
835 960
836 require foo.inc 961 require foo.inc
837 962
@@ -844,14 +969,14 @@ class. BitBake only supports this directive when used within a
844configuration file. 969configuration file.
845 970
846As an example, suppose you needed to inherit a class file called 971As an example, suppose you needed to inherit a class file called
847``abc.bbclass`` from a configuration file as follows: :: 972``abc.bbclass`` from a configuration file as follows::
848 973
849 INHERIT += "abc" 974 INHERIT += "abc"
850 975
851This configuration directive causes the named class to be inherited at 976This configuration directive causes the named class to be inherited at
852the point of the directive during parsing. As with the ``inherit`` 977the point of the directive during parsing. As with the ``inherit``
853directive, the ``.bbclass`` file must be located in a "classes" 978directive, the ``.bbclass`` file must be located in a "classes"
854subdirectory in one of the directories specified in ``BBPATH``. 979subdirectory in one of the directories specified in :term:`BBPATH`.
855 980
856.. note:: 981.. note::
857 982
@@ -862,10 +987,69 @@ subdirectory in one of the directories specified in ``BBPATH``.
862If you want to use the directive to inherit multiple classes, you can 987If you want to use the directive to inherit multiple classes, you can
863provide them on the same line in the ``local.conf`` file. Use spaces to 988provide them on the same line in the ``local.conf`` file. Use spaces to
864separate the classes. The following example shows how to inherit both 989separate the classes. The following example shows how to inherit both
865the ``autotools`` and ``pkgconfig`` classes: :: 990the ``autotools`` and ``pkgconfig`` classes::
866 991
867 INHERIT += "autotools pkgconfig" 992 INHERIT += "autotools pkgconfig"
868 993
994``addfragments`` Directive
995--------------------------
996
997This directive allows fine-tuning local configurations with configuration
998snippets contained in layers in a structured, controlled way. Typically it would
999go into ``bitbake.conf``, for example::
1000
1001 addfragments conf/fragments OE_FRAGMENTS OE_FRAGMENTS_METADATA_VARS OE_BUILTIN_FRAGMENTS
1002
1003``addfragments`` takes four parameters:
1004
1005- path prefix for fragment files inside the layer file tree that bitbake
1006 uses to construct full paths to the fragment files
1007
1008- name of variable that holds the list of enabled fragments in an
1009 active build
1010
1011- name of variable that contains a list of variable names containing
1012 fragment-specific metadata (such as descriptions)
1013
1014- name of variable that contains definitions for built-in fragments
1015
1016This allows listing enabled configuration fragments in ``OE_FRAGMENTS``
1017variable like this::
1018
1019 OE_FRAGMENTS = "core/domain/somefragment core/someotherfragment anotherlayer/anotherdomain/anotherfragment"
1020
1021Fragment names listed in this variable must be prefixed by the layer name
1022where a fragment file is located, defined by :term:`BBFILE_COLLECTIONS` in ``layer.conf``.
1023
1024The implementation then expands this list into
1025:ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>`
1026directives with full paths to respective layers::
1027
1028 require /path/to/core-layer/conf/fragments/domain/somefragment.conf
1029 require /path/to/core-layer/conf/fragments/someotherfragment.conf
1030 require /path/to/another-layer/conf/fragments/anotherdomain/anotherfragment.conf
1031
1032The variable containing a list of fragment metadata variables could look like this::
1033
1034 OE_FRAGMENTS_METADATA_VARS = "BB_CONF_FRAGMENT_SUMMARY BB_CONF_FRAGMENT_DESCRIPTION"
1035
1036The implementation will add a flag containing the fragment name to each of those variables
1037when parsing fragments, so that the variables are namespaced by fragment name, and do not override
1038each other when several fragments are enabled.
1039
1040The variable containing a built-in fragment definitions could look like this::
1041
1042 OE_BUILTIN_FRAGMENTS = "someprefix:SOMEVARIABLE anotherprefix:ANOTHERVARIABLE"
1043
1044and then if 'someprefix/somevalue' is added to the variable that holds the list
1045of enabled fragments:
1046
1047 OE_FRAGMENTS = "... someprefix/somevalue"
1048
1049bitbake will treat that as direct value assignment in its configuration::
1050
1051 SOMEVARIABLE = "somevalue"
1052
869Functions 1053Functions
870========= 1054=========
871 1055
@@ -893,9 +1077,9 @@ Regardless of the type of function, you can only define them in class
893Shell Functions 1077Shell Functions
894--------------- 1078---------------
895 1079
896Functions written in shell script and executed either directly as 1080Functions written in shell script are executed either directly as
897functions, tasks, or both. They can also be called by other shell 1081functions, tasks, or both. They can also be called by other shell
898functions. Here is an example shell function definition: :: 1082functions. Here is an example shell function definition::
899 1083
900 some_function () { 1084 some_function () {
901 echo "Hello World" 1085 echo "Hello World"
@@ -907,19 +1091,19 @@ rules. The scripts are executed by ``/bin/sh``, which may not be a bash
907shell but might be something such as ``dash``. You should not use 1091shell but might be something such as ``dash``. You should not use
908Bash-specific script (bashisms). 1092Bash-specific script (bashisms).
909 1093
910Overrides and override-style operators like ``_append`` and ``_prepend`` 1094Overrides and override-style operators like ``:append`` and ``:prepend``
911can also be applied to shell functions. Most commonly, this application 1095can also be applied to shell functions. Most commonly, this application
912would be used in a ``.bbappend`` file to modify functions in the main 1096would be used in a ``.bbappend`` file to modify functions in the main
913recipe. It can also be used to modify functions inherited from classes. 1097recipe. It can also be used to modify functions inherited from classes.
914 1098
915As an example, consider the following: :: 1099As an example, consider the following::
916 1100
917 do_foo() { 1101 do_foo() {
918 bbplain first 1102 bbplain first
919 fn 1103 fn
920 } 1104 }
921 1105
922 fn_prepend() { 1106 fn:prepend() {
923 bbplain second 1107 bbplain second
924 } 1108 }
925 1109
@@ -927,11 +1111,11 @@ As an example, consider the following: ::
927 bbplain third 1111 bbplain third
928 } 1112 }
929 1113
930 do_foo_append() { 1114 do_foo:append() {
931 bbplain fourth 1115 bbplain fourth
932 } 1116 }
933 1117
934Running ``do_foo`` prints the following: :: 1118Running ``do_foo`` prints the following::
935 1119
936 recipename do_foo: first 1120 recipename do_foo: first
937 recipename do_foo: second 1121 recipename do_foo: second
@@ -943,7 +1127,7 @@ Running ``do_foo`` prints the following: ::
943 Overrides and override-style operators can be applied to any shell 1127 Overrides and override-style operators can be applied to any shell
944 function, not just :ref:`tasks <bitbake-user-manual/bitbake-user-manual-metadata:tasks>`. 1128 function, not just :ref:`tasks <bitbake-user-manual/bitbake-user-manual-metadata:tasks>`.
945 1129
946You can use the ``bitbake -e`` recipename command to view the final 1130You can use the ``bitbake -e recipename`` command to view the final
947assembled function after all overrides have been applied. 1131assembled function after all overrides have been applied.
948 1132
949BitBake-Style Python Functions 1133BitBake-Style Python Functions
@@ -952,7 +1136,7 @@ BitBake-Style Python Functions
952These functions are written in Python and executed by BitBake or other 1136These functions are written in Python and executed by BitBake or other
953Python functions using ``bb.build.exec_func()``. 1137Python functions using ``bb.build.exec_func()``.
954 1138
955An example BitBake function is: :: 1139An example BitBake function is::
956 1140
957 python some_python_function () { 1141 python some_python_function () {
958 d.setVar("TEXT", "Hello World") 1142 d.setVar("TEXT", "Hello World")
@@ -975,9 +1159,9 @@ import these modules. Also in these types of functions, the datastore
975Similar to shell functions, you can also apply overrides and 1159Similar to shell functions, you can also apply overrides and
976override-style operators to BitBake-style Python functions. 1160override-style operators to BitBake-style Python functions.
977 1161
978As an example, consider the following: :: 1162As an example, consider the following::
979 1163
980 python do_foo_prepend() { 1164 python do_foo:prepend() {
981 bb.plain("first") 1165 bb.plain("first")
982 } 1166 }
983 1167
@@ -985,17 +1169,17 @@ As an example, consider the following: ::
985 bb.plain("second") 1169 bb.plain("second")
986 } 1170 }
987 1171
988 python do_foo_append() { 1172 python do_foo:append() {
989 bb.plain("third") 1173 bb.plain("third")
990 } 1174 }
991 1175
992Running ``do_foo`` prints the following: :: 1176Running ``do_foo`` prints the following::
993 1177
994 recipename do_foo: first 1178 recipename do_foo: first
995 recipename do_foo: second 1179 recipename do_foo: second
996 recipename do_foo: third 1180 recipename do_foo: third
997 1181
998You can use the ``bitbake -e`` recipename command to view 1182You can use the ``bitbake -e recipename`` command to view
999the final assembled function after all overrides have been applied. 1183the final assembled function after all overrides have been applied.
1000 1184
1001Python Functions 1185Python Functions
@@ -1004,7 +1188,7 @@ Python Functions
1004These functions are written in Python and are executed by other Python 1188These functions are written in Python and are executed by other Python
1005code. Examples of Python functions are utility functions that you intend 1189code. Examples of Python functions are utility functions that you intend
1006to call from in-line Python or from within other Python functions. Here 1190to call from in-line Python or from within other Python functions. Here
1007is an example: :: 1191is an example::
1008 1192
1009 def get_depends(d): 1193 def get_depends(d):
1010 if d.getVar('SOMECONDITION'): 1194 if d.getVar('SOMECONDITION'):
@@ -1015,7 +1199,7 @@ is an example: ::
1015 SOMECONDITION = "1" 1199 SOMECONDITION = "1"
1016 DEPENDS = "${@get_depends(d)}" 1200 DEPENDS = "${@get_depends(d)}"
1017 1201
1018This would result in ``DEPENDS`` containing ``dependencywithcond``. 1202This would result in :term:`DEPENDS` containing ``dependencywithcond``.
1019 1203
1020Here are some things to know about Python functions: 1204Here are some things to know about Python functions:
1021 1205
@@ -1056,7 +1240,7 @@ functions and regular Python functions defined with "def":
1056- Regular Python functions are called with the usual Python syntax. 1240- Regular Python functions are called with the usual Python syntax.
1057 BitBake-style Python functions are usually tasks and are called 1241 BitBake-style Python functions are usually tasks and are called
1058 directly by BitBake, but can also be called manually from Python code 1242 directly by BitBake, but can also be called manually from Python code
1059 by using the ``bb.build.exec_func()`` function. Here is an example: :: 1243 by using the ``bb.build.exec_func()`` function. Here is an example::
1060 1244
1061 bb.build.exec_func("my_bitbake_style_function", d) 1245 bb.build.exec_func("my_bitbake_style_function", d)
1062 1246
@@ -1094,7 +1278,7 @@ Sometimes it is useful to set variables or perform other operations
1094programmatically during parsing. To do this, you can define special 1278programmatically during parsing. To do this, you can define special
1095Python functions, called anonymous Python functions, that run at the end 1279Python functions, called anonymous Python functions, that run at the end
1096of parsing. For example, the following conditionally sets a variable 1280of parsing. For example, the following conditionally sets a variable
1097based on the value of another variable: :: 1281based on the value of another variable::
1098 1282
1099 python () { 1283 python () {
1100 if d.getVar('SOMEVAR') == 'value': 1284 if d.getVar('SOMEVAR') == 'value':
@@ -1107,7 +1291,7 @@ the name "__anonymous", rather than no name.
1107Anonymous Python functions always run at the end of parsing, regardless 1291Anonymous Python functions always run at the end of parsing, regardless
1108of where they are defined. If a recipe contains many anonymous 1292of where they are defined. If a recipe contains many anonymous
1109functions, they run in the same order as they are defined within the 1293functions, they run in the same order as they are defined within the
1110recipe. As an example, consider the following snippet: :: 1294recipe. As an example, consider the following snippet::
1111 1295
1112 python () { 1296 python () {
1113 d.setVar('FOO', 'foo 2') 1297 d.setVar('FOO', 'foo 2')
@@ -1122,7 +1306,7 @@ recipe. As an example, consider the following snippet: ::
1122 BAR = "bar 1" 1306 BAR = "bar 1"
1123 1307
1124The previous example is conceptually 1308The previous example is conceptually
1125equivalent to the following snippet: :: 1309equivalent to the following snippet::
1126 1310
1127 FOO = "foo 1" 1311 FOO = "foo 1"
1128 BAR = "bar 1" 1312 BAR = "bar 1"
@@ -1134,12 +1318,12 @@ equivalent to the following snippet: ::
1134values set for the variables within the anonymous functions become 1318values set for the variables within the anonymous functions become
1135available to tasks, which always run after parsing. 1319available to tasks, which always run after parsing.
1136 1320
1137Overrides and override-style operators such as "``_append``" are applied 1321Overrides and override-style operators such as "``:append``" are applied
1138before anonymous functions run. In the following example, ``FOO`` ends 1322before anonymous functions run. In the following example, ``FOO`` ends
1139up with the value "foo from anonymous": :: 1323up with the value "foo from anonymous"::
1140 1324
1141 FOO = "foo" 1325 FOO = "foo"
1142 FOO_append = " from outside" 1326 FOO:append = " from outside"
1143 1327
1144 python () { 1328 python () {
1145 d.setVar("FOO", "foo from anonymous") 1329 d.setVar("FOO", "foo from anonymous")
@@ -1164,7 +1348,7 @@ To understand the benefits of this feature, consider the basic scenario
1164where a class defines a task function and your recipe inherits the 1348where a class defines a task function and your recipe inherits the
1165class. In this basic scenario, your recipe inherits the task function as 1349class. In this basic scenario, your recipe inherits the task function as
1166defined in the class. If desired, your recipe can add to the start and 1350defined in the class. If desired, your recipe can add to the start and
1167end of the function by using the "_prepend" or "_append" operations 1351end of the function by using the ":prepend" or ":append" operations
1168respectively, or it can redefine the function completely. However, if it 1352respectively, or it can redefine the function completely. However, if it
1169redefines the function, there is no means for it to call the class 1353redefines the function, there is no means for it to call the class
1170version of the function. ``EXPORT_FUNCTIONS`` provides a mechanism that 1354version of the function. ``EXPORT_FUNCTIONS`` provides a mechanism that
@@ -1173,24 +1357,24 @@ version of the function.
1173 1357
1174To make use of this technique, you need the following things in place: 1358To make use of this technique, you need the following things in place:
1175 1359
1176- The class needs to define the function as follows: :: 1360- The class needs to define the function as follows::
1177 1361
1178 classname_functionname 1362 classname_functionname
1179 1363
1180 For example, if you have a class file 1364 For example, if you have a class file
1181 ``bar.bbclass`` and a function named ``do_foo``, the class must 1365 ``bar.bbclass`` and a function named ``do_foo``, the class must
1182 define the function as follows: :: 1366 define the function as follows::
1183 1367
1184 bar_do_foo 1368 bar_do_foo
1185 1369
1186- The class needs to contain the ``EXPORT_FUNCTIONS`` statement as 1370- The class needs to contain the ``EXPORT_FUNCTIONS`` statement as
1187 follows: :: 1371 follows::
1188 1372
1189 EXPORT_FUNCTIONS functionname 1373 EXPORT_FUNCTIONS functionname
1190 1374
1191 For example, continuing with 1375 For example, continuing with
1192 the same example, the statement in the ``bar.bbclass`` would be as 1376 the same example, the statement in the ``bar.bbclass`` would be as
1193 follows: :: 1377 follows::
1194 1378
1195 EXPORT_FUNCTIONS do_foo 1379 EXPORT_FUNCTIONS do_foo
1196 1380
@@ -1199,7 +1383,7 @@ To make use of this technique, you need the following things in place:
1199 class version of the function, it should call ``bar_do_foo``. 1383 class version of the function, it should call ``bar_do_foo``.
1200 Assuming ``do_foo`` was a shell function and ``EXPORT_FUNCTIONS`` was 1384 Assuming ``do_foo`` was a shell function and ``EXPORT_FUNCTIONS`` was
1201 used as above, the recipe's function could conditionally call the 1385 used as above, the recipe's function could conditionally call the
1202 class version of the function as follows: :: 1386 class version of the function as follows::
1203 1387
1204 do_foo() { 1388 do_foo() {
1205 if [ somecondition ] ; then 1389 if [ somecondition ] ; then
@@ -1233,11 +1417,11 @@ Tasks are either :ref:`shell functions <bitbake-user-manual/bitbake-user-manual-
1233that have been promoted to tasks by using the ``addtask`` command. The 1417that have been promoted to tasks by using the ``addtask`` command. The
1234``addtask`` command can also optionally describe dependencies between 1418``addtask`` command can also optionally describe dependencies between
1235the task and other tasks. Here is an example that shows how to define a 1419the task and other tasks. Here is an example that shows how to define a
1236task and declare some dependencies: :: 1420task and declare some dependencies::
1237 1421
1238 python do_printdate () { 1422 python do_printdate () {
1239 import time 1423 import datetime
1240 print time.strftime('%Y%m%d', time.gmtime()) 1424 bb.plain('Date: %s' % (datetime.date.today()))
1241 } 1425 }
1242 addtask printdate after do_fetch before do_build 1426 addtask printdate after do_fetch before do_build
1243 1427
@@ -1264,12 +1448,12 @@ Additionally, the ``do_printdate`` task becomes dependent upon the
1264 rerun for experimentation purposes, you can make BitBake always 1448 rerun for experimentation purposes, you can make BitBake always
1265 consider the task "out-of-date" by using the 1449 consider the task "out-of-date" by using the
1266 :ref:`[nostamp] <bitbake-user-manual/bitbake-user-manual-metadata:Variable Flags>` 1450 :ref:`[nostamp] <bitbake-user-manual/bitbake-user-manual-metadata:Variable Flags>`
1267 variable flag, as follows: :: 1451 variable flag, as follows::
1268 1452
1269 do_printdate[nostamp] = "1" 1453 do_printdate[nostamp] = "1"
1270 1454
1271 You can also explicitly run the task and provide the 1455 You can also explicitly run the task and provide the
1272 -f option as follows: :: 1456 -f option as follows::
1273 1457
1274 $ bitbake recipe -c printdate -f 1458 $ bitbake recipe -c printdate -f
1275 1459
@@ -1278,7 +1462,7 @@ Additionally, the ``do_printdate`` task becomes dependent upon the
1278 name. 1462 name.
1279 1463
1280You might wonder about the practical effects of using ``addtask`` 1464You might wonder about the practical effects of using ``addtask``
1281without specifying any dependencies as is done in the following example: :: 1465without specifying any dependencies as is done in the following example::
1282 1466
1283 addtask printdate 1467 addtask printdate
1284 1468
@@ -1286,7 +1470,7 @@ In this example, assuming dependencies have not been
1286added through some other means, the only way to run the task is by 1470added through some other means, the only way to run the task is by
1287explicitly selecting it with ``bitbake`` recipe ``-c printdate``. You 1471explicitly selecting it with ``bitbake`` recipe ``-c printdate``. You
1288can use the ``do_listtasks`` task to list all tasks defined in a recipe 1472can use the ``do_listtasks`` task to list all tasks defined in a recipe
1289as shown in the following example: :: 1473as shown in the following example::
1290 1474
1291 $ bitbake recipe -c listtasks 1475 $ bitbake recipe -c listtasks
1292 1476
@@ -1296,12 +1480,23 @@ For more information on task dependencies, see the
1296See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" section for information 1480See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" section for information
1297on variable flags you can use with tasks. 1481on variable flags you can use with tasks.
1298 1482
1483.. note::
1484
1485 While it's infrequent, it's possible to define multiple tasks as
1486 dependencies when calling ``addtask``. For example, here's a snippet
1487 from the OpenEmbedded class file ``package_tar.bbclass``::
1488
1489 addtask package_write_tar before do_build after do_packagedata do_package
1490
1491 Note how the ``package_write_tar`` task has to wait until both of
1492 ``do_packagedata`` and ``do_package`` complete.
1493
1299Deleting a Task 1494Deleting a Task
1300--------------- 1495---------------
1301 1496
1302As well as being able to add tasks, you can delete them. Simply use the 1497As well as being able to add tasks, you can delete them. Simply use the
1303``deltask`` command to delete a task. For example, to delete the example 1498``deltask`` command to delete a task. For example, to delete the example
1304task used in the previous sections, you would use: :: 1499task used in the previous sections, you would use::
1305 1500
1306 deltask printdate 1501 deltask printdate
1307 1502
@@ -1317,7 +1512,7 @@ to run before ``do_a``.
1317 1512
1318If you want dependencies such as these to remain intact, use the 1513If you want dependencies such as these to remain intact, use the
1319``[noexec]`` varflag to disable the task instead of using the 1514``[noexec]`` varflag to disable the task instead of using the
1320``deltask`` command to delete it: :: 1515``deltask`` command to delete it::
1321 1516
1322 do_b[noexec] = "1" 1517 do_b[noexec] = "1"
1323 1518
@@ -1331,8 +1526,8 @@ the build machine cannot influence the build.
1331.. note:: 1526.. note::
1332 1527
1333 By default, BitBake cleans the environment to include only those 1528 By default, BitBake cleans the environment to include only those
1334 things exported or listed in its whitelist to ensure that the build 1529 things exported or listed in its passthrough list to ensure that the
1335 environment is reproducible and consistent. You can prevent this 1530 build environment is reproducible and consistent. You can prevent this
1336 "cleaning" by setting the :term:`BB_PRESERVE_ENV` variable. 1531 "cleaning" by setting the :term:`BB_PRESERVE_ENV` variable.
1337 1532
1338Consequently, if you do want something to get passed into the build task 1533Consequently, if you do want something to get passed into the build task
@@ -1340,14 +1535,14 @@ environment, you must take these two steps:
1340 1535
1341#. Tell BitBake to load what you want from the environment into the 1536#. Tell BitBake to load what you want from the environment into the
1342 datastore. You can do so through the 1537 datastore. You can do so through the
1343 :term:`BB_ENV_WHITELIST` and 1538 :term:`BB_ENV_PASSTHROUGH` and
1344 :term:`BB_ENV_EXTRAWHITE` variables. For 1539 :term:`BB_ENV_PASSTHROUGH_ADDITIONS` variables. For
1345 example, assume you want to prevent the build system from accessing 1540 example, assume you want to prevent the build system from accessing
1346 your ``$HOME/.ccache`` directory. The following command "whitelists" 1541 your ``$HOME/.ccache`` directory. The following command adds the
1347 the environment variable ``CCACHE_DIR`` causing BitBake to allow that 1542 the environment variable ``CCACHE_DIR`` to BitBake's passthrough
1348 variable into the datastore: :: 1543 list to allow that variable into the datastore::
1349 1544
1350 export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE CCACHE_DIR" 1545 export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS CCACHE_DIR"
1351 1546
1352#. Tell BitBake to export what you have loaded into the datastore to the 1547#. Tell BitBake to export what you have loaded into the datastore to the
1353 task environment of every running task. Loading something from the 1548 task environment of every running task. Loading something from the
@@ -1355,7 +1550,7 @@ environment, you must take these two steps:
1355 available in the datastore. To export it to the task environment of 1550 available in the datastore. To export it to the task environment of
1356 every running task, use a command similar to the following in your 1551 every running task, use a command similar to the following in your
1357 local configuration file ``local.conf`` or your distribution 1552 local configuration file ``local.conf`` or your distribution
1358 configuration file: :: 1553 configuration file::
1359 1554
1360 export CCACHE_DIR 1555 export CCACHE_DIR
1361 1556
@@ -1364,17 +1559,17 @@ environment, you must take these two steps:
1364 A side effect of the previous steps is that BitBake records the 1559 A side effect of the previous steps is that BitBake records the
1365 variable as a dependency of the build process in things like the 1560 variable as a dependency of the build process in things like the
1366 setscene checksums. If doing so results in unnecessary rebuilds of 1561 setscene checksums. If doing so results in unnecessary rebuilds of
1367 tasks, you can whitelist the variable so that the setscene code 1562 tasks, you can also flag the variable so that the setscene code
1368 ignores the dependency when it creates checksums. 1563 ignores the dependency when it creates checksums.
1369 1564
1370Sometimes, it is useful to be able to obtain information from the 1565Sometimes, it is useful to be able to obtain information from the
1371original execution environment. BitBake saves a copy of the original 1566original execution environment. BitBake saves a copy of the original
1372environment into a special variable named :term:`BB_ORIGENV`. 1567environment into a special variable named :term:`BB_ORIGENV`.
1373 1568
1374The ``BB_ORIGENV`` variable returns a datastore object that can be 1569The :term:`BB_ORIGENV` variable returns a datastore object that can be
1375queried using the standard datastore operators such as 1570queried using the standard datastore operators such as
1376``getVar(, False)``. The datastore object is useful, for example, to 1571``getVar(, False)``. The datastore object is useful, for example, to
1377find the original ``DISPLAY`` variable. Here is an example: :: 1572find the original ``DISPLAY`` variable. Here is an example::
1378 1573
1379 origenv = d.getVar("BB_ORIGENV", False) 1574 origenv = d.getVar("BB_ORIGENV", False)
1380 bar = origenv.getVar("BAR", False) 1575 bar = origenv.getVar("BAR", False)
@@ -1387,7 +1582,7 @@ Variable Flags
1387 1582
1388Variable flags (varflags) help control a task's functionality and 1583Variable flags (varflags) help control a task's functionality and
1389dependencies. BitBake reads and writes varflags to the datastore using 1584dependencies. BitBake reads and writes varflags to the datastore using
1390the following command forms: :: 1585the following command forms::
1391 1586
1392 variable = d.getVarFlags("variable") 1587 variable = d.getVarFlags("variable")
1393 self.d.setVarFlags("FOO", {"func": True}) 1588 self.d.setVarFlags("FOO", {"func": True})
@@ -1418,12 +1613,35 @@ functionality of the task:
1418 directory listed is used as the current working directory for the 1613 directory listed is used as the current working directory for the
1419 task. 1614 task.
1420 1615
1616- ``[file-checksums]``: Controls the file dependencies for a task. The
1617 baseline file list is the set of files associated with
1618 :term:`SRC_URI`. May be used to set additional dependencies on
1619 files not associated with :term:`SRC_URI`.
1620
1621 The value set to the list is a file-boolean pair where the first
1622 value is the file name and the second is whether or not it
1623 physically exists on the filesystem. ::
1624
1625 do_configure[file-checksums] += "${MY_DIRPATH}/my-file.txt:True"
1626
1627 It is important to record any paths which the task looked at and
1628 which didn't exist. This means that if these do exist at a later
1629 time, the task can be rerun with the new additional files. The
1630 "exists" True or False value after the path allows this to be
1631 handled.
1632
1421- ``[lockfiles]``: Specifies one or more lockfiles to lock while the 1633- ``[lockfiles]``: Specifies one or more lockfiles to lock while the
1422 task executes. Only one task may hold a lockfile, and any task that 1634 task executes. Only one task may hold a lockfile, and any task that
1423 attempts to lock an already locked file will block until the lock is 1635 attempts to lock an already locked file will block until the lock is
1424 released. You can use this variable flag to accomplish mutual 1636 released. You can use this variable flag to accomplish mutual
1425 exclusion. 1637 exclusion.
1426 1638
1639- ``[network]``: When set to "1", allows a task to access the network. By
1640 default, only the ``do_fetch`` task is granted network access. Recipes
1641 shouldn't access the network outside of ``do_fetch`` as it usually
1642 undermines fetcher source mirroring, image and licence manifests, software
1643 auditing and supply chain security.
1644
1427- ``[noexec]``: When set to "1", marks the task as being empty, with 1645- ``[noexec]``: When set to "1", marks the task as being empty, with
1428 no execution required. You can use the ``[noexec]`` flag to set up 1646 no execution required. You can use the ``[noexec]`` flag to set up
1429 tasks as dependency placeholders, or to disable tasks defined 1647 tasks as dependency placeholders, or to disable tasks defined
@@ -1456,7 +1674,7 @@ functionality of the task:
1456 can result in unpredictable behavior. 1674 can result in unpredictable behavior.
1457 1675
1458 - Setting the varflag to a value greater than the value used in 1676 - Setting the varflag to a value greater than the value used in
1459 the ``BB_NUMBER_THREADS`` variable causes ``number_threads`` to 1677 the :term:`BB_NUMBER_THREADS` variable causes ``number_threads`` to
1460 have no effect. 1678 have no effect.
1461 1679
1462- ``[postfuncs]``: List of functions to call after the completion of 1680- ``[postfuncs]``: List of functions to call after the completion of
@@ -1526,7 +1744,7 @@ intent is to make it easy to do things like email notification on build
1526failures. 1744failures.
1527 1745
1528Following is an example event handler that prints the name of the event 1746Following is an example event handler that prints the name of the event
1529and the content of the ``FILE`` variable: :: 1747and the content of the :term:`FILE` variable::
1530 1748
1531 addhandler myclass_eventhandler 1749 addhandler myclass_eventhandler
1532 python myclass_eventhandler() { 1750 python myclass_eventhandler() {
@@ -1565,11 +1783,11 @@ might have an interest in viewing:
1565 1783
1566- ``bb.event.ConfigParsed()``: Fired when the base configuration; which 1784- ``bb.event.ConfigParsed()``: Fired when the base configuration; which
1567 consists of ``bitbake.conf``, ``base.bbclass`` and any global 1785 consists of ``bitbake.conf``, ``base.bbclass`` and any global
1568 ``INHERIT`` statements; has been parsed. You can see multiple such 1786 :term:`INHERIT` statements; has been parsed. You can see multiple such
1569 events when each of the workers parse the base configuration or if 1787 events when each of the workers parse the base configuration or if
1570 the server changes configuration and reparses. Any given datastore 1788 the server changes configuration and reparses. Any given datastore
1571 only has one such event executed against it, however. If 1789 only has one such event executed against it, however. If
1572 ```BB_INVALIDCONF`` <#>`__ is set in the datastore by the event 1790 :term:`BB_INVALIDCONF` is set in the datastore by the event
1573 handler, the configuration is reparsed and a new event triggered, 1791 handler, the configuration is reparsed and a new event triggered,
1574 allowing the metadata to update configuration. 1792 allowing the metadata to update configuration.
1575 1793
@@ -1636,13 +1854,18 @@ user interfaces:
1636 1854
1637.. _variants-class-extension-mechanism: 1855.. _variants-class-extension-mechanism:
1638 1856
1639Variants - Class Extension Mechanism 1857Variants --- Class Extension Mechanism
1640==================================== 1858======================================
1859
1860BitBake supports multiple incarnations of a recipe file via the
1861:term:`BBCLASSEXTEND` variable.
1862
1863The :term:`BBCLASSEXTEND` variable is a space separated list of classes used
1864to "extend" the recipe for each variant. Here is an example that results in a
1865second incarnation of the current recipe being available. This second
1866incarnation will have the "native" class inherited. ::
1641 1867
1642BitBake supports two features that facilitate creating from a single 1868 BBCLASSEXTEND = "native"
1643recipe file multiple incarnations of that recipe file where all
1644incarnations are buildable. These features are enabled through the
1645:term:`BBCLASSEXTEND` and :term:`BBVERSIONS` variables.
1646 1869
1647.. note:: 1870.. note::
1648 1871
@@ -1652,34 +1875,6 @@ incarnations are buildable. These features are enabled through the
1652 class. For specific examples, see the OE-Core native , nativesdk , and 1875 class. For specific examples, see the OE-Core native , nativesdk , and
1653 multilib classes. 1876 multilib classes.
1654 1877
1655- ``BBCLASSEXTEND``: This variable is a space separated list of
1656 classes used to "extend" the recipe for each variant. Here is an
1657 example that results in a second incarnation of the current recipe
1658 being available. This second incarnation will have the "native" class
1659 inherited. ::
1660
1661 BBCLASSEXTEND = "native"
1662
1663- ``BBVERSIONS``: This variable allows a single recipe to build
1664 multiple versions of a project from a single recipe file. You can
1665 also specify conditional metadata (using the
1666 :term:`OVERRIDES` mechanism) for a single
1667 version, or an optionally named range of versions. Here is an
1668 example: ::
1669
1670 BBVERSIONS = "1.0 2.0 git"
1671 SRC_URI_git = "git://someurl/somepath.git"
1672
1673 BBVERSIONS = "1.0.[0-6]:1.0.0+ 1.0.[7-9]:1.0.7+"
1674 SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;patch=1"
1675
1676 The name of the range defaults to the original version of the recipe. For
1677 example, in OpenEmbedded, the recipe file ``foo_1.0.0+.bb`` creates a default
1678 name range of ``1.0.0+``. This is useful because the range name is not only
1679 placed into overrides, but it is also made available for the metadata to use
1680 in the variable that defines the base recipe versions for use in ``file://``
1681 search paths (:term:`FILESPATH`).
1682
1683Dependencies 1878Dependencies
1684============ 1879============
1685 1880
@@ -1708,7 +1903,7 @@ Dependencies Internal to the ``.bb`` File
1708BitBake uses the ``addtask`` directive to manage dependencies that are 1903BitBake uses the ``addtask`` directive to manage dependencies that are
1709internal to a given recipe file. You can use the ``addtask`` directive 1904internal to a given recipe file. You can use the ``addtask`` directive
1710to indicate when a task is dependent on other tasks or when other tasks 1905to indicate when a task is dependent on other tasks or when other tasks
1711depend on that recipe. Here is an example: :: 1906depend on that recipe. Here is an example::
1712 1907
1713 addtask printdate after do_fetch before do_build 1908 addtask printdate after do_fetch before do_build
1714 1909
@@ -1732,7 +1927,7 @@ task depends on the completion of the ``do_printdate`` task.
1732 1927
1733 - The directive ``addtask mytask after do_configure`` by itself 1928 - The directive ``addtask mytask after do_configure`` by itself
1734 never causes ``do_mytask`` to run. ``do_mytask`` can still be run 1929 never causes ``do_mytask`` to run. ``do_mytask`` can still be run
1735 manually as follows: :: 1930 manually as follows::
1736 1931
1737 $ bitbake recipe -c mytask 1932 $ bitbake recipe -c mytask
1738 1933
@@ -1745,13 +1940,13 @@ Build Dependencies
1745 1940
1746BitBake uses the :term:`DEPENDS` variable to manage 1941BitBake uses the :term:`DEPENDS` variable to manage
1747build time dependencies. The ``[deptask]`` varflag for tasks signifies 1942build time dependencies. The ``[deptask]`` varflag for tasks signifies
1748the task of each item listed in ``DEPENDS`` that must complete before 1943the task of each item listed in :term:`DEPENDS` that must complete before
1749that task can be executed. Here is an example: :: 1944that task can be executed. Here is an example::
1750 1945
1751 do_configure[deptask] = "do_populate_sysroot" 1946 do_configure[deptask] = "do_populate_sysroot"
1752 1947
1753In this example, the ``do_populate_sysroot`` task 1948In this example, the ``do_populate_sysroot`` task
1754of each item in ``DEPENDS`` must complete before ``do_configure`` can 1949of each item in :term:`DEPENDS` must complete before ``do_configure`` can
1755execute. 1950execute.
1756 1951
1757Runtime Dependencies 1952Runtime Dependencies
@@ -1760,8 +1955,8 @@ Runtime Dependencies
1760BitBake uses the :term:`PACKAGES`, :term:`RDEPENDS`, and :term:`RRECOMMENDS` 1955BitBake uses the :term:`PACKAGES`, :term:`RDEPENDS`, and :term:`RRECOMMENDS`
1761variables to manage runtime dependencies. 1956variables to manage runtime dependencies.
1762 1957
1763The ``PACKAGES`` variable lists runtime packages. Each of those packages 1958The :term:`PACKAGES` variable lists runtime packages. Each of those packages
1764can have ``RDEPENDS`` and ``RRECOMMENDS`` runtime dependencies. The 1959can have :term:`RDEPENDS` and :term:`RRECOMMENDS` runtime dependencies. The
1765``[rdeptask]`` flag for tasks is used to signify the task of each item 1960``[rdeptask]`` flag for tasks is used to signify the task of each item
1766runtime dependency which must have completed before that task can be 1961runtime dependency which must have completed before that task can be
1767executed. :: 1962executed. ::
@@ -1769,9 +1964,9 @@ executed. ::
1769 do_package_qa[rdeptask] = "do_packagedata" 1964 do_package_qa[rdeptask] = "do_packagedata"
1770 1965
1771In the previous 1966In the previous
1772example, the ``do_packagedata`` task of each item in ``RDEPENDS`` must 1967example, the ``do_packagedata`` task of each item in :term:`RDEPENDS` must
1773have completed before ``do_package_qa`` can execute. 1968have completed before ``do_package_qa`` can execute.
1774Although ``RDEPENDS`` contains entries from the 1969Although :term:`RDEPENDS` contains entries from the
1775runtime dependency namespace, BitBake knows how to map them back 1970runtime dependency namespace, BitBake knows how to map them back
1776to the build-time dependency namespace, in which the tasks are defined. 1971to the build-time dependency namespace, in which the tasks are defined.
1777 1972
@@ -1788,7 +1983,7 @@ dependencies are discovered and added.
1788 1983
1789The ``[recrdeptask]`` flag is most commonly used in high-level recipes 1984The ``[recrdeptask]`` flag is most commonly used in high-level recipes
1790that need to wait for some task to finish "globally". For example, 1985that need to wait for some task to finish "globally". For example,
1791``image.bbclass`` has the following: :: 1986``image.bbclass`` has the following::
1792 1987
1793 do_rootfs[recrdeptask] += "do_packagedata" 1988 do_rootfs[recrdeptask] += "do_packagedata"
1794 1989
@@ -1797,7 +1992,7 @@ the current recipe and all recipes reachable (by way of dependencies)
1797from the image recipe must run before the ``do_rootfs`` task can run. 1992from the image recipe must run before the ``do_rootfs`` task can run.
1798 1993
1799BitBake allows a task to recursively depend on itself by 1994BitBake allows a task to recursively depend on itself by
1800referencing itself in the task list: :: 1995referencing itself in the task list::
1801 1996
1802 do_a[recrdeptask] = "do_a do_b" 1997 do_a[recrdeptask] = "do_a do_b"
1803 1998
@@ -1814,7 +2009,7 @@ Inter-Task Dependencies
1814BitBake uses the ``[depends]`` flag in a more generic form to manage 2009BitBake uses the ``[depends]`` flag in a more generic form to manage
1815inter-task dependencies. This more generic form allows for 2010inter-task dependencies. This more generic form allows for
1816inter-dependency checks for specific tasks rather than checks for the 2011inter-dependency checks for specific tasks rather than checks for the
1817data in ``DEPENDS``. Here is an example: :: 2012data in :term:`DEPENDS`. Here is an example::
1818 2013
1819 do_patch[depends] = "quilt-native:do_populate_sysroot" 2014 do_patch[depends] = "quilt-native:do_populate_sysroot"
1820 2015
@@ -1894,11 +2089,35 @@ access. Here is a list of available operations:
1894Other Functions 2089Other Functions
1895--------------- 2090---------------
1896 2091
1897You can find many other functions that can be called from Python by 2092Other functions are documented in the
1898looking at the source code of the ``bb`` module, which is in 2093:doc:`/bitbake-user-manual/bitbake-user-manual-library-functions` document.
1899``bitbake/lib/bb``. For example, ``bitbake/lib/bb/utils.py`` includes 2094
1900the commonly used functions ``bb.utils.contains()`` and 2095Extending Python Library Code
1901``bb.utils.mkdirhier()``, which come with docstrings. 2096-----------------------------
2097
2098If you wish to add your own Python library code (e.g. to provide
2099functions/classes you can use from Python functions in the metadata)
2100you can do so from any layer using the ``addpylib`` directive.
2101This directive is typically added to your layer configuration (
2102``conf/layer.conf``) although it will be handled in any ``.conf`` file.
2103
2104Usage is of the form::
2105
2106 addpylib <directory> <namespace>
2107
2108Where <directory> specifies the directory to add to the library path.
2109The specified <namespace> is imported automatically, and if the imported
2110module specifies an attribute named ``BBIMPORTS``, that list of
2111sub-modules is iterated and imported too.
2112
2113Testing and Debugging BitBake Python code
2114-----------------------------------------
2115
2116The OpenEmbedded build system implements a convenient ``pydevshell`` target which
2117you can use to access the BitBake datastore and experiment with your own Python
2118code. See :yocto_docs:`Using a Python Development Shell
2119</dev-manual/python-development-shell.html#using-a-python-development-shell>` in the Yocto
2120Project manual for details.
1902 2121
1903Task Checksums and Setscene 2122Task Checksums and Setscene
1904=========================== 2123===========================
@@ -1909,7 +2128,7 @@ To help understand how BitBake does this, the section assumes an
1909OpenEmbedded metadata-based example. 2128OpenEmbedded metadata-based example.
1910 2129
1911These checksums are stored in :term:`STAMP`. You can 2130These checksums are stored in :term:`STAMP`. You can
1912examine the checksums using the following BitBake command: :: 2131examine the checksums using the following BitBake command::
1913 2132
1914 $ bitbake-dumpsigs 2133 $ bitbake-dumpsigs
1915 2134
@@ -1932,16 +2151,6 @@ The following list describes related variables:
1932 Specifies a function BitBake calls that determines whether BitBake 2151 Specifies a function BitBake calls that determines whether BitBake
1933 requires a setscene dependency to be met. 2152 requires a setscene dependency to be met.
1934 2153
1935- :term:`BB_SETSCENE_VERIFY_FUNCTION2`:
1936 Specifies a function to call that verifies the list of planned task
1937 execution before the main task execution happens.
1938
1939- :term:`BB_STAMP_POLICY`: Defines the mode
1940 for comparing timestamps of stamp files.
1941
1942- :term:`BB_STAMP_WHITELIST`: Lists stamp
1943 files that are looked at when the stamp policy is "whitelist".
1944
1945- :term:`BB_TASKHASH`: Within an executing task, 2154- :term:`BB_TASKHASH`: Within an executing task,
1946 this variable holds the hash of the task as returned by the currently 2155 this variable holds the hash of the task as returned by the currently
1947 enabled signature generator. 2156 enabled signature generator.
@@ -1956,7 +2165,7 @@ Wildcard Support in Variables
1956============================= 2165=============================
1957 2166
1958Support for wildcard use in variables varies depending on the context in 2167Support for wildcard use in variables varies depending on the context in
1959which it is used. For example, some variables and file names allow 2168which it is used. For example, some variables and filenames allow
1960limited use of wildcards through the "``%``" and "``*``" characters. 2169limited use of wildcards through the "``%``" and "``*``" characters.
1961Other variables or names support Python's 2170Other variables or names support Python's
1962`glob <https://docs.python.org/3/library/glob.html>`_ syntax, 2171`glob <https://docs.python.org/3/library/glob.html>`_ syntax,
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables-context.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables-context.rst
new file mode 100644
index 0000000000..e9c454ba11
--- /dev/null
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables-context.rst
@@ -0,0 +1,91 @@
1.. SPDX-License-Identifier: CC-BY-2.5
2
3================
4Variable Context
5================
6
7|
8
9Variables might only have an impact or can be used in certain contexts. Some
10should only be used in global files like ``.conf``, while others are intended only
11for local files like ``.bb``. This chapter aims to describe some important variable
12contexts.
13
14.. _ref-varcontext-configuration:
15
16BitBake's own configuration
17===========================
18
19Variables starting with ``BB_`` usually configure the behaviour of BitBake itself.
20For example, one could configure:
21
22- System resources, like disk space to be used (:term:`BB_DISKMON_DIRS`),
23 or the number of tasks to be run in parallel by BitBake (:term:`BB_NUMBER_THREADS`).
24
25- How the fetchers shall behave, e.g., :term:`BB_FETCH_PREMIRRORONLY` is used
26 by BitBake to determine if BitBake's fetcher shall search only
27 :term:`PREMIRRORS` for files.
28
29Those variables are usually configured globally.
30
31BitBake configuration
32=====================
33
34There are variables:
35
36- Like :term:`B` or :term:`T`, that are used to specify directories used by
37 BitBake during the build of a particular recipe. Those variables are
38 specified in ``bitbake.conf``. Some, like :term:`B`, are quite often
39 overwritten in recipes.
40
41- Starting with ``FAKEROOT``, to configure how the ``fakeroot`` command is
42 handled. Those are usually set by ``bitbake.conf`` and might get adapted in a
43 ``bbclass``.
44
45- Detailing where BitBake will store and fetch information from, for
46 data reuse between build runs like :term:`CACHE`, :term:`DL_DIR` or
47 :term:`PERSISTENT_DIR`. Those are usually global.
48
49
50Layers and files
51================
52
53Variables starting with ``LAYER`` configure how BitBake handles layers.
54Additionally, variables starting with ``BB`` configure how layers and files are
55handled. For example:
56
57- :term:`LAYERDEPENDS` is used to configure on which layers a given layer
58 depends.
59
60- The configured layers are contained in :term:`BBLAYERS` and files in
61 :term:`BBFILES`.
62
63Those variables are often used in the files ``layer.conf`` and ``bblayers.conf``.
64
65Recipes and packages
66====================
67
68Variables handling recipes and packages can be split into:
69
70- :term:`PN`, :term:`PV` or :term:`PF` for example, contain information about
71 the name or revision of a recipe or package. Usually, the default set in
72 ``bitbake.conf`` is used, but those are from time to time overwritten in
73 recipes.
74
75- :term:`SUMMARY`, :term:`DESCRIPTION`, :term:`LICENSE` or :term:`HOMEPAGE`
76 contain the expected information and should be set specifically for every
77 recipe.
78
79- In recipes, variables are also used to control build and runtime
80 dependencies between recipes/packages with other recipes/packages. The
81 most common should be: :term:`PROVIDES`, :term:`RPROVIDES`, :term:`DEPENDS`,
82 and :term:`RDEPENDS`.
83
84- There are further variables starting with ``SRC`` that specify the sources in
85 a recipe like :term:`SRC_URI` or :term:`SRCDATE`. Those are also usually set
86 in recipes.
87
88- Which version or provider of a recipe should be given preference when
89 multiple recipes would provide the same item, is controlled by variables
90 starting with ``PREFERRED_``. Those are normally set in the configuration
91 files of a ``MACHINE`` or ``DISTRO``.
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
index 6469f9d1a4..6be8dbbf63 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
@@ -23,22 +23,31 @@ overview of their function and contents.
23 systems extend the functionality of the variable as it is 23 systems extend the functionality of the variable as it is
24 described here in this glossary. 24 described here in this glossary.
25 25
26 - Finally, there are variables mentioned in this glossary that do
27 not appear in the BitBake glossary. These other variables are
28 variables used in systems that use BitBake.
29
30.. glossary:: 26.. glossary::
27 :sorted:
31 28
32 :term:`ASSUME_PROVIDED` 29 :term:`ASSUME_PROVIDED`
33 Lists recipe names (:term:`PN` values) BitBake does not 30 Lists recipe names (:term:`PN` values) BitBake does not
34 attempt to build. Instead, BitBake assumes these recipes have already 31 attempt to build. Instead, BitBake assumes these recipes have already
35 been built. 32 been built.
36 33
37 In OpenEmbedded-Core, ``ASSUME_PROVIDED`` mostly specifies native 34 In OpenEmbedded-Core, :term:`ASSUME_PROVIDED` mostly specifies native
38 tools that should not be built. An example is ``git-native``, which 35 tools that should not be built. An example is ``git-native``, which
39 when specified allows for the Git binary from the host to be used 36 when specified allows for the Git binary from the host to be used
40 rather than building ``git-native``. 37 rather than building ``git-native``.
41 38
39 :term:`AZ_SAS`
40 Azure Storage Shared Access Signature, when using the
41 :ref:`Azure Storage fetcher <bitbake-user-manual/bitbake-user-manual-fetching:fetchers>`
42 This variable can be defined to be used by the fetcher to authenticate
43 and gain access to non-public artifacts::
44
45 AZ_SAS = ""se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>""
46
47 For more information see Microsoft's Azure Storage documentation at
48 https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview
49
50
42 :term:`B` 51 :term:`B`
43 The directory in which BitBake executes functions during a recipe's 52 The directory in which BitBake executes functions during a recipe's
44 build process. 53 build process.
@@ -74,14 +83,41 @@ overview of their function and contents.
74 83
75 - Attempts to access networks not in the host list cause a failure. 84 - Attempts to access networks not in the host list cause a failure.
76 85
77 Using ``BB_ALLOWED_NETWORKS`` in conjunction with 86 Using :term:`BB_ALLOWED_NETWORKS` in conjunction with
78 :term:`PREMIRRORS` is very useful. Adding the 87 :term:`PREMIRRORS` is very useful. Adding the
79 host you want to use to ``PREMIRRORS`` results in the source code 88 host you want to use to :term:`PREMIRRORS` results in the source code
80 being fetched from an allowed location and avoids raising an error 89 being fetched from an allowed location and avoids raising an error
81 when a host that is not allowed is in a 90 when a host that is not allowed is in a
82 :term:`SRC_URI` statement. This is because the 91 :term:`SRC_URI` statement. This is because the
83 fetcher does not attempt to use the host listed in ``SRC_URI`` after 92 fetcher does not attempt to use the host listed in :term:`SRC_URI` after
84 a successful fetch from the ``PREMIRRORS`` occurs. 93 a successful fetch from the :term:`PREMIRRORS` occurs.
94
95 :term:`BB_BASEHASH_IGNORE_VARS`
96 Lists variables that are excluded from checksum and dependency data.
97 Variables that are excluded can therefore change without affecting
98 the checksum mechanism. A common example would be the variable for
99 the path of the build. BitBake's output should not (and usually does
100 not) depend on the directory in which it was built.
101
102 :term:`BB_CACHEDIR`
103 Specifies the code parser cache directory (distinct from :term:`CACHE`
104 and :term:`PERSISTENT_DIR` although they can be set to the same value
105 if desired). The default value is "${TOPDIR}/cache".
106
107 :term:`BB_CHECK_SSL_CERTS`
108 Specifies if SSL certificates should be checked when fetching. The default
109 value is ``1`` and certificates are not checked if the value is set to ``0``.
110
111 :term:`BB_HASH_CODEPARSER_VALS`
112 Specifies values for variables to use when populating the codeparser cache.
113 This can be used selectively to set dummy values for variables to avoid
114 the codeparser cache growing on every parse. Variables that would typically
115 be included are those where the value is not significant for where the
116 codeparser cache is used (i.e. when calculating variable dependencies for
117 code fragments.) The value is space-separated without quoting values, for
118 example::
119
120 BB_HASH_CODEPARSER_VALS = "T=/ WORKDIR=/ DATE=1234 TIME=1234"
85 121
86 :term:`BB_CONSOLELOG` 122 :term:`BB_CONSOLELOG`
87 Specifies the path to a log file into which BitBake's user interface 123 Specifies the path to a log file into which BitBake's user interface
@@ -91,17 +127,10 @@ overview of their function and contents.
91 Contains the name of the currently running task. The name does not 127 Contains the name of the currently running task. The name does not
92 include the ``do_`` prefix. 128 include the ``do_`` prefix.
93 129
94 :term:`BB_DANGLINGAPPENDS_WARNONLY` 130 :term:`BB_CURRENT_MC`
95 Defines how BitBake handles situations where an append file 131 Contains the name of the current multiconfig a task is being run under.
96 (``.bbappend``) has no corresponding recipe file (``.bb``). This 132 The name is taken from the multiconfig configuration file (a file
97 condition often occurs when layers get out of sync (e.g. ``oe-core`` 133 ``mc1.conf`` would make this variable equal to ``mc1``).
98 bumps a recipe version and the old recipe no longer exists and the
99 other layer has not been updated to the new version of the recipe
100 yet).
101
102 The default fatal behavior is safest because it is the sane reaction
103 given something is out of sync. It is important to realize when your
104 changes are no longer being applied.
105 134
106 :term:`BB_DEFAULT_TASK` 135 :term:`BB_DEFAULT_TASK`
107 The default task to use when none is specified (e.g. with the ``-c`` 136 The default task to use when none is specified (e.g. with the ``-c``
@@ -117,14 +146,14 @@ overview of their function and contents.
117 you to control the build based on these parameters. 146 you to control the build based on these parameters.
118 147
119 Disk space monitoring is disabled by default. When setting this 148 Disk space monitoring is disabled by default. When setting this
120 variable, use the following form: :: 149 variable, use the following form::
121 150
122 BB_DISKMON_DIRS = "<action>,<dir>,<threshold> [...]" 151 BB_DISKMON_DIRS = "<action>,<dir>,<threshold> [...]"
123 152
124 where: 153 where:
125 154
126 <action> is: 155 <action> is:
127 ABORT: Immediately abort the build when 156 HALT: Immediately halt the build when
128 a threshold is broken. 157 a threshold is broken.
129 STOPTASKS: Stop the build after the currently 158 STOPTASKS: Stop the build after the currently
130 executing tasks have finished when 159 executing tasks have finished when
@@ -153,48 +182,48 @@ overview of their function and contents.
153 not specify G, M, or K, Kbytes is assumed by 182 not specify G, M, or K, Kbytes is assumed by
154 default. Do not use GB, MB, or KB. 183 default. Do not use GB, MB, or KB.
155 184
156 Here are some examples: :: 185 Here are some examples::
157 186
158 BB_DISKMON_DIRS = "ABORT,${TMPDIR},1G,100K WARN,${SSTATE_DIR},1G,100K" 187 BB_DISKMON_DIRS = "HALT,${TMPDIR},1G,100K WARN,${SSTATE_DIR},1G,100K"
159 BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},1G" 188 BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},1G"
160 BB_DISKMON_DIRS = "ABORT,${TMPDIR},,100K" 189 BB_DISKMON_DIRS = "HALT,${TMPDIR},,100K"
161 190
162 The first example works only if you also set the 191 The first example works only if you also set the
163 :term:`BB_DISKMON_WARNINTERVAL` 192 :term:`BB_DISKMON_WARNINTERVAL`
164 variable. This example causes the build system to immediately abort 193 variable. This example causes the build system to immediately halt
165 when either the disk space in ``${TMPDIR}`` drops below 1 Gbyte or 194 when either the disk space in ``${TMPDIR}`` drops below 1 Gbyte or
166 the available free inodes drops below 100 Kbytes. Because two 195 the available free inodes drops below 100 Kbytes. Because two
167 directories are provided with the variable, the build system also 196 directories are provided with the variable, the build system also
168 issues a warning when the disk space in the ``${SSTATE_DIR}`` 197 issues a warning when the disk space in the ``${SSTATE_DIR}``
169 directory drops below 1 Gbyte or the number of free inodes drops 198 directory drops below 1 Gbyte or the number of free inodes drops
170 below 100 Kbytes. Subsequent warnings are issued during intervals as 199 below 100 Kbytes. Subsequent warnings are issued during intervals as
171 defined by the ``BB_DISKMON_WARNINTERVAL`` variable. 200 defined by the :term:`BB_DISKMON_WARNINTERVAL` variable.
172 201
173 The second example stops the build after all currently executing 202 The second example stops the build after all currently executing
174 tasks complete when the minimum disk space in the ``${TMPDIR}`` 203 tasks complete when the minimum disk space in the ``${TMPDIR}``
175 directory drops below 1 Gbyte. No disk monitoring occurs for the free 204 directory drops below 1 Gbyte. No disk monitoring occurs for the free
176 inodes in this case. 205 inodes in this case.
177 206
178 The final example immediately aborts the build when the number of 207 The final example immediately halts the build when the number of
179 free inodes in the ``${TMPDIR}`` directory drops below 100 Kbytes. No 208 free inodes in the ``${TMPDIR}`` directory drops below 100 Kbytes. No
180 disk space monitoring for the directory itself occurs in this case. 209 disk space monitoring for the directory itself occurs in this case.
181 210
182 :term:`BB_DISKMON_WARNINTERVAL` 211 :term:`BB_DISKMON_WARNINTERVAL`
183 Defines the disk space and free inode warning intervals. 212 Defines the disk space and free inode warning intervals.
184 213
185 If you are going to use the ``BB_DISKMON_WARNINTERVAL`` variable, you 214 If you are going to use the :term:`BB_DISKMON_WARNINTERVAL` variable, you
186 must also use the :term:`BB_DISKMON_DIRS` 215 must also use the :term:`BB_DISKMON_DIRS`
187 variable and define its action as "WARN". During the build, 216 variable and define its action as "WARN". During the build,
188 subsequent warnings are issued each time disk space or number of free 217 subsequent warnings are issued each time disk space or number of free
189 inodes further reduces by the respective interval. 218 inodes further reduces by the respective interval.
190 219
191 If you do not provide a ``BB_DISKMON_WARNINTERVAL`` variable and you 220 If you do not provide a :term:`BB_DISKMON_WARNINTERVAL` variable and you
192 do use ``BB_DISKMON_DIRS`` with the "WARN" action, the disk 221 do use :term:`BB_DISKMON_DIRS` with the "WARN" action, the disk
193 monitoring interval defaults to the following: 222 monitoring interval defaults to the following:
194 BB_DISKMON_WARNINTERVAL = "50M,5K" 223 BB_DISKMON_WARNINTERVAL = "50M,5K"
195 224
196 When specifying the variable in your configuration file, use the 225 When specifying the variable in your configuration file, use the
197 following form: :: 226 following form::
198 227
199 BB_DISKMON_WARNINTERVAL = "<disk_space_interval>,<disk_inode_interval>" 228 BB_DISKMON_WARNINTERVAL = "<disk_space_interval>,<disk_inode_interval>"
200 229
@@ -210,7 +239,7 @@ overview of their function and contents.
210 G, M, or K for Gbytes, Mbytes, or Kbytes, 239 G, M, or K for Gbytes, Mbytes, or Kbytes,
211 respectively. You cannot use GB, MB, or KB. 240 respectively. You cannot use GB, MB, or KB.
212 241
213 Here is an example: :: 242 Here is an example::
214 243
215 BB_DISKMON_DIRS = "WARN,${SSTATE_DIR},1G,100K" 244 BB_DISKMON_DIRS = "WARN,${SSTATE_DIR},1G,100K"
216 BB_DISKMON_WARNINTERVAL = "50M,5K" 245 BB_DISKMON_WARNINTERVAL = "50M,5K"
@@ -222,23 +251,23 @@ overview of their function and contents.
222 based on the interval occur each time a respective interval is 251 based on the interval occur each time a respective interval is
223 reached beyond the initial warning (i.e. 1 Gbytes and 100 Kbytes). 252 reached beyond the initial warning (i.e. 1 Gbytes and 100 Kbytes).
224 253
225 :term:`BB_ENV_WHITELIST` 254 :term:`BB_ENV_PASSTHROUGH`
226 Specifies the internal whitelist of variables to allow through from 255 Specifies the internal list of variables to allow through from
227 the external environment into BitBake's datastore. If the value of 256 the external environment into BitBake's datastore. If the value of
228 this variable is not specified (which is the default), the following 257 this variable is not specified (which is the default), the following
229 list is used: :term:`BBPATH`, :term:`BB_PRESERVE_ENV`, 258 list is used: :term:`BBPATH`, :term:`BB_PRESERVE_ENV`,
230 :term:`BB_ENV_WHITELIST`, and :term:`BB_ENV_EXTRAWHITE`. 259 :term:`BB_ENV_PASSTHROUGH`, and :term:`BB_ENV_PASSTHROUGH_ADDITIONS`.
231 260
232 .. note:: 261 .. note::
233 262
234 You must set this variable in the external environment in order 263 You must set this variable in the external environment in order
235 for it to work. 264 for it to work.
236 265
237 :term:`BB_ENV_EXTRAWHITE` 266 :term:`BB_ENV_PASSTHROUGH_ADDITIONS`
238 Specifies an additional set of variables to allow through (whitelist) 267 Specifies an additional set of variables to allow through from the
239 from the external environment into BitBake's datastore. This list of 268 external environment into BitBake's datastore. This list of variables
240 variables are on top of the internal list set in 269 are on top of the internal list set in
241 :term:`BB_ENV_WHITELIST`. 270 :term:`BB_ENV_PASSTHROUGH`.
242 271
243 .. note:: 272 .. note::
244 273
@@ -254,76 +283,102 @@ overview of their function and contents.
254 :term:`BB_FILENAME` 283 :term:`BB_FILENAME`
255 Contains the filename of the recipe that owns the currently running 284 Contains the filename of the recipe that owns the currently running
256 task. For example, if the ``do_fetch`` task that resides in the 285 task. For example, if the ``do_fetch`` task that resides in the
257 ``my-recipe.bb`` is executing, the ``BB_FILENAME`` variable contains 286 ``my-recipe.bb`` is executing, the :term:`BB_FILENAME` variable contains
258 "/foo/path/my-recipe.bb". 287 "/foo/path/my-recipe.bb".
259 288
260 :term:`BBFILES_DYNAMIC` 289 :term:`BB_GENERATE_MIRROR_TARBALLS`
261 Activates content depending on presence of identified layers. You 290 Causes tarballs of the Git repositories, including the Git metadata,
262 identify the layers by the collections that the layers define. 291 to be placed in the :term:`DL_DIR` directory. Anyone
292 wishing to create a source mirror would want to enable this variable.
263 293
264 Use the ``BBFILES_DYNAMIC`` variable to avoid ``.bbappend`` files whose 294 For performance reasons, creating and placing tarballs of the Git
265 corresponding ``.bb`` file is in a layer that attempts to modify other 295 repositories is not the default action by BitBake. ::
266 layers through ``.bbappend`` but does not want to introduce a hard
267 dependency on those other layers.
268 296
269 Additionally you can prefix the rule with "!" to add ``.bbappend`` and 297 BB_GENERATE_MIRROR_TARBALLS = "1"
270 ``.bb`` files in case a layer is not present. Use this avoid hard
271 dependency on those other layers.
272 298
273 Use the following form for ``BBFILES_DYNAMIC``: :: 299 :term:`BB_GENERATE_SHALLOW_TARBALLS`
300 Setting this variable to "1" when :term:`BB_GIT_SHALLOW` is also set to
301 "1" causes bitbake to generate shallow mirror tarballs when fetching git
302 repositories. The number of commits included in the shallow mirror
303 tarballs is controlled by :term:`BB_GIT_SHALLOW_DEPTH`.
274 304
275 collection_name:filename_pattern 305 If both :term:`BB_GIT_SHALLOW` and :term:`BB_GENERATE_MIRROR_TARBALLS` are
306 enabled, bitbake will generate shallow mirror tarballs by default for git
307 repositories. This separate variable exists so that shallow tarball
308 generation can be enabled without needing to also enable normal mirror
309 generation if it is not desired.
276 310
277 The following example identifies two collection names and two filename 311 For example usage, see :term:`BB_GIT_SHALLOW`.
278 patterns: ::
279 312
280 BBFILES_DYNAMIC += "\ 313 :term:`BB_GIT_DEFAULT_DESTSUFFIX`
281 clang-layer:${LAYERDIR}/bbappends/meta-clang/*/*/*.bbappend \ 314 The default destination directory where the Git fetcher unpacks the
282 core:${LAYERDIR}/bbappends/openembedded-core/meta/*/*/*.bbappend \ 315 source code. If this variable is not set, the source code is unpacked in a
283 " 316 directory named "git".
284 317
285 When the collection name is prefixed with "!" it will add the file pattern in case 318 :term:`BB_GIT_SHALLOW`
286 the layer is absent: :: 319 Setting this variable to "1" enables the support for fetching, using and
320 generating mirror tarballs of `shallow git repositories <https://riptutorial.com/git/example/4584/shallow-clone>`_.
321 The external `git-make-shallow <https://git.openembedded.org/bitbake/tree/bin/git-make-shallow>`_
322 script is used for shallow mirror tarball creation.
287 323
288 BBFILES_DYNAMIC += "\ 324 When :term:`BB_GIT_SHALLOW` is enabled, bitbake will attempt to fetch a shallow
289 !clang-layer:${LAYERDIR}/backfill/meta-clang/*/*/*.bb \ 325 mirror tarball. If the shallow mirror tarball cannot be fetched, it will
290 " 326 try to fetch the full mirror tarball and use that.
291 327
292 This next example shows an error message that occurs because invalid 328 This setting causes an initial shallow clone instead of an initial full bare clone.
293 entries are found, which cause parsing to abort: :: 329 The amount of data transferred during the initial clone will be significantly reduced.
294 330
295 ERROR: BBFILES_DYNAMIC entries must be of the form {!}<collection name>:<filename pattern>, not: 331 However, every time the source revision (referenced in :term:`SRCREV`)
296 /work/my-layer/bbappends/meta-security-isafw/*/*/*.bbappend 332 changes, regardless of whether the cache within the download directory
297 /work/my-layer/bbappends/openembedded-core/meta/*/*/*.bbappend 333 (defined by :term:`DL_DIR`) has been cleaned up or not,
334 the data transfer may be significantly higher because entirely
335 new shallow clones are required for each source revision change.
298 336
299 :term:`BB_GENERATE_MIRROR_TARBALLS` 337 Over time, numerous shallow clones may cumulatively transfer
300 Causes tarballs of the Git repositories, including the Git metadata, 338 the same amount of data as an initial full bare clone.
301 to be placed in the :term:`DL_DIR` directory. Anyone 339 This is especially the case with very large repositories.
302 wishing to create a source mirror would want to enable this variable.
303 340
304 For performance reasons, creating and placing tarballs of the Git 341 Existing initial full bare clones, created without this setting,
305 repositories is not the default action by BitBake. :: 342 will still be utilized.
306 343
307 BB_GENERATE_MIRROR_TARBALLS = "1" 344 If the Git error "Server does not allow request for unadvertised object"
345 occurs, an initial full bare clone is fetched automatically.
346 This may happen if the Git server does not allow the request
347 or if the Git client has issues with this functionality.
308 348
309 :term:`BB_HASHCONFIG_WHITELIST` 349 See also :term:`BB_GIT_SHALLOW_DEPTH` and
310 Lists variables that are excluded from base configuration checksum, 350 :term:`BB_GENERATE_SHALLOW_TARBALLS`.
311 which is used to determine if the cache can be reused.
312 351
313 One of the ways BitBake determines whether to re-parse the main 352 Example usage::
314 metadata is through checksums of the variables in the datastore of
315 the base configuration data. There are variables that you typically
316 want to exclude when checking whether or not to re-parse and thus
317 rebuild the cache. As an example, you would usually exclude ``TIME``
318 and ``DATE`` because these variables are always changing. If you did
319 not exclude them, BitBake would never reuse the cache.
320 353
321 :term:`BB_HASHBASE_WHITELIST` 354 BB_GIT_SHALLOW ?= "1"
322 Lists variables that are excluded from checksum and dependency data. 355
323 Variables that are excluded can therefore change without affecting 356 # Keep only the top commit
324 the checksum mechanism. A common example would be the variable for 357 BB_GIT_SHALLOW_DEPTH ?= "1"
325 the path of the build. BitBake's output should not (and usually does 358
326 not) depend on the directory in which it was built. 359 # This defaults to enabled if both BB_GIT_SHALLOW and
360 # BB_GENERATE_MIRROR_TARBALLS are enabled
361 BB_GENERATE_SHALLOW_TARBALLS ?= "1"
362
363 :term:`BB_GIT_SHALLOW_DEPTH`
364 When used with :term:`BB_GENERATE_SHALLOW_TARBALLS`, this variable sets
365 the number of commits to include in generated shallow mirror tarballs.
366 With a depth of 1, only the commit referenced in :term:`SRCREV` is
367 included in the shallow mirror tarball. Increasing the depth includes
368 additional parent commits, working back through the commit history.
369
370 If this variable is unset, bitbake will default to a depth of 1 when
371 generating shallow mirror tarballs.
372
373 For example usage, see :term:`BB_GIT_SHALLOW`.
374
375 :term:`BB_GLOBAL_PYMODULES`
376 Specifies the list of Python modules to place in the global namespace.
377 It is intended that only the core layer should set this and it is meant
378 to be a very small list, typically just ``os`` and ``sys``.
379 :term:`BB_GLOBAL_PYMODULES` is expected to be set before the first
380 ``addpylib`` directive.
381 See also ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:extending python library code`".
327 382
328 :term:`BB_HASHCHECK_FUNCTION` 383 :term:`BB_HASHCHECK_FUNCTION`
329 Specifies the name of the function to call during the "setscene" part 384 Specifies the name of the function to call during the "setscene" part
@@ -339,12 +394,66 @@ overview of their function and contents.
339 However, the more accurate the data returned, the more efficient the 394 However, the more accurate the data returned, the more efficient the
340 build will be. 395 build will be.
341 396
397 :term:`BB_HASHCONFIG_IGNORE_VARS`
398 Lists variables that are excluded from base configuration checksum,
399 which is used to determine if the cache can be reused.
400
401 One of the ways BitBake determines whether to re-parse the main
402 metadata is through checksums of the variables in the datastore of
403 the base configuration data. There are variables that you typically
404 want to exclude when checking whether or not to re-parse and thus
405 rebuild the cache. As an example, you would usually exclude ``TIME``
406 and ``DATE`` because these variables are always changing. If you did
407 not exclude them, BitBake would never reuse the cache.
408
409 :term:`BB_HASHSERVE`
410 Specifies the Hash Equivalence server to use.
411
412 If set to ``auto``, BitBake automatically starts its own server
413 over a UNIX domain socket. An option is to connect this server
414 to an upstream one, by setting :term:`BB_HASHSERVE_UPSTREAM`.
415
416 If set to ``unix://path``, BitBake will connect to an existing
417 hash server available over a UNIX domain socket.
418
419 If set to ``host:port``, BitBake will connect to a remote server on the
420 specified host. This allows multiple clients to share the same
421 hash equivalence data.
422
423 The remote server can be started manually through
424 the ``bin/bitbake-hashserv`` script provided by BitBake,
425 which supports UNIX domain sockets too. This script also allows
426 to start the server in read-only mode, to avoid accepting
427 equivalences that correspond to Share State caches that are
428 only available on specific clients.
429
430 :term:`BB_HASHSERVE_UPSTREAM`
431 Specifies an upstream Hash Equivalence server.
432
433 This optional setting is only useful when a local Hash Equivalence
434 server is started (setting :term:`BB_HASHSERVE` to ``auto``),
435 and you wish the local server to query an upstream server for
436 Hash Equivalence data.
437
438 Example usage::
439
440 BB_HASHSERVE_UPSTREAM = "hashserv.yoctoproject.org:8686"
441
342 :term:`BB_INVALIDCONF` 442 :term:`BB_INVALIDCONF`
343 Used in combination with the ``ConfigParsed`` event to trigger 443 Used in combination with the ``ConfigParsed`` event to trigger
344 re-parsing the base metadata (i.e. all the recipes). The 444 re-parsing the base metadata (i.e. all the recipes). The
345 ``ConfigParsed`` event can set the variable to trigger the re-parse. 445 ``ConfigParsed`` event can set the variable to trigger the re-parse.
346 You must be careful to avoid recursive loops with this functionality. 446 You must be careful to avoid recursive loops with this functionality.
347 447
448 :term:`BB_LOADFACTOR_MAX`
449 Setting this to a value will cause BitBake to check the system load
450 average before executing new tasks. If the load average is above the
451 the number of CPUs multipled by this factor, no new task will be started
452 unless there is no task executing. A value of "1.5" has been found to
453 work reasonably. This is helpful for systems which don't have pressure
454 regulation enabled, which is more granular. Pressure values take
455 precedence over loadfactor.
456
348 :term:`BB_LOGCONFIG` 457 :term:`BB_LOGCONFIG`
349 Specifies the name of a config file that contains the user logging 458 Specifies the name of a config file that contains the user logging
350 configuration. See 459 configuration. See
@@ -353,15 +462,28 @@ overview of their function and contents.
353 462
354 :term:`BB_LOGFMT` 463 :term:`BB_LOGFMT`
355 Specifies the name of the log files saved into 464 Specifies the name of the log files saved into
356 ``${``\ :term:`T`\ ``}``. By default, the ``BB_LOGFMT`` 465 ``${``\ :term:`T`\ ``}``. By default, the :term:`BB_LOGFMT`
357 variable is undefined and the log file names get created using the 466 variable is undefined and the log filenames get created using the
358 following form: :: 467 following form::
359 468
360 log.{task}.{pid} 469 log.{task}.{pid}
361 470
362 If you want to force log files to take a specific name, you can set this 471 If you want to force log files to take a specific name, you can set this
363 variable in a configuration file. 472 variable in a configuration file.
364 473
474 :term:`BB_MULTI_PROVIDER_ALLOWED`
475 Allows you to suppress BitBake warnings caused when building two
476 separate recipes that provide the same output.
477
478 BitBake normally issues a warning when building two different recipes
479 where each provides the same output. This scenario is usually
480 something the user does not want. However, cases do exist where it
481 makes sense, particularly in the ``virtual/*`` namespace. You can use
482 this variable to suppress BitBake's warnings.
483
484 To use the variable, list provider names (e.g. recipe names,
485 ``virtual/kernel``, and so forth).
486
365 :term:`BB_NICE_LEVEL` 487 :term:`BB_NICE_LEVEL`
366 Allows BitBake to run at a specific priority (i.e. nice level). 488 Allows BitBake to run at a specific priority (i.e. nice level).
367 System permissions usually mean that BitBake can reduce its priority 489 System permissions usually mean that BitBake can reduce its priority
@@ -377,19 +499,20 @@ overview of their function and contents.
377 running builds when not connected to the Internet, and when operating 499 running builds when not connected to the Internet, and when operating
378 in certain kinds of firewall environments. 500 in certain kinds of firewall environments.
379 501
502 :term:`BB_NUMBER_PARSE_THREADS`
503 Sets the number of threads BitBake uses when parsing. By default, the
504 number of threads is equal to the number of cores on the system.
505
380 :term:`BB_NUMBER_THREADS` 506 :term:`BB_NUMBER_THREADS`
381 The maximum number of tasks BitBake should run in parallel at any one 507 The maximum number of tasks BitBake should run in parallel at any one
382 time. If your host development system supports multiple cores, a good 508 time. If your host development system supports multiple cores, a good
383 rule of thumb is to set this variable to twice the number of cores. 509 rule of thumb is to set this variable to twice the number of cores.
384 510
385 :term:`BB_NUMBER_PARSE_THREADS`
386 Sets the number of threads BitBake uses when parsing. By default, the
387 number of threads is equal to the number of cores on the system.
388
389 :term:`BB_ORIGENV` 511 :term:`BB_ORIGENV`
390 Contains a copy of the original external environment in which BitBake 512 Contains a copy of the original external environment in which BitBake
391 was run. The copy is taken before any whitelisted variable values are 513 was run. The copy is taken before any variable values configured to
392 filtered into BitBake's datastore. 514 pass through from the external environment are filtered into BitBake's
515 datastore.
393 516
394 .. note:: 517 .. note::
395 518
@@ -397,21 +520,130 @@ overview of their function and contents.
397 queried using the normal datastore operations. 520 queried using the normal datastore operations.
398 521
399 :term:`BB_PRESERVE_ENV` 522 :term:`BB_PRESERVE_ENV`
400 Disables whitelisting and instead allows all variables through from 523 Disables environment filtering and instead allows all variables through
401 the external environment into BitBake's datastore. 524 from the external environment into BitBake's datastore.
402 525
403 .. note:: 526 .. note::
404 527
405 You must set this variable in the external environment in order 528 You must set this variable in the external environment in order
406 for it to work. 529 for it to work.
407 530
531 :term:`BB_PRESSURE_MAX_CPU`
532 Specifies a maximum CPU pressure threshold, above which BitBake's
533 scheduler will not start new tasks (providing there is at least
534 one active task). If no value is set, CPU pressure is not
535 monitored when starting tasks.
536
537 The pressure data is calculated based upon what Linux kernels since
538 version 4.20 expose under ``/proc/pressure``. The threshold represents
539 the difference in "total" pressure from the previous second. The
540 minimum value is 1.0 (extremely slow builds) and the maximum is
541 1000000 (a pressure value unlikely to ever be reached). See
542 https://docs.kernel.org/accounting/psi.html for more information.
543
544 A default value to limit the CPU pressure to be set in ``conf/local.conf``
545 could be::
546
547 BB_PRESSURE_MAX_CPU = "15000"
548
549 Multiple values should be tested on the build host to determine what suits
550 best, depending on the need for performances versus load average during
551 the build.
552
553 .. note::
554
555 You may see numerous messages printed by BitBake in the case the
556 :term:`BB_PRESSURE_MAX_CPU` is too low:
557
558 Pressure status changed to CPU: True, IO: False, Mem: False (CPU: 1105.9/2.0, IO: 0.0/2.0, Mem: 0.0/2.0) - using 1/64 bitbake threads
559
560 This means that the :term:`BB_PRESSURE_MAX_CPU` should be increased to
561 a reasonable value for limiting the CPU pressure on the system.
562 Monitor the varying value after ``IO:`` above to set a sensible value.
563
564 :term:`BB_PRESSURE_MAX_IO`
565 Specifies a maximum I/O pressure threshold, above which BitBake's
566 scheduler will not start new tasks (providing there is at least
567 one active task). If no value is set, I/O pressure is not
568 monitored when starting tasks.
569
570 The pressure data is calculated based upon what Linux kernels since
571 version 4.20 expose under ``/proc/pressure``. The threshold represents
572 the difference in "total" pressure from the previous second. The
573 minimum value is 1.0 (extremely slow builds) and the maximum is
574 1000000 (a pressure value unlikely to ever be reached). See
575 https://docs.kernel.org/accounting/psi.html for more information.
576
577 At this point in time, experiments show that IO pressure tends to
578 be short-lived and regulating just the CPU with
579 :term:`BB_PRESSURE_MAX_CPU` can help to reduce it.
580
581 A default value to limit the IO pressure to be set in ``conf/local.conf``
582 could be::
583
584 BB_PRESSURE_MAX_IO = "15000"
585
586 Multiple values should be tested on the build host to determine what suits
587 best, depending on the need for performances versus I/O usage during the
588 build.
589
590 .. note::
591
592 You may see numerous messages printed by BitBake in the case the
593 :term:`BB_PRESSURE_MAX_IO` is too low::
594
595 Pressure status changed to CPU: None, IO: True, Mem: False (CPU: 2236.0/None, IO: 153.6/2.0, Mem: 0.0/2.0) - using 19/64 bitbake threads
596
597 This means that the :term:`BB_PRESSURE_MAX_IO` should be increased to
598 a reasonable value for limiting the I/O pressure on the system.
599 Monitor the varying value after ``IO:`` above to set a sensible value.
600
601 :term:`BB_PRESSURE_MAX_MEMORY`
602 Specifies a maximum memory pressure threshold, above which BitBake's
603 scheduler will not start new tasks (providing there is at least
604 one active task). If no value is set, memory pressure is not
605 monitored when starting tasks.
606
607 The pressure data is calculated based upon what Linux kernels since
608 version 4.20 expose under ``/proc/pressure``. The threshold represents
609 the difference in "total" pressure from the previous second. The
610 minimum value is 1.0 (extremely slow builds) and the maximum is
611 1000000 (a pressure value unlikely to ever be reached). See
612 https://docs.kernel.org/accounting/psi.html for more information.
613
614 Memory pressure is experienced when time is spent swapping,
615 refaulting pages from the page cache or performing direct reclaim.
616 This is why memory pressure is rarely seen, but setting this variable
617 might be useful as a last resort to prevent OOM errors if they are
618 occurring during builds.
619
620 A default value to limit the memory pressure to be set in
621 ``conf/local.conf`` could be::
622
623 BB_PRESSURE_MAX_MEMORY = "15000"
624
625 Multiple values should be tested on the build host to determine what suits
626 best, depending on the need for performances versus memory consumption
627 during the build.
628
629 .. note::
630
631 You may see numerous messages printed by BitBake in the case the
632 :term:`BB_PRESSURE_MAX_MEMORY` is too low::
633
634 Pressure status changed to CPU: None, IO: False, Mem: True (CPU: 29.5/None, IO: 0.0/2.0, Mem: 2553.3/2.0) - using 17/64 bitbake threads
635
636 This means that the :term:`BB_PRESSURE_MAX_MEMORY` should be increased to
637 a reasonable value for limiting the memory pressure on the system.
638 Monitor the varying value after ``Mem:`` above to set a sensible value.
639
408 :term:`BB_RUNFMT` 640 :term:`BB_RUNFMT`
409 Specifies the name of the executable script files (i.e. run files) 641 Specifies the name of the executable script files (i.e. run files)
410 saved into ``${``\ :term:`T`\ ``}``. By default, the 642 saved into ``${``\ :term:`T`\ ``}``. By default, the
411 ``BB_RUNFMT`` variable is undefined and the run file names get 643 :term:`BB_RUNFMT` variable is undefined and the run filenames get
412 created using the following form: :: 644 created using the following form::
413 645
414 run.{task}.{pid} 646 run.{func}.{pid}
415 647
416 If you want to force run files to take a specific name, you can set this 648 If you want to force run files to take a specific name, you can set this
417 variable in a configuration file. 649 variable in a configuration file.
@@ -425,14 +657,14 @@ overview of their function and contents.
425 Selects the name of the scheduler to use for the scheduling of 657 Selects the name of the scheduler to use for the scheduling of
426 BitBake tasks. Three options exist: 658 BitBake tasks. Three options exist:
427 659
428 - *basic* - The basic framework from which everything derives. Using 660 - *basic* --- the basic framework from which everything derives. Using
429 this option causes tasks to be ordered numerically as they are 661 this option causes tasks to be ordered numerically as they are
430 parsed. 662 parsed.
431 663
432 - *speed* - Executes tasks first that have more tasks depending on 664 - *speed* --- executes tasks first that have more tasks depending on
433 them. The "speed" option is the default. 665 them. The "speed" option is the default.
434 666
435 - *completion* - Causes the scheduler to try to complete a given 667 - *completion* --- causes the scheduler to try to complete a given
436 recipe once its build has started. 668 recipe once its build has started.
437 669
438 :term:`BB_SCHEDULERS` 670 :term:`BB_SCHEDULERS`
@@ -452,17 +684,6 @@ overview of their function and contents.
452 The function specified by this variable returns a "True" or "False" 684 The function specified by this variable returns a "True" or "False"
453 depending on whether the dependency needs to be met. 685 depending on whether the dependency needs to be met.
454 686
455 :term:`BB_SETSCENE_VERIFY_FUNCTION2`
456 Specifies a function to call that verifies the list of planned task
457 execution before the main task execution happens. The function is
458 called once BitBake has a list of setscene tasks that have run and
459 either succeeded or failed.
460
461 The function allows for a task list check to see if they make sense.
462 Even if BitBake was planning to skip a task, the returned value of
463 the function can force BitBake to run the task, which is necessary
464 under certain metadata defined circumstances.
465
466 :term:`BB_SIGNATURE_EXCLUDE_FLAGS` 687 :term:`BB_SIGNATURE_EXCLUDE_FLAGS`
467 Lists variable flags (varflags) that can be safely excluded from 688 Lists variable flags (varflags) that can be safely excluded from
468 checksum and dependency data for keys in the datastore. When 689 checksum and dependency data for keys in the datastore. When
@@ -485,40 +706,17 @@ overview of their function and contents.
485 :term:`BB_SRCREV_POLICY` 706 :term:`BB_SRCREV_POLICY`
486 Defines the behavior of the fetcher when it interacts with source 707 Defines the behavior of the fetcher when it interacts with source
487 control systems and dynamic source revisions. The 708 control systems and dynamic source revisions. The
488 ``BB_SRCREV_POLICY`` variable is useful when working without a 709 :term:`BB_SRCREV_POLICY` variable is useful when working without a
489 network. 710 network.
490 711
491 The variable can be set using one of two policies: 712 The variable can be set using one of two policies:
492 713
493 - *cache* - Retains the value the system obtained previously rather 714 - *cache* --- retains the value the system obtained previously rather
494 than querying the source control system each time. 715 than querying the source control system each time.
495 716
496 - *clear* - Queries the source controls system every time. With this 717 - *clear* --- queries the source controls system every time. With this
497 policy, there is no cache. The "clear" policy is the default. 718 policy, there is no cache. The "clear" policy is the default.
498 719
499 :term:`BB_STAMP_POLICY`
500 Defines the mode used for how timestamps of stamp files are compared.
501 You can set the variable to one of the following modes:
502
503 - *perfile* - Timestamp comparisons are only made between timestamps
504 of a specific recipe. This is the default mode.
505
506 - *full* - Timestamp comparisons are made for all dependencies.
507
508 - *whitelist* - Identical to "full" mode except timestamp
509 comparisons are made for recipes listed in the
510 :term:`BB_STAMP_WHITELIST` variable.
511
512 .. note::
513
514 Stamp policies are largely obsolete with the introduction of
515 setscene tasks.
516
517 :term:`BB_STAMP_WHITELIST`
518 Lists files whose stamp file timestamps are compared when the stamp
519 policy mode is set to "whitelist". For information on stamp policies,
520 see the :term:`BB_STAMP_POLICY` variable.
521
522 :term:`BB_STRICT_CHECKSUM` 720 :term:`BB_STRICT_CHECKSUM`
523 Sets a more strict checksum mechanism for non-local URLs. Setting 721 Sets a more strict checksum mechanism for non-local URLs. Setting
524 this variable to a value causes BitBake to report an error if it 722 this variable to a value causes BitBake to report an error if it
@@ -529,7 +727,7 @@ overview of their function and contents.
529 Allows adjustment of a task's Input/Output priority. During 727 Allows adjustment of a task's Input/Output priority. During
530 Autobuilder testing, random failures can occur for tasks due to I/O 728 Autobuilder testing, random failures can occur for tasks due to I/O
531 starvation. These failures occur during various QEMU runtime 729 starvation. These failures occur during various QEMU runtime
532 timeouts. You can use the ``BB_TASK_IONICE_LEVEL`` variable to adjust 730 timeouts. You can use the :term:`BB_TASK_IONICE_LEVEL` variable to adjust
533 the I/O priority of these tasks. 731 the I/O priority of these tasks.
534 732
535 .. note:: 733 .. note::
@@ -537,7 +735,7 @@ overview of their function and contents.
537 This variable works similarly to the :term:`BB_TASK_NICE_LEVEL` 735 This variable works similarly to the :term:`BB_TASK_NICE_LEVEL`
538 variable except with a task's I/O priorities. 736 variable except with a task's I/O priorities.
539 737
540 Set the variable as follows: :: 738 Set the variable as follows::
541 739
542 BB_TASK_IONICE_LEVEL = "class.prio" 740 BB_TASK_IONICE_LEVEL = "class.prio"
543 741
@@ -555,7 +753,7 @@ overview of their function and contents.
555 In order for your I/O priority settings to take effect, you need the 753 In order for your I/O priority settings to take effect, you need the
556 Completely Fair Queuing (CFQ) Scheduler selected for the backing block 754 Completely Fair Queuing (CFQ) Scheduler selected for the backing block
557 device. To select the scheduler, use the following command form where 755 device. To select the scheduler, use the following command form where
558 device is the device (e.g. sda, sdb, and so forth): :: 756 device is the device (e.g. sda, sdb, and so forth)::
559 757
560 $ sudo sh -c "echo cfq > /sys/block/device/queu/scheduler" 758 $ sudo sh -c "echo cfq > /sys/block/device/queu/scheduler"
561 759
@@ -564,7 +762,7 @@ overview of their function and contents.
564 762
565 You can use this variable in combination with task overrides to raise 763 You can use this variable in combination with task overrides to raise
566 or lower priorities of specific tasks. For example, on the `Yocto 764 or lower priorities of specific tasks. For example, on the `Yocto
567 Project <http://www.yoctoproject.org>`__ autobuilder, QEMU emulation 765 Project <https://www.yoctoproject.org>`__ autobuilder, QEMU emulation
568 in images is given a higher priority as compared to build tasks to 766 in images is given a higher priority as compared to build tasks to
569 ensure that images do not suffer timeouts on loaded systems. 767 ensure that images do not suffer timeouts on loaded systems.
570 768
@@ -572,6 +770,12 @@ overview of their function and contents.
572 Within an executing task, this variable holds the hash of the task as 770 Within an executing task, this variable holds the hash of the task as
573 returned by the currently enabled signature generator. 771 returned by the currently enabled signature generator.
574 772
773 :term:`BB_USE_HOME_NPMRC`
774 Controls whether or not BitBake uses the user's .npmrc file within their
775 home directory within the npm fetcher. This can be used for authentication
776 of private NPM registries, among other uses. This is turned off by default
777 and requires the user to explicitly set it to "1" to enable.
778
575 :term:`BB_VERBOSE_LOGS` 779 :term:`BB_VERBOSE_LOGS`
576 Controls how verbose BitBake is during builds. If set, shell scripts 780 Controls how verbose BitBake is during builds. If set, shell scripts
577 echo commands and shell script output appears on standard out 781 echo commands and shell script output appears on standard out
@@ -596,20 +800,20 @@ overview of their function and contents.
596 To build a different variant of the recipe with a minimal amount of 800 To build a different variant of the recipe with a minimal amount of
597 code, it usually is as simple as adding the variable to your recipe. 801 code, it usually is as simple as adding the variable to your recipe.
598 Here are two examples. The "native" variants are from the 802 Here are two examples. The "native" variants are from the
599 OpenEmbedded-Core metadata: :: 803 OpenEmbedded-Core metadata::
600 804
601 BBCLASSEXTEND =+ "native nativesdk" 805 BBCLASSEXTEND =+ "native nativesdk"
602 BBCLASSEXTEND =+ "multilib:multilib_name" 806 BBCLASSEXTEND =+ "multilib:multilib_name"
603 807
604 .. note:: 808 .. note::
605 809
606 Internally, the ``BBCLASSEXTEND`` mechanism generates recipe 810 Internally, the :term:`BBCLASSEXTEND` mechanism generates recipe
607 variants by rewriting variable values and applying overrides such 811 variants by rewriting variable values and applying overrides such
608 as ``_class-native``. For example, to generate a native version of 812 as ``_class-native``. For example, to generate a native version of
609 a recipe, a :term:`DEPENDS` on "foo" is 813 a recipe, a :term:`DEPENDS` on "foo" is
610 rewritten to a ``DEPENDS`` on "foo-native". 814 rewritten to a :term:`DEPENDS` on "foo-native".
611 815
612 Even when using ``BBCLASSEXTEND``, the recipe is only parsed once. 816 Even when using :term:`BBCLASSEXTEND`, the recipe is only parsed once.
613 Parsing once adds some limitations. For example, it is not 817 Parsing once adds some limitations. For example, it is not
614 possible to include a different file depending on the variant, 818 possible to include a different file depending on the variant,
615 since ``include`` statements are processed when the recipe is 819 since ``include`` statements are processed when the recipe is
@@ -639,21 +843,25 @@ overview of their function and contents.
639 :term:`BBFILE_PRIORITY` 843 :term:`BBFILE_PRIORITY`
640 Assigns the priority for recipe files in each layer. 844 Assigns the priority for recipe files in each layer.
641 845
846 This variable is used in the ``conf/layer.conf`` file and must be
847 suffixed with a `_` followed by the name of the specific layer (e.g.
848 ``BBFILE_PRIORITY_emenlow``). Colon as separator is not supported.
849
642 This variable is useful in situations where the same recipe appears 850 This variable is useful in situations where the same recipe appears
643 in more than one layer. Setting this variable allows you to 851 in more than one layer. Setting this variable allows you to
644 prioritize a layer against other layers that contain the same recipe 852 prioritize a layer against other layers that contain the same recipe
645 - effectively letting you control the precedence for the multiple 853 --- effectively letting you control the precedence for the multiple
646 layers. The precedence established through this variable stands 854 layers. The precedence established through this variable stands
647 regardless of a recipe's version (:term:`PV` variable). 855 regardless of a recipe's version (:term:`PV` variable).
648 For example, a layer that has a recipe with a higher ``PV`` value but 856 For example, a layer that has a recipe with a higher :term:`PV` value but
649 for which the ``BBFILE_PRIORITY`` is set to have a lower precedence 857 for which the :term:`BBFILE_PRIORITY` is set to have a lower precedence
650 still has a lower precedence. 858 still has a lower precedence.
651 859
652 A larger value for the ``BBFILE_PRIORITY`` variable results in a 860 A larger value for the :term:`BBFILE_PRIORITY` variable results in a
653 higher precedence. For example, the value 6 has a higher precedence 861 higher precedence. For example, the value 6 has a higher precedence
654 than the value 5. If not specified, the ``BBFILE_PRIORITY`` variable 862 than the value 5. If not specified, the :term:`BBFILE_PRIORITY` variable
655 is set based on layer dependencies (see the ``LAYERDEPENDS`` variable 863 is set based on layer dependencies (see the :term:`LAYERDEPENDS` variable
656 for more information. The default priority, if unspecified for a 864 for more information). The default priority, if unspecified for a
657 layer with no dependencies, is the lowest defined priority + 1 (or 1 865 layer with no dependencies, is the lowest defined priority + 1 (or 1
658 if no priorities are defined). 866 if no priorities are defined).
659 867
@@ -671,6 +879,45 @@ overview of their function and contents.
671 For details on the syntax, see the documentation by following the 879 For details on the syntax, see the documentation by following the
672 previous link. 880 previous link.
673 881
882 :term:`BBFILES_DYNAMIC`
883 Activates content depending on presence of identified layers. You
884 identify the layers by the collections that the layers define.
885
886 Use the :term:`BBFILES_DYNAMIC` variable to avoid ``.bbappend`` files whose
887 corresponding ``.bb`` file is in a layer that attempts to modify other
888 layers through ``.bbappend`` but does not want to introduce a hard
889 dependency on those other layers.
890
891 Additionally you can prefix the rule with "!" to add ``.bbappend`` and
892 ``.bb`` files in case a layer is not present. Use this avoid hard
893 dependency on those other layers.
894
895 Use the following form for :term:`BBFILES_DYNAMIC`::
896
897 collection_name:filename_pattern
898
899 The following example identifies two collection names and two filename
900 patterns::
901
902 BBFILES_DYNAMIC += "\
903 clang-layer:${LAYERDIR}/bbappends/meta-clang/*/*/*.bbappend \
904 core:${LAYERDIR}/bbappends/openembedded-core/meta/*/*/*.bbappend \
905 "
906
907 When the collection name is prefixed with "!" it will add the file pattern in case
908 the layer is absent::
909
910 BBFILES_DYNAMIC += "\
911 !clang-layer:${LAYERDIR}/backfill/meta-clang/*/*/*.bb \
912 "
913
914 This next example shows an error message that occurs because invalid
915 entries are found, which cause parsing to fail::
916
917 ERROR: BBFILES_DYNAMIC entries must be of the form {!}<collection name>:<filename pattern>, not:
918 /work/my-layer/bbappends/meta-security-isafw/*/*/*.bbappend
919 /work/my-layer/bbappends/openembedded-core/meta/*/*/*.bbappend
920
674 :term:`BBINCLUDED` 921 :term:`BBINCLUDED`
675 Contains a space-separated list of all of all files that BitBake's 922 Contains a space-separated list of all of all files that BitBake's
676 parser included during parsing of the current file. 923 parser included during parsing of the current file.
@@ -682,13 +929,13 @@ overview of their function and contents.
682 :term:`BBINCLUDELOGS_LINES` 929 :term:`BBINCLUDELOGS_LINES`
683 If :term:`BBINCLUDELOGS` is set, specifies 930 If :term:`BBINCLUDELOGS` is set, specifies
684 the maximum number of lines from the task log file to print when 931 the maximum number of lines from the task log file to print when
685 reporting a failed task. If you do not set ``BBINCLUDELOGS_LINES``, 932 reporting a failed task. If you do not set :term:`BBINCLUDELOGS_LINES`,
686 the entire log is printed. 933 the entire log is printed.
687 934
688 :term:`BBLAYERS` 935 :term:`BBLAYERS`
689 Lists the layers to enable during the build. This variable is defined 936 Lists the layers to enable during the build. This variable is defined
690 in the ``bblayers.conf`` configuration file in the build directory. 937 in the ``bblayers.conf`` configuration file in the build directory.
691 Here is an example: :: 938 Here is an example::
692 939
693 BBLAYERS = " \ 940 BBLAYERS = " \
694 /home/scottrif/poky/meta \ 941 /home/scottrif/poky/meta \
@@ -708,7 +955,7 @@ overview of their function and contents.
708 :term:`BBMASK` 955 :term:`BBMASK`
709 Prevents BitBake from processing recipes and recipe append files. 956 Prevents BitBake from processing recipes and recipe append files.
710 957
711 You can use the ``BBMASK`` variable to "hide" these ``.bb`` and 958 You can use the :term:`BBMASK` variable to "hide" these ``.bb`` and
712 ``.bbappend`` files. BitBake ignores any recipe or recipe append 959 ``.bbappend`` files. BitBake ignores any recipe or recipe append
713 files that match any of the expressions. It is as if BitBake does not 960 files that match any of the expressions. It is as if BitBake does not
714 see them at all. Consequently, matching files are not parsed or 961 see them at all. Consequently, matching files are not parsed or
@@ -722,13 +969,13 @@ overview of their function and contents.
722 969
723 The following example uses a complete regular expression to tell 970 The following example uses a complete regular expression to tell
724 BitBake to ignore all recipe and recipe append files in the 971 BitBake to ignore all recipe and recipe append files in the
725 ``meta-ti/recipes-misc/`` directory: :: 972 ``meta-ti/recipes-misc/`` directory::
726 973
727 BBMASK = "meta-ti/recipes-misc/" 974 BBMASK = "meta-ti/recipes-misc/"
728 975
729 If you want to mask out multiple directories or recipes, you can 976 If you want to mask out multiple directories or recipes, you can
730 specify multiple regular expression fragments. This next example 977 specify multiple regular expression fragments. This next example
731 masks out multiple directories and individual recipes: :: 978 masks out multiple directories and individual recipes::
732 979
733 BBMASK += "/meta-ti/recipes-misc/ meta-ti/recipes-ti/packagegroup/" 980 BBMASK += "/meta-ti/recipes-misc/ meta-ti/recipes-ti/packagegroup/"
734 BBMASK += "/meta-oe/recipes-support/" 981 BBMASK += "/meta-oe/recipes-support/"
@@ -745,11 +992,11 @@ overview of their function and contents.
745 Enables BitBake to perform multiple configuration builds and lists 992 Enables BitBake to perform multiple configuration builds and lists
746 each separate configuration (multiconfig). You can use this variable 993 each separate configuration (multiconfig). You can use this variable
747 to cause BitBake to build multiple targets where each target has a 994 to cause BitBake to build multiple targets where each target has a
748 separate configuration. Define ``BBMULTICONFIG`` in your 995 separate configuration. Define :term:`BBMULTICONFIG` in your
749 ``conf/local.conf`` configuration file. 996 ``conf/local.conf`` configuration file.
750 997
751 As an example, the following line specifies three multiconfigs, each 998 As an example, the following line specifies three multiconfigs, each
752 having a separate configuration file: :: 999 having a separate configuration file::
753 1000
754 BBMULTIFONFIG = "configA configB configC" 1001 BBMULTIFONFIG = "configA configB configC"
755 1002
@@ -757,20 +1004,20 @@ overview of their function and contents.
757 build directory within a directory named ``conf/multiconfig`` (e.g. 1004 build directory within a directory named ``conf/multiconfig`` (e.g.
758 build_directory\ ``/conf/multiconfig/configA.conf``). 1005 build_directory\ ``/conf/multiconfig/configA.conf``).
759 1006
760 For information on how to use ``BBMULTICONFIG`` in an environment 1007 For information on how to use :term:`BBMULTICONFIG` in an environment
761 that supports building targets with multiple configurations, see the 1008 that supports building targets with multiple configurations, see the
762 ":ref:`bitbake-user-manual/bitbake-user-manual-intro:executing a multiple configuration build`" 1009 ":ref:`bitbake-user-manual/bitbake-user-manual-intro:executing a multiple configuration build`"
763 section. 1010 section.
764 1011
765 :term:`BBPATH` 1012 :term:`BBPATH`
766 Used by BitBake to locate class (``.bbclass``) and configuration 1013 A colon-separated list used by BitBake to locate class (``.bbclass``)
767 (``.conf``) files. This variable is analogous to the ``PATH`` 1014 and configuration (``.conf``) files. This variable is analogous to the
768 variable. 1015 ``PATH`` variable.
769 1016
770 If you run BitBake from a directory outside of the build directory, 1017 If you run BitBake from a directory outside of the build directory,
771 you must be sure to set ``BBPATH`` to point to the build directory. 1018 you must be sure to set :term:`BBPATH` to point to the build directory.
772 Set the variable as you would any environment variable and then run 1019 Set the variable as you would any environment variable and then run
773 BitBake: :: 1020 BitBake::
774 1021
775 $ BBPATH="build_directory" 1022 $ BBPATH="build_directory"
776 $ export BBPATH 1023 $ export BBPATH
@@ -784,16 +1031,6 @@ overview of their function and contents.
784 Allows you to use a configuration file to add to the list of 1031 Allows you to use a configuration file to add to the list of
785 command-line target recipes you want to build. 1032 command-line target recipes you want to build.
786 1033
787 :term:`BBVERSIONS`
788 Allows a single recipe to build multiple versions of a project from a
789 single recipe file. You also able to specify conditional metadata
790 using the :term:`OVERRIDES` mechanism for a
791 single version or for an optionally named range of versions.
792
793 For more information on ``BBVERSIONS``, see the
794 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variants - class extension mechanism`"
795 section.
796
797 :term:`BITBAKE_UI` 1034 :term:`BITBAKE_UI`
798 Used to specify the UI module to use when running BitBake. Using this 1035 Used to specify the UI module to use when running BitBake. Using this
799 variable is equivalent to using the ``-u`` command-line option. 1036 variable is equivalent to using the ``-u`` command-line option.
@@ -825,7 +1062,7 @@ overview of their function and contents.
825 The most common usage of this is variable is to set it to "-1" within 1062 The most common usage of this is variable is to set it to "-1" within
826 a recipe for a development version of a piece of software. Using the 1063 a recipe for a development version of a piece of software. Using the
827 variable in this way causes the stable version of the recipe to build 1064 variable in this way causes the stable version of the recipe to build
828 by default in the absence of ``PREFERRED_VERSION`` being used to 1065 by default in the absence of :term:`PREFERRED_VERSION` being used to
829 build the development version. 1066 build the development version.
830 1067
831 .. note:: 1068 .. note::
@@ -838,8 +1075,8 @@ overview of their function and contents.
838 Lists a recipe's build-time dependencies (i.e. other recipe files). 1075 Lists a recipe's build-time dependencies (i.e. other recipe files).
839 1076
840 Consider this simple example for two recipes named "a" and "b" that 1077 Consider this simple example for two recipes named "a" and "b" that
841 produce similarly named packages. In this example, the ``DEPENDS`` 1078 produce similarly named packages. In this example, the :term:`DEPENDS`
842 statement appears in the "a" recipe: :: 1079 statement appears in the "a" recipe::
843 1080
844 DEPENDS = "b" 1081 DEPENDS = "b"
845 1082
@@ -856,7 +1093,7 @@ overview of their function and contents.
856 1093
857 :term:`DL_DIR` 1094 :term:`DL_DIR`
858 The central download directory used by the build process to store 1095 The central download directory used by the build process to store
859 downloads. By default, ``DL_DIR`` gets files suitable for mirroring for 1096 downloads. By default, :term:`DL_DIR` gets files suitable for mirroring for
860 everything except Git repositories. If you want tarballs of Git 1097 everything except Git repositories. If you want tarballs of Git
861 repositories, use the :term:`BB_GENERATE_MIRROR_TARBALLS` variable. 1098 repositories, use the :term:`BB_GENERATE_MIRROR_TARBALLS` variable.
862 1099
@@ -867,18 +1104,18 @@ overview of their function and contents.
867 ``bblayers.conf`` configuration file. 1104 ``bblayers.conf`` configuration file.
868 1105
869 To exclude a recipe from a world build using this variable, set the 1106 To exclude a recipe from a world build using this variable, set the
870 variable to "1" in the recipe. 1107 variable to "1" in the recipe. Set it to "0" to add it back to world build.
871 1108
872 .. note:: 1109 .. note::
873 1110
874 Recipes added to ``EXCLUDE_FROM_WORLD`` may still be built during a world 1111 Recipes added to :term:`EXCLUDE_FROM_WORLD` may still be built during a world
875 build in order to satisfy dependencies of other recipes. Adding a 1112 build in order to satisfy dependencies of other recipes. Adding a
876 recipe to ``EXCLUDE_FROM_WORLD`` only ensures that the recipe is not 1113 recipe to :term:`EXCLUDE_FROM_WORLD` only ensures that the recipe is not
877 explicitly added to the list of build targets in a world build. 1114 explicitly added to the list of build targets in a world build.
878 1115
879 :term:`FAKEROOT` 1116 :term:`FAKEROOT`
880 Contains the command to use when running a shell script in a fakeroot 1117 Contains the command to use when running a shell script in a fakeroot
881 environment. The ``FAKEROOT`` variable is obsolete and has been 1118 environment. The :term:`FAKEROOT` variable is obsolete and has been
882 replaced by the other ``FAKEROOT*`` variables. See these entries in 1119 replaced by the other ``FAKEROOT*`` variables. See these entries in
883 the glossary for more information. 1120 the glossary for more information.
884 1121
@@ -925,6 +1162,11 @@ overview of their function and contents.
925 environment variable. The value is a colon-separated list of 1162 environment variable. The value is a colon-separated list of
926 directories that are searched left-to-right in order. 1163 directories that are searched left-to-right in order.
927 1164
1165 :term:`FILE_LAYERNAME`
1166 During parsing and task execution, this is set to the name of the
1167 layer containing the recipe file. Code can use this to identify which
1168 layer a recipe is from.
1169
928 :term:`GITDIR` 1170 :term:`GITDIR`
929 The directory in which a local copy of a Git repository is stored 1171 The directory in which a local copy of a Git repository is stored
930 when it is cloned. 1172 when it is cloned.
@@ -941,9 +1183,9 @@ overview of their function and contents.
941 Causes the named class or classes to be inherited globally. Anonymous 1183 Causes the named class or classes to be inherited globally. Anonymous
942 functions in the class or classes are not executed for the base 1184 functions in the class or classes are not executed for the base
943 configuration and in each individual recipe. The OpenEmbedded build 1185 configuration and in each individual recipe. The OpenEmbedded build
944 system ignores changes to ``INHERIT`` in individual recipes. 1186 system ignores changes to :term:`INHERIT` in individual recipes.
945 1187
946 For more information on ``INHERIT``, see the 1188 For more information on :term:`INHERIT`, see the
947 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` configuration directive`" 1189 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` configuration directive`"
948 section. 1190 section.
949 1191
@@ -973,6 +1215,29 @@ overview of their function and contents.
973 variable is not available outside of ``layer.conf`` and references 1215 variable is not available outside of ``layer.conf`` and references
974 are expanded immediately when parsing of the file completes. 1216 are expanded immediately when parsing of the file completes.
975 1217
1218 :term:`LAYERSERIES_COMPAT`
1219 Lists the versions of the OpenEmbedded-Core (OE-Core) for which
1220 a layer is compatible. Using the :term:`LAYERSERIES_COMPAT` variable
1221 allows the layer maintainer to indicate which combinations of the
1222 layer and OE-Core can be expected to work. The variable gives the
1223 system a way to detect when a layer has not been tested with new
1224 releases of OE-Core (e.g. the layer is not maintained).
1225
1226 To specify the OE-Core versions for which a layer is compatible, use
1227 this variable in your layer's ``conf/layer.conf`` configuration file.
1228 For the list, use the Yocto Project release name (e.g. "kirkstone",
1229 "mickledore"). To specify multiple OE-Core versions for the layer, use
1230 a space-separated list::
1231
1232 LAYERSERIES_COMPAT_layer_root_name = "kirkstone mickledore"
1233
1234 .. note::
1235
1236 Setting :term:`LAYERSERIES_COMPAT` is required by the Yocto Project
1237 Compatible version 2 standard.
1238 The OpenEmbedded build system produces a warning if the variable
1239 is not set for any given layer.
1240
976 :term:`LAYERVERSION` 1241 :term:`LAYERVERSION`
977 Optionally specifies the version of a layer as a single number. You 1242 Optionally specifies the version of a layer as a single number. You
978 can use this variable within 1243 can use this variable within
@@ -991,29 +1256,16 @@ overview of their function and contents.
991 the build system searches for source code, it first tries the local 1256 the build system searches for source code, it first tries the local
992 download directory. If that location fails, the build system tries 1257 download directory. If that location fails, the build system tries
993 locations defined by :term:`PREMIRRORS`, the 1258 locations defined by :term:`PREMIRRORS`, the
994 upstream source, and then locations specified by ``MIRRORS`` in that 1259 upstream source, and then locations specified by :term:`MIRRORS` in that
995 order. 1260 order.
996 1261
997 :term:`MULTI_PROVIDER_WHITELIST`
998 Allows you to suppress BitBake warnings caused when building two
999 separate recipes that provide the same output.
1000
1001 BitBake normally issues a warning when building two different recipes
1002 where each provides the same output. This scenario is usually
1003 something the user does not want. However, cases do exist where it
1004 makes sense, particularly in the ``virtual/*`` namespace. You can use
1005 this variable to suppress BitBake's warnings.
1006
1007 To use the variable, list provider names (e.g. recipe names,
1008 ``virtual/kernel``, and so forth).
1009
1010 :term:`OVERRIDES` 1262 :term:`OVERRIDES`
1011 BitBake uses ``OVERRIDES`` to control what variables are overridden 1263 A colon-separated list that BitBake uses to control what variables are
1012 after BitBake parses recipes and configuration files. 1264 overridden after BitBake parses recipes and configuration files.
1013 1265
1014 Following is a simple example that uses an overrides list based on 1266 Following is a simple example that uses an overrides list based on
1015 machine architectures: OVERRIDES = "arm:x86:mips:powerpc" You can 1267 machine architectures: OVERRIDES = "arm:x86:mips:powerpc" You can
1016 find information on how to use ``OVERRIDES`` in the 1268 find information on how to use :term:`OVERRIDES` in the
1017 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:conditional syntax 1269 ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:conditional syntax
1018 (overrides)`" section. 1270 (overrides)`" section.
1019 1271
@@ -1027,11 +1279,11 @@ overview of their function and contents.
1027 :term:`PACKAGES_DYNAMIC` 1279 :term:`PACKAGES_DYNAMIC`
1028 A promise that your recipe satisfies runtime dependencies for 1280 A promise that your recipe satisfies runtime dependencies for
1029 optional modules that are found in other recipes. 1281 optional modules that are found in other recipes.
1030 ``PACKAGES_DYNAMIC`` does not actually satisfy the dependencies, it 1282 :term:`PACKAGES_DYNAMIC` does not actually satisfy the dependencies, it
1031 only states that they should be satisfied. For example, if a hard, 1283 only states that they should be satisfied. For example, if a hard,
1032 runtime dependency (:term:`RDEPENDS`) of another 1284 runtime dependency (:term:`RDEPENDS`) of another
1033 package is satisfied during the build through the 1285 package is satisfied during the build through the
1034 ``PACKAGES_DYNAMIC`` variable, but a package with the module name is 1286 :term:`PACKAGES_DYNAMIC` variable, but a package with the module name is
1035 never actually produced, then the other package will be broken. 1287 never actually produced, then the other package will be broken.
1036 1288
1037 :term:`PE` 1289 :term:`PE`
@@ -1061,7 +1313,7 @@ overview of their function and contents.
1061 recipes provide the same item. You should always suffix the variable 1313 recipes provide the same item. You should always suffix the variable
1062 with the name of the provided item, and you should set it to the 1314 with the name of the provided item, and you should set it to the
1063 :term:`PN` of the recipe to which you want to give 1315 :term:`PN` of the recipe to which you want to give
1064 precedence. Some examples: :: 1316 precedence. Some examples::
1065 1317
1066 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto" 1318 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
1067 PREFERRED_PROVIDER_virtual/xserver = "xserver-xf86" 1319 PREFERRED_PROVIDER_virtual/xserver = "xserver-xf86"
@@ -1070,30 +1322,30 @@ overview of their function and contents.
1070 :term:`PREFERRED_PROVIDERS` 1322 :term:`PREFERRED_PROVIDERS`
1071 Determines which recipe should be given preference for cases where 1323 Determines which recipe should be given preference for cases where
1072 multiple recipes provide the same item. Functionally, 1324 multiple recipes provide the same item. Functionally,
1073 ``PREFERRED_PROVIDERS`` is identical to 1325 :term:`PREFERRED_PROVIDERS` is identical to
1074 :term:`PREFERRED_PROVIDER`. However, the ``PREFERRED_PROVIDERS`` variable 1326 :term:`PREFERRED_PROVIDER`. However, the :term:`PREFERRED_PROVIDERS` variable
1075 lets you define preferences for multiple situations using the following 1327 lets you define preferences for multiple situations using the following
1076 form: :: 1328 form::
1077 1329
1078 PREFERRED_PROVIDERS = "xxx:yyy aaa:bbb ..." 1330 PREFERRED_PROVIDERS = "xxx:yyy aaa:bbb ..."
1079 1331
1080 This form is a convenient replacement for the following: :: 1332 This form is a convenient replacement for the following::
1081 1333
1082 PREFERRED_PROVIDER_xxx = "yyy" 1334 PREFERRED_PROVIDER_xxx = "yyy"
1083 PREFERRED_PROVIDER_aaa = "bbb" 1335 PREFERRED_PROVIDER_aaa = "bbb"
1084 1336
1085 :term:`PREFERRED_VERSION` 1337 :term:`PREFERRED_VERSION`
1086 If there are multiple versions of recipes available, this variable 1338 If there are multiple versions of a recipe available, this variable
1087 determines which recipe should be given preference. You must always 1339 determines which version should be given preference. You must always
1088 suffix the variable with the :term:`PN` you want to 1340 suffix the variable with the :term:`PN` you want to
1089 select, and you should set :term:`PV` accordingly for 1341 select, and you should set :term:`PV` accordingly for
1090 precedence. 1342 precedence.
1091 1343
1092 The ``PREFERRED_VERSION`` variable supports limited wildcard use 1344 The :term:`PREFERRED_VERSION` variable supports limited wildcard use
1093 through the "``%``" character. You can use the character to match any 1345 through the "``%``" character. You can use the character to match any
1094 number of characters, which can be useful when specifying versions 1346 number of characters, which can be useful when specifying versions
1095 that contain long revision numbers that potentially change. Here are 1347 that contain long revision numbers that potentially change. Here are
1096 two examples: :: 1348 two examples::
1097 1349
1098 PREFERRED_VERSION_python = "2.7.3" 1350 PREFERRED_VERSION_python = "2.7.3"
1099 PREFERRED_VERSION_linux-yocto = "4.12%" 1351 PREFERRED_VERSION_linux-yocto = "4.12%"
@@ -1104,22 +1356,26 @@ overview of their function and contents.
1104 end of the string. You cannot use the wildcard character in any other 1356 end of the string. You cannot use the wildcard character in any other
1105 location of the string. 1357 location of the string.
1106 1358
1359 If a recipe with the specified version is not available, a warning
1360 message will be shown. See :term:`REQUIRED_VERSION` if you want this
1361 to be an error instead.
1362
1107 :term:`PREMIRRORS` 1363 :term:`PREMIRRORS`
1108 Specifies additional paths from which BitBake gets source code. When 1364 Specifies additional paths from which BitBake gets source code. When
1109 the build system searches for source code, it first tries the local 1365 the build system searches for source code, it first tries the local
1110 download directory. If that location fails, the build system tries 1366 download directory. If that location fails, the build system tries
1111 locations defined by ``PREMIRRORS``, the upstream source, and then 1367 locations defined by :term:`PREMIRRORS`, the upstream source, and then
1112 locations specified by :term:`MIRRORS` in that order. 1368 locations specified by :term:`MIRRORS` in that order.
1113 1369
1114 Typically, you would add a specific server for the build system to 1370 Typically, you would add a specific server for the build system to
1115 attempt before any others by adding something like the following to 1371 attempt before any others by adding something like the following to
1116 your configuration: :: 1372 your configuration::
1117 1373
1118 PREMIRRORS_prepend = "\ 1374 PREMIRRORS:prepend = "\
1119 git://.*/.* http://www.yoctoproject.org/sources/ \n \ 1375 git://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
1120 ftp://.*/.* http://www.yoctoproject.org/sources/ \n \ 1376 ftp://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
1121 http://.*/.* http://www.yoctoproject.org/sources/ \n \ 1377 http://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \
1122 https://.*/.* http://www.yoctoproject.org/sources/ \n" 1378 https://.*/.* http://downloads.yoctoproject.org/mirror/sources/"
1123 1379
1124 These changes cause the build system to intercept Git, FTP, HTTP, and 1380 These changes cause the build system to intercept Git, FTP, HTTP, and
1125 HTTPS requests and direct them to the ``http://`` sources mirror. You can 1381 HTTPS requests and direct them to the ``http://`` sources mirror. You can
@@ -1128,25 +1384,25 @@ overview of their function and contents.
1128 1384
1129 :term:`PROVIDES` 1385 :term:`PROVIDES`
1130 A list of aliases by which a particular recipe can be known. By 1386 A list of aliases by which a particular recipe can be known. By
1131 default, a recipe's own ``PN`` is implicitly already in its 1387 default, a recipe's own :term:`PN` is implicitly already in its
1132 ``PROVIDES`` list. If a recipe uses ``PROVIDES``, the additional 1388 :term:`PROVIDES` list. If a recipe uses :term:`PROVIDES`, the additional
1133 aliases are synonyms for the recipe and can be useful satisfying 1389 aliases are synonyms for the recipe and can be useful satisfying
1134 dependencies of other recipes during the build as specified by 1390 dependencies of other recipes during the build as specified by
1135 ``DEPENDS``. 1391 :term:`DEPENDS`.
1136 1392
1137 Consider the following example ``PROVIDES`` statement from a recipe 1393 Consider the following example :term:`PROVIDES` statement from a recipe
1138 file ``libav_0.8.11.bb``: :: 1394 file ``libav_0.8.11.bb``::
1139 1395
1140 PROVIDES += "libpostproc" 1396 PROVIDES += "libpostproc"
1141 1397
1142 The ``PROVIDES`` statement results in the "libav" recipe also being known 1398 The :term:`PROVIDES` statement results in the "libav" recipe also being known
1143 as "libpostproc". 1399 as "libpostproc".
1144 1400
1145 In addition to providing recipes under alternate names, the 1401 In addition to providing recipes under alternate names, the
1146 ``PROVIDES`` mechanism is also used to implement virtual targets. A 1402 :term:`PROVIDES` mechanism is also used to implement virtual targets. A
1147 virtual target is a name that corresponds to some particular 1403 virtual target is a name that corresponds to some particular
1148 functionality (e.g. a Linux kernel). Recipes that provide the 1404 functionality (e.g. a Linux kernel). Recipes that provide the
1149 functionality in question list the virtual target in ``PROVIDES``. 1405 functionality in question list the virtual target in :term:`PROVIDES`.
1150 Recipes that depend on the functionality in question can include the 1406 Recipes that depend on the functionality in question can include the
1151 virtual target in :term:`DEPENDS` to leave the 1407 virtual target in :term:`DEPENDS` to leave the
1152 choice of provider open. 1408 choice of provider open.
@@ -1158,12 +1414,12 @@ overview of their function and contents.
1158 :term:`PRSERV_HOST` 1414 :term:`PRSERV_HOST`
1159 The network based :term:`PR` service host and port. 1415 The network based :term:`PR` service host and port.
1160 1416
1161 Following is an example of how the ``PRSERV_HOST`` variable is set: :: 1417 Following is an example of how the :term:`PRSERV_HOST` variable is set::
1162 1418
1163 PRSERV_HOST = "localhost:0" 1419 PRSERV_HOST = "localhost:0"
1164 1420
1165 You must set the variable if you want to automatically start a local PR 1421 You must set the variable if you want to automatically start a local PR
1166 service. You can set ``PRSERV_HOST`` to other values to use a remote PR 1422 service. You can set :term:`PRSERV_HOST` to other values to use a remote PR
1167 service. 1423 service.
1168 1424
1169 :term:`PV` 1425 :term:`PV`
@@ -1175,26 +1431,26 @@ overview of their function and contents.
1175 a package in this list cannot be found during the build, you will get 1431 a package in this list cannot be found during the build, you will get
1176 a build error. 1432 a build error.
1177 1433
1178 Because the ``RDEPENDS`` variable applies to packages being built, 1434 Because the :term:`RDEPENDS` variable applies to packages being built,
1179 you should always use the variable in a form with an attached package 1435 you should always use the variable in a form with an attached package
1180 name. For example, suppose you are building a development package 1436 name. For example, suppose you are building a development package
1181 that depends on the ``perl`` package. In this case, you would use the 1437 that depends on the ``perl`` package. In this case, you would use the
1182 following ``RDEPENDS`` statement: :: 1438 following :term:`RDEPENDS` statement::
1183 1439
1184 RDEPENDS_${PN}-dev += "perl" 1440 RDEPENDS:${PN}-dev += "perl"
1185 1441
1186 In the example, the development package depends on the ``perl`` package. 1442 In the example, the development package depends on the ``perl`` package.
1187 Thus, the ``RDEPENDS`` variable has the ``${PN}-dev`` package name as part 1443 Thus, the :term:`RDEPENDS` variable has the ``${PN}-dev`` package name as part
1188 of the variable. 1444 of the variable.
1189 1445
1190 BitBake supports specifying versioned dependencies. Although the 1446 BitBake supports specifying versioned dependencies. Although the
1191 syntax varies depending on the packaging format, BitBake hides these 1447 syntax varies depending on the packaging format, BitBake hides these
1192 differences from you. Here is the general syntax to specify versions 1448 differences from you. Here is the general syntax to specify versions
1193 with the ``RDEPENDS`` variable: :: 1449 with the :term:`RDEPENDS` variable::
1194 1450
1195 RDEPENDS_${PN} = "package (operator version)" 1451 RDEPENDS:${PN} = "package (operator version)"
1196 1452
1197 For ``operator``, you can specify the following: :: 1453 For ``operator``, you can specify the following::
1198 1454
1199 = 1455 =
1200 < 1456 <
@@ -1203,9 +1459,9 @@ overview of their function and contents.
1203 >= 1459 >=
1204 1460
1205 For example, the following sets up a dependency on version 1.2 or 1461 For example, the following sets up a dependency on version 1.2 or
1206 greater of the package ``foo``: :: 1462 greater of the package ``foo``::
1207 1463
1208 RDEPENDS_${PN} = "foo (>= 1.2)" 1464 RDEPENDS:${PN} = "foo (>= 1.2)"
1209 1465
1210 For information on build-time dependencies, see the :term:`DEPENDS` 1466 For information on build-time dependencies, see the :term:`DEPENDS`
1211 variable. 1467 variable.
@@ -1214,33 +1470,43 @@ overview of their function and contents.
1214 The directory in which a local copy of a ``google-repo`` directory is 1470 The directory in which a local copy of a ``google-repo`` directory is
1215 stored when it is synced. 1471 stored when it is synced.
1216 1472
1473 :term:`REQUIRED_VERSION`
1474 If there are multiple versions of a recipe available, this variable
1475 determines which version should be given preference. :term:`REQUIRED_VERSION`
1476 works in exactly the same manner as :term:`PREFERRED_VERSION`, except
1477 that if the specified version is not available then an error message
1478 is shown and the build fails immediately.
1479
1480 If both :term:`REQUIRED_VERSION` and :term:`PREFERRED_VERSION` are set for
1481 the same recipe, the :term:`REQUIRED_VERSION` value applies.
1482
1217 :term:`RPROVIDES` 1483 :term:`RPROVIDES`
1218 A list of package name aliases that a package also provides. These 1484 A list of package name aliases that a package also provides. These
1219 aliases are useful for satisfying runtime dependencies of other 1485 aliases are useful for satisfying runtime dependencies of other
1220 packages both during the build and on the target (as specified by 1486 packages both during the build and on the target (as specified by
1221 ``RDEPENDS``). 1487 :term:`RDEPENDS`).
1222 1488
1223 As with all package-controlling variables, you must always use the 1489 As with all package-controlling variables, you must always use the
1224 variable in conjunction with a package name override. Here is an 1490 variable in conjunction with a package name override. Here is an
1225 example: :: 1491 example::
1226 1492
1227 RPROVIDES_${PN} = "widget-abi-2" 1493 RPROVIDES:${PN} = "widget-abi-2"
1228 1494
1229 :term:`RRECOMMENDS` 1495 :term:`RRECOMMENDS`
1230 A list of packages that extends the usability of a package being 1496 A list of packages that extends the usability of a package being
1231 built. The package being built does not depend on this list of 1497 built. The package being built does not depend on this list of
1232 packages in order to successfully build, but needs them for the 1498 packages in order to successfully build, but needs them for the
1233 extended usability. To specify runtime dependencies for packages, see 1499 extended usability. To specify runtime dependencies for packages, see
1234 the ``RDEPENDS`` variable. 1500 the :term:`RDEPENDS` variable.
1235 1501
1236 BitBake supports specifying versioned recommends. Although the syntax 1502 BitBake supports specifying versioned recommends. Although the syntax
1237 varies depending on the packaging format, BitBake hides these 1503 varies depending on the packaging format, BitBake hides these
1238 differences from you. Here is the general syntax to specify versions 1504 differences from you. Here is the general syntax to specify versions
1239 with the ``RRECOMMENDS`` variable: :: 1505 with the :term:`RRECOMMENDS` variable::
1240 1506
1241 RRECOMMENDS_${PN} = "package (operator version)" 1507 RRECOMMENDS:${PN} = "package (operator version)"
1242 1508
1243 For ``operator``, you can specify the following: :: 1509 For ``operator``, you can specify the following::
1244 1510
1245 = 1511 =
1246 < 1512 <
@@ -1249,76 +1515,114 @@ overview of their function and contents.
1249 >= 1515 >=
1250 1516
1251 For example, the following sets up a recommend on version 1517 For example, the following sets up a recommend on version
1252 1.2 or greater of the package ``foo``: :: 1518 1.2 or greater of the package ``foo``::
1253 1519
1254 RRECOMMENDS_${PN} = "foo (>= 1.2)" 1520 RRECOMMENDS:${PN} = "foo (>= 1.2)"
1255 1521
1256 :term:`SECTION` 1522 :term:`SECTION`
1257 The section in which packages should be categorized. 1523 The section in which packages should be categorized.
1258 1524
1259 :term:`SRC_URI` 1525 :term:`SRC_URI`
1260 The list of source files - local or remote. This variable tells 1526 The list of source files --- local or remote. This variable tells
1261 BitBake which bits to pull for the build and how to pull them. For 1527 BitBake which bits to pull for the build and how to pull them. For
1262 example, if the recipe or append file needs to fetch a single tarball 1528 example, if the recipe or append file needs to fetch a single tarball
1263 from the Internet, the recipe or append file uses a ``SRC_URI`` entry 1529 from the Internet, the recipe or append file uses a :term:`SRC_URI`
1264 that specifies that tarball. On the other hand, if the recipe or 1530 entry that specifies that tarball. On the other hand, if the recipe or
1265 append file needs to fetch a tarball and include a custom file, the 1531 append file needs to fetch a tarball, apply two patches, and include
1266 recipe or append file needs an ``SRC_URI`` variable that specifies 1532 a custom file, the recipe or append file needs an :term:`SRC_URI`
1267 all those sources. 1533 variable that specifies all those sources.
1268 1534
1269 The following list explains the available URI protocols: 1535 The following list explains the available URI protocols. URI
1536 protocols are highly dependent on particular BitBake Fetcher
1537 submodules. Depending on the fetcher BitBake uses, various URL
1538 parameters are employed. For specifics on the supported Fetchers, see
1539 the :ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`
1540 section.
1270 1541
1271 - ``file://`` : Fetches files, which are usually files shipped 1542 - ``az://``: Fetches files from an Azure Storage account using HTTPS.
1272 with the metadata, from the local machine. The path is relative to
1273 the :term:`FILESPATH` variable.
1274 1543
1275 - ``bzr://`` : Fetches files from a Bazaar revision control 1544 - ``bzr://``: Fetches files from a Bazaar revision control
1276 repository. 1545 repository.
1277 1546
1278 - ``git://`` : Fetches files from a Git revision control 1547 - ``ccrc://``: Fetches files from a ClearCase repository.
1548
1549 - ``cvs://``: Fetches files from a CVS revision control
1279 repository. 1550 repository.
1280 1551
1281 - ``osc://`` : Fetches files from an OSC (OpenSUSE Build service) 1552 - ``file://``: Fetches files, which are usually files shipped
1282 revision control repository. 1553 with the Metadata, from the local machine.
1554 The path is relative to the :term:`FILESPATH`
1555 variable. Thus, the build system searches, in order, from the
1556 following directories, which are assumed to be a subdirectories of
1557 the directory in which the recipe file (``.bb``) or append file
1558 (``.bbappend``) resides:
1283 1559
1284 - ``repo://`` : Fetches files from a repo (Git) repository. 1560 - ``${BPN}``: the base recipe name without any special suffix
1561 or version numbers.
1285 1562
1286 - ``http://`` : Fetches files from the Internet using HTTP. 1563 - ``${BP}`` - ``${BPN}-${PV}``: the base recipe name and
1564 version but without any special package name suffix.
1287 1565
1288 - ``https://`` : Fetches files from the Internet using HTTPS. 1566 - ``files``: files within a directory, which is named ``files``
1567 and is also alongside the recipe or append file.
1289 1568
1290 - ``ftp://`` : Fetches files from the Internet using FTP. 1569 - ``ftp://``: Fetches files from the Internet using FTP.
1291 1570
1292 - ``cvs://`` : Fetches files from a CVS revision control 1571 - ``git://``: Fetches files from a Git revision control
1293 repository. 1572 repository.
1294 1573
1295 - ``hg://`` : Fetches files from a Mercurial (``hg``) revision 1574 - ``gitsm://``: Fetches submodules from a Git revision control
1575 repository.
1576
1577 - ``hg://``: Fetches files from a Mercurial (``hg``) revision
1296 control repository. 1578 control repository.
1297 1579
1298 - ``p4://`` : Fetches files from a Perforce (``p4``) revision 1580 - ``http://``: Fetches files from the Internet using HTTP.
1581
1582 - ``https://``: Fetches files from the Internet using HTTPS.
1583
1584 - ``npm://``: Fetches JavaScript modules from a registry.
1585
1586 - ``osc://``: Fetches files from an OSC (OpenSUSE Build service)
1587 revision control repository.
1588
1589 - ``p4://``: Fetches files from a Perforce (``p4``) revision
1299 control repository. 1590 control repository.
1300 1591
1301 - ``ssh://`` : Fetches files from a secure shell. 1592 - ``repo://``: Fetches files from a repo (Git) repository.
1593
1594 - ``ssh://``: Fetches files from a secure shell.
1302 1595
1303 - ``svn://`` : Fetches files from a Subversion (``svn``) revision 1596 - ``svn://``: Fetches files from a Subversion (``svn``) revision
1304 control repository. 1597 control repository.
1305 1598
1306 Here are some additional options worth mentioning: 1599 Here are some additional options worth mentioning:
1307 1600
1308 - ``unpack`` : Controls whether or not to unpack the file if it is 1601 - ``downloadfilename``: Specifies the filename used when storing
1309 an archive. The default action is to unpack the file. 1602 the downloaded file.
1603
1604 - ``name``: Specifies a name to be used for association with
1605 :term:`SRC_URI` checksums or :term:`SRCREV` when you have more than one
1606 file or git repository specified in :term:`SRC_URI`. For example::
1607
1608 SRC_URI = "git://example.com/foo.git;branch=main;name=first \
1609 git://example.com/bar.git;branch=main;name=second \
1610 http://example.com/file.tar.gz;name=third"
1310 1611
1311 - ``subdir`` : Places the file (or extracts its contents) into the 1612 SRCREV_first = "f1d2d2f924e986ac86fdf7b36c94bcdf32beec15"
1613 SRCREV_second = "e242ed3bffccdf271b7fbaf34ed72d089537b42f"
1614 SRC_URI[third.sha256sum] = "13550350a8681c84c861aac2e5b440161c2b33a3e4f302ac680ca5b686de48de"
1615
1616 - ``subdir``: Places the file (or extracts its contents) into the
1312 specified subdirectory. This option is useful for unusual tarballs 1617 specified subdirectory. This option is useful for unusual tarballs
1313 or other archives that do not have their files already in a 1618 or other archives that do not have their files already in a
1314 subdirectory within the archive. 1619 subdirectory within the archive.
1315 1620
1316 - ``name`` : Specifies a name to be used for association with 1621 - ``subpath``: Limits the checkout to a specific subpath of the
1317 ``SRC_URI`` checksums when you have more than one file specified 1622 tree when using the Git fetcher is used.
1318 in ``SRC_URI``.
1319 1623
1320 - ``downloadfilename`` : Specifies the filename used when storing 1624 - ``unpack``: Controls whether or not to unpack the file if it is
1321 the downloaded file. 1625 an archive. The default action is to unpack the file.
1322 1626
1323 :term:`SRCDATE` 1627 :term:`SRCDATE`
1324 The date of the source code used to build the package. This variable 1628 The date of the source code used to build the package. This variable
@@ -1330,7 +1634,7 @@ overview of their function and contents.
1330 variable applies only when using Subversion, Git, Mercurial and 1634 variable applies only when using Subversion, Git, Mercurial and
1331 Bazaar. If you want to build a fixed revision and you want to avoid 1635 Bazaar. If you want to build a fixed revision and you want to avoid
1332 performing a query on the remote repository every time BitBake parses 1636 performing a query on the remote repository every time BitBake parses
1333 your recipe, you should specify a ``SRCREV`` that is a full revision 1637 your recipe, you should specify a :term:`SRCREV` that is a full revision
1334 identifier and not just a tag. 1638 identifier and not just a tag.
1335 1639
1336 :term:`SRCREV_FORMAT` 1640 :term:`SRCREV_FORMAT`
@@ -1339,10 +1643,10 @@ overview of their function and contents.
1339 :term:`SRC_URI`. 1643 :term:`SRC_URI`.
1340 1644
1341 The system needs help constructing these values under these 1645 The system needs help constructing these values under these
1342 circumstances. Each component in the ``SRC_URI`` is assigned a name 1646 circumstances. Each component in the :term:`SRC_URI` is assigned a name
1343 and these are referenced in the ``SRCREV_FORMAT`` variable. Consider 1647 and these are referenced in the :term:`SRCREV_FORMAT` variable. Consider
1344 an example with URLs named "machine" and "meta". In this case, 1648 an example with URLs named "machine" and "meta". In this case,
1345 ``SRCREV_FORMAT`` could look like "machine_meta" and those names 1649 :term:`SRCREV_FORMAT` could look like "machine_meta" and those names
1346 would have the SCM versions substituted into each position. Only one 1650 would have the SCM versions substituted into each position. Only one
1347 ``AUTOINC`` placeholder is added and if needed. And, this placeholder 1651 ``AUTOINC`` placeholder is added and if needed. And, this placeholder
1348 is placed at the start of the returned string. 1652 is placed at the start of the returned string.
@@ -1354,7 +1658,7 @@ overview of their function and contents.
1354 1658
1355 :term:`STAMPCLEAN` 1659 :term:`STAMPCLEAN`
1356 Specifies the base path used to create recipe stamp files. Unlike the 1660 Specifies the base path used to create recipe stamp files. Unlike the
1357 :term:`STAMP` variable, ``STAMPCLEAN`` can contain 1661 :term:`STAMP` variable, :term:`STAMPCLEAN` can contain
1358 wildcards to match the range of files a clean operation should 1662 wildcards to match the range of files a clean operation should
1359 remove. BitBake uses a clean operation to remove any other stamps it 1663 remove. BitBake uses a clean operation to remove any other stamps it
1360 should be removing when creating a new stamp. 1664 should be removing when creating a new stamp.