lib/bb/tests: use bb.build.listtasks() instead of __BBTASKS
PATCH v2 1/3 lib/bb/tests: use bb.build.listtasks() instead of __BBTASKS
Use the new listtasks() function (introduced in 185c4b) to avoid accessing a private variable.
Also use assertSequenceEqual() directly as we don't really care about the actual type returned, only that it's a sequence.
Signed-off-by Ross Burton <[email protected]>
--- bitbake/lib/bb/tests/parse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/tests/parse.py +1 -1
@@ -201,7 +201,7 @@ deltask ${EMPTYVAR} f = self.parsehelper(self.addtask_deltask) d = bb.parse.handle(f.name, self.d)[''] - self.assertEqual(['do_fetch2', 'do_patch2', 'do_myplaintask', 'do_mytask', 'do_mytask2', 'do_mytask5'], d.getVar("__BBTASKS")) + self.assertSequenceEqual(['do_fetch2', 'do_patch2', 'do_myplaintask', 'do_mytask', 'do_mytask2', 'do_mytask5'], bb.build.listtasks(d)) self.assertEqual(['do_mytask'], d.getVarFlag("do_mytask5", "deps")) broken_multiline_comment = """
Signature · 1 line
2.43.0
PATCH v2 2/3 classes/utility-tasks: port do_listtasks to use bb.build.listtasks
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 <[email protected]>
--- meta/classes-global/utility-tasks.bbclass | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
meta/classes-global/utility-tasks.bbclass +11 -12
@@ -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 ?= ""
Signature · 1 line
2.43.0
PATCH v2 3/3 scripts/devtool: use bb.util.listtasks instead of __BBTASKS
In reply to Ross BurtonDon't access private variables, instead use the new bb.build.listtasks() function (from bitbake 185c4b)
Signed-off-by Ross Burton <[email protected]>
--- scripts/lib/devtool/build.py | 2 +- scripts/lib/devtool/utilcmds.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/lib/devtool/build.py +1 -1
@@ -49,7 +49,7 @@ def build(args, config, basepath, workspace): rd = parse_recipe(config, tinfoil, args.recipename, appends=True, filter_workspace=False) if not rd: return 1 - deploytask = 'do_deploy' in rd.getVar('__BBTASKS') + deploytask = 'do_deploy' in bb.build.listtasks(rd) finally: tinfoil.shutdown()
scripts/lib/devtool/utilcmds.py +1 -1
@@ -64,7 +64,7 @@ def configure_help(args, config, basepath, workspace): b = rd.getVar('B') s = rd.getVar('S') configurescript = os.path.join(s, 'configure') - confdisabled = 'noexec' in rd.getVarFlags('do_configure') or 'do_configure' not in (rd.getVar('__BBTASKS', False) or []) + confdisabled = 'noexec' in rd.getVarFlags('do_configure') or 'do_configure' not in (bb.build.listtasks(rd)) configureopts = oe.utils.squashspaces(rd.getVar('CONFIGUREOPTS') or '') extra_oeconf = oe.utils.squashspaces(rd.getVar('EXTRA_OECONF') or '') extra_oecmake = oe.utils.squashspaces(rd.getVar('EXTRA_OECMAKE') or '')
Signature · 1 line
2.43.0