From patchwork Tue Jun 17 17:13:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 65160 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 B3325C7115B for ; Tue, 17 Jun 2025 17:13:43 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.25102.1750180419951578642 for ; Tue, 17 Jun 2025 10:13:40 -0700 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 7A68D150C for ; Tue, 17 Jun 2025 10:13:18 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.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 0AD003F673 for ; Tue, 17 Jun 2025 10:13:38 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/4] oeqa/utils/command: fast-path get_bb_var() Date: Tue, 17 Jun 2025 18:13:29 +0100 Message-ID: <20250617171332.3162295-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 ; Tue, 17 Jun 2025 17:13:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/218910 get_bb_var() currently end up calling 'bitbake -e' and parsing the whole output. However if postconfig isn't set then we can speed this up by just calling bitbake-getvar. Signed-off-by: Ross Burton --- meta/lib/oeqa/utils/commands.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 2a47f90e327..bfe69474149 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -285,7 +285,14 @@ def get_bb_vars(variables=None, target=None, postconfig=None): return values def get_bb_var(var, target=None, postconfig=None): - return get_bb_vars([var], target, postconfig)[var] + if postconfig: + return bitbake("-e %s" % target or "", postconfig=postconfig).output + else: + # Fast-path for the non-postconfig case + cmd = ["bitbake-getvar", "--value", var] + if target: + cmd.extend(["--recipe", target]) + return subprocess.run(cmd, check=True, text=True, stdout=subprocess.PIPE).stdout.strip() def get_test_layer(bblayers=None): if bblayers is None: