diff options
Diffstat (limited to 'bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst')
-rw-r--r-- | bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 85 |
1 files changed, 84 insertions, 1 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst index 337821612c..58975f4c88 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst @@ -319,6 +319,10 @@ The variable ``D`` becomes "dvaladditional data". You must control all spacing when you use the override syntax. +.. note:: + + The overrides are applied in this order, ":append", ":prepend", ":remove". + It is also possible to append and prepend to shell functions and BitBake-style Python functions. See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:shell functions`" and ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:bitbake-style python functions`" sections for examples. @@ -330,7 +334,8 @@ Removal (Override Style Syntax) You can remove values from lists using the removal override style syntax. Specifying a value for removal causes all occurrences of that -value to be removed from the variable. +value to be removed from the variable. Unlike ":append" and ":prepend", +there is no need to add a leading or trailing space to the value. When you use this syntax, BitBake expects one or more strings. Surrounding spaces and spacing are preserved. Here is an example:: @@ -351,6 +356,28 @@ The variable ``FOO`` becomes Like ":append" and ":prepend", ":remove" is applied at variable expansion time. +.. note:: + + The overrides are applied in this order, ":append", ":prepend", ":remove". + This implies it is not possible to re-append previously removed strings. + However, one can undo a ":remove" by using an intermediate variable whose + content is passed to the ":remove" so that modifying the intermediate + variable equals to keeping the string in:: + + FOOREMOVE = "123 456 789" + FOO:remove = "${FOOREMOVE}" + ... + FOOREMOVE = "123 789" + + This expands to ``FOO:remove = "123 789"``. + +.. note:: + + Override application order may not match variable parse history, i.e. + the output of ``bitbake -e`` may contain ":remove" before ":append", + but the result will be removed string, because ":remove" is handled + last. + Override Style Operation Advantages ----------------------------------- @@ -421,6 +448,12 @@ documentation to a BitBake variable as follows:: CACHE[doc] = "The directory holding the cache of the metadata." +.. note:: + + Variable flag names starting with an underscore (``_``) character + are allowed but are ignored by ``d.getVarFlags("VAR")`` + in Python code. Such flag names are used internally by BitBake. + Inline Python Variable Expansion -------------------------------- @@ -1463,12 +1496,35 @@ functionality of the task: directory listed is used as the current working directory for the task. +- ``[file-checksums]``: Controls the file dependencies for a task. The + baseline file list is the set of files associated with + :term:`SRC_URI`. May be used to set additional dependencies on + files not associated with :term:`SRC_URI`. + + The value set to the list is a file-boolean pair where the first + value is the file name and the second is whether or not it + physically exists on the filesystem. :: + + do_configure[file-checksums] += "${MY_DIRPATH}/my-file.txt:True" + + It is important to record any paths which the task looked at and + which didn't exist. This means that if these do exist at a later + time, the task can be rerun with the new additional files. The + "exists" True or False value after the path allows this to be + handled. + - ``[lockfiles]``: Specifies one or more lockfiles to lock while the task executes. Only one task may hold a lockfile, and any task that attempts to lock an already locked file will block until the lock is released. You can use this variable flag to accomplish mutual exclusion. +- ``[network]``: When set to "1", allows a task to access the network. By + default, only the ``do_fetch`` task is granted network access. Recipes + shouldn't access the network outside of ``do_fetch`` as it usually + undermines fetcher source mirroring, image and licence manifests, software + auditing and supply chain security. + - ``[noexec]``: When set to "1", marks the task as being empty, with no execution required. You can use the ``[noexec]`` flag to set up tasks as dependency placeholders, or to disable tasks defined @@ -1922,6 +1978,33 @@ looking at the source code of the ``bb`` module, which is in the commonly used functions ``bb.utils.contains()`` and ``bb.utils.mkdirhier()``, which come with docstrings. +Extending Python Library Code +----------------------------- + +If you wish to add your own Python library code (e.g. to provide +functions/classes you can use from Python functions in the metadata) +you can do so from any layer using the ``addpylib`` directive. +This directive is typically added to your layer configuration ( +``conf/layer.conf``) although it will be handled in any ``.conf`` file. + +Usage is of the form:: + + addpylib <directory> <namespace> + +Where <directory> specifies the directory to add to the library path. +The specified <namespace> is imported automatically, and if the imported +module specifies an attribute named ``BBIMPORTS``, that list of +sub-modules is iterated and imported too. + +Testing and Debugging BitBake Python code +----------------------------------------- + +The OpenEmbedded build system implements a convenient ``pydevshell`` target which +you can use to access the BitBake datastore and experiment with your own Python +code. See :yocto_docs:`Using a Python Development Shell +</dev-manual/python-development-shell.html#using-a-python-development-shell>` in the Yocto +Project manual for details. + Task Checksums and Setscene =========================== |