diff mbox series

[v2,2/3] classes/utility-tasks: port do_listtasks to use bb.build.listtasks

Message ID 20241211120847.384816-2-ross.burton@arm.com
State New
Headers show
Series [v2,1/3] lib/bb/tests: use bb.build.listtasks() instead of __BBTASKS | expand

Commit Message

Ross Burton Dec. 11, 2024, 12:08 p.m. UTC
Instead of iterating every datastore value by hand to find tasks, use
the new bb.build.listtasks() function (bitbake 185c4b)

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-global/utility-tasks.bbclass | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/utility-tasks.bbclass b/meta/classes-global/utility-tasks.bbclass
index ae2da330b86..394cc3158d5 100644
--- a/meta/classes-global/utility-tasks.bbclass
+++ b/meta/classes-global/utility-tasks.bbclass
@@ -9,18 +9,17 @@  do_listtasks[nostamp] = "1"
 python do_listtasks() {
     taskdescs = {}
     maxlen = 0
-    for e in d.keys():
-        if d.getVarFlag(e, 'task'):
-            maxlen = max(maxlen, len(e))
-            if e.endswith('_setscene'):
-                desc = "%s (setscene version)" % (d.getVarFlag(e[:-9], 'doc') or '')
-            else:
-                desc = d.getVarFlag(e, 'doc') or ''
-            taskdescs[e] = desc
-
-    tasks = sorted(taskdescs.keys())
-    for taskname in tasks:
-        bb.plain("%s  %s" % (taskname.ljust(maxlen), taskdescs[taskname]))
+    for t in bb.build.listtasks(d):
+        maxlen = max(maxlen, len(t))
+
+        if t.endswith('_setscene'):
+            desc = "%s (setscene version)" % (d.getVarFlag(t[:-9], 'doc') or '')
+        else:
+            desc = d.getVarFlag(t, 'doc') or ''
+        taskdescs[t] = desc
+
+    for task, doc in sorted(taskdescs.items()):
+        bb.plain("%s  %s" % (task.ljust(maxlen), doc))
 }
 
 CLEANFUNCS ?= ""