Skip to contentSkip to conversation

bb/build: add a function to list the tasks in a datastore

PATCH New Ross Burton 1 participant 1 message Nov 27, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bb/build: add a function to list the tasks in a datastore

There's no easy way to list all of the tasks in a recipe, you can either look at __BBTASKS (internal variable, shouldn't be used) or iterate all items in the datastore looking for variables with the 'task' flag set (which is slow).

Solve this problem by adding a bb.build.listtasks() function that returns an immutable copy of the __BBTASSK variable.

---
 bitbake/lib/bb/build.py | 6 ++++++
 1 file changed, 6 insertions(+)
bitbake/lib/bb/build.py +6 -0
index 9f9285de3d6..6e0459d87ab 100644
@@ -1028,3 +1028,9 @@ def tasksbetween(task_start, task_end, d):
         chain.pop()
     follow_chain(task_start, task_end)
     return outtasks
+
+def listtasks(d):
+    """
+    Return the list of tasks in the current recipe.
+    """
+    return tuple(d.getVar('__BBTASKS', False) or ())
Signature · 1 line
2.34.1