@@ -46,6 +46,15 @@ Python f-strings may also be used::
warn,
warnonce,
+``bb.build``
+============
+
+.. automodule:: bb.build
+ :members:
+ addtask,
+ deltask,
+ exec_func
+
``bb.utils``
============
@@ -183,7 +183,19 @@ class StdoutNoopContextManager:
def exec_func(func, d, dirs = None):
- """Execute a BB 'function'"""
+ """Execute a function or a task.
+
+ Arguments:
+
+ - ``func``: name of the function/task to execute.
+ - ``d``: the data store.
+ - ``dirs``: list of directories to create before executing the task.
+
+ If ``dirs`` is ``None``, this function will look at the value of the ``dirs``
+ varflag defined for ``func`` and create directories using this list instead.
+
+ No return value.
+ """
try:
oldcwd = os.getcwd()
@@ -938,6 +950,20 @@ def ensure_task_prefix(name):
return name
def addtask(task, before, after, d):
+ """Adds a task to the task graph. If called from a recipe, the task is added
+ in the scope of the recipe. If called from an :ref:`Anonymous Python function
+ <bitbake-user-manual/bitbake-user-manual-metadata:anonymous python functions>`,
+ the task is added in the global scope, so for each recipe being built.
+
+ Arguments:
+
+ - ``task``: name of the task to add to the graph.
+ - ``before``: task to depend on (optional, can be ``None``).
+ - ``after``: tasks that depend on the task being added (optional, can be ``None``).
+ - ``d``: the data store.
+
+ No return value.
+ """
task = ensure_task_prefix(task)
d.setVarFlag(task, "task", 1)
@@ -963,6 +989,18 @@ def addtask(task, before, after, d):
d.setVarFlag(entry, "deps", [task] + existing)
def deltask(task, d):
+ """Deletes a task from the task graph. If called from a recipe, the task is
+ removed within the scope of the recipe. If called from an :ref:`Anonymous Python
+ function <bitbake-user-manual/bitbake-user-manual-metadata:anonymous python functions>`,
+ the task is removed globally, so for each recipe being built.
+
+ Arguments:
+
+ - ``task``: name of the task to add.
+ - ``d``: the data store.
+
+ No return value.
+ """
task = ensure_task_prefix(task)
bbtasks = d.getVar('__BBTASKS', False) or []
Document functions in bb.build that are public API using the automodule Sphinx extension, which generates documentation from docstrings. Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> --- This is limited to those three functions, as Richard those were the only public ones on IRC: https://libera.catirclogs.org/yocto/2026-09-24#40518068; --- .../bitbake-user-manual-library-functions.rst | 9 +++++ lib/bb/build.py | 40 +++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) --- base-commit: 74128534302fbf8164ade07b200b90b731caa0ad change-id: 20260924-doc-bb-build-funcs-156eb9c37d96