From patchwork Wed Dec 11 12:08:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 53926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C200E77180 for ; Wed, 11 Dec 2024 12:08:54 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.9306.1733918933474927083 for ; Wed, 11 Dec 2024 04:08:53 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD1941063 for ; Wed, 11 Dec 2024 04:09:20 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 400D13F5A1 for ; Wed, 11 Dec 2024 04:08:52 -0800 (PST) From: Ross Burton To: bitbake-devel@lists.openembedded.org Subject: [PATCH v2 1/3] lib/bb/tests: use bb.build.listtasks() instead of __BBTASKS Date: Wed, 11 Dec 2024 12:08:45 +0000 Message-ID: <20241211120847.384816-1-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 11 Dec 2024 12:08:54 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16904 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 --- bitbake/lib/bb/tests/parse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index 410679d5a1b..56eb66be9ff 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py @@ -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 = """ From patchwork Wed Dec 11 12:08:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 53925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 978FFE7717D for ; Wed, 11 Dec 2024 12:08:54 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.9307.1733918933854080476 for ; Wed, 11 Dec 2024 04:08:53 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7AB721692 for ; Wed, 11 Dec 2024 04:09:21 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 08E253F5A1 for ; Wed, 11 Dec 2024 04:08:52 -0800 (PST) From: Ross Burton To: bitbake-devel@lists.openembedded.org Subject: [PATCH v2 2/3] classes/utility-tasks: port do_listtasks to use bb.build.listtasks Date: Wed, 11 Dec 2024 12:08:46 +0000 Message-ID: <20241211120847.384816-2-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241211120847.384816-1-ross.burton@arm.com> References: <20241211120847.384816-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 11 Dec 2024 12:08:54 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16905 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 --- meta/classes-global/utility-tasks.bbclass | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) 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 ?= "" From patchwork Wed Dec 11 12:08:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 53927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 879E5E7717D for ; Wed, 11 Dec 2024 12:09:04 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.9260.1733918934667065771 for ; Wed, 11 Dec 2024 04:08:54 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3A5261063 for ; Wed, 11 Dec 2024 04:09:22 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BC7443F5A1 for ; Wed, 11 Dec 2024 04:08:53 -0800 (PST) From: Ross Burton To: bitbake-devel@lists.openembedded.org Subject: [PATCH v2 3/3] scripts/devtool: use bb.util.listtasks instead of __BBTASKS Date: Wed, 11 Dec 2024 12:08:47 +0000 Message-ID: <20241211120847.384816-3-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241211120847.384816-1-ross.burton@arm.com> References: <20241211120847.384816-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 11 Dec 2024 12:09:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/16906 Don't access private variables, instead use the new bb.build.listtasks() function (from bitbake 185c4b) Signed-off-by: Ross Burton --- scripts/lib/devtool/build.py | 2 +- scripts/lib/devtool/utilcmds.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/devtool/build.py b/scripts/lib/devtool/build.py index 935ffab46c5..0b2c3d33dc1 100644 --- a/scripts/lib/devtool/build.py +++ b/scripts/lib/devtool/build.py @@ -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() diff --git a/scripts/lib/devtool/utilcmds.py b/scripts/lib/devtool/utilcmds.py index 964817766b7..bf39f71b118 100644 --- a/scripts/lib/devtool/utilcmds.py +++ b/scripts/lib/devtool/utilcmds.py @@ -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 '')