From patchwork Mon Sep 25 01:25:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 31075 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 E843CCE7A94 for ; Mon, 25 Sep 2023 01:25:16 +0000 (UTC) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by mx.groups.io with SMTP id smtpd.web10.52172.1695605111217766162 for ; Sun, 24 Sep 2023 18:25:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=Un+dHVHT; spf=pass (domain: axis.com, ip: 195.60.68.17, mailfrom: peter.kjellerstedt@axis.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1695605111; x=1727141111; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=Pe/GUm5TwoJLuED2Cn/CDqf7f787c7H/1fydL5tkaxk=; b=Un+dHVHTMGeJeLCQ+B5K5AZc1j2/hZZbJEteDOlxbm7MYN6EcxgkvsrF sMFcP1zt+uWyZq9m43xMdUInKX8e+cc5r7iychWgiQqvspVBGAed1CozB qW3/1YKg518mMv704XGQqIpoa7ECGyA/YV0J+WvDM2CfRfh1wV45oncp5 dTi8zq9uqllavj/yXZSFusACxEWEiLhPi9gq4pTHy54sT9+1peKWNBSGS FbghTojpvcI85pqMTO1M6uGAck3d8ButXCI0Qwrp/2syAWRRX/SLqJC6d MzquQYHX2w/FTcA0jaTAr8ap0HN41dvXjz+mp+3+aq9YFIJFcKDN/qJqb w==; From: Peter Kjellerstedt To: Subject: [PATCHv2 1/3] tinfoil: Do not fail when logging is disabled and full config is used Date: Mon, 25 Sep 2023 03:25:00 +0200 Message-ID: <20230925012502.770037-1-pkj@axis.com> X-Mailer: git-send-email 2.40.1 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 ; Mon, 25 Sep 2023 01:25:16 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15107 If Tinfoil is initialized with setup_logging = False and Tinfoil.prepare() is called with config_only = False, then it fails because self.localhandlers is only initialized when setup_logging = True. This is seen with, e.g., `bitbake-getvar -q -r busybox MACHINE`: Traceback (most recent call last): File ".../bitbake/bin/bitbake-getvar", line 41, in tinfoil.prepare(quiet=2) File ".../bitbake/lib/bb/tinfoil.py", line 390, in prepare for handler in self.localhandlers: AttributeError: 'Tinfoil' object has no attribute 'localhandlers'. Did you mean: 'oldhandlers'? Signed-off-by: Peter Kjellerstedt --- PATCHv2: New in this patch set. bitbake/lib/bb/tinfoil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index 2200caa54c..dcd3910cc4 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py @@ -325,11 +325,11 @@ class Tinfoil: self.recipes_parsed = False self.quiet = 0 self.oldhandlers = self.logger.handlers[:] + self.localhandlers = [] if setup_logging: # This is the *client-side* logger, nothing to do with # logging messages from the server bb.msg.logger_create('BitBake', output) - self.localhandlers = [] for handler in self.logger.handlers: if handler not in self.oldhandlers: self.localhandlers.append(handler) From patchwork Mon Sep 25 01:25:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 31073 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 EA3AACE7A8B for ; Mon, 25 Sep 2023 01:25:16 +0000 (UTC) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by mx.groups.io with SMTP id smtpd.web10.52172.1695605111217766162 for ; Sun, 24 Sep 2023 18:25:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=nDBf1tkK; spf=pass (domain: axis.com, ip: 195.60.68.17, mailfrom: peter.kjellerstedt@axis.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1695605112; x=1727141112; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=stQ9KOrMsYJFNP8x/bsnumdeiqP5ajLGrU0FHk3oons=; b=nDBf1tkKbCDHk8tJxVGkXkDfM4p8mggVuVnzwdzTxnVHxLesndWV4bHQ pKgC4bI1KxKyFN6gHP5sPGITanbxqkyccbOp4EuByWPQ3f3GPKayBRxi0 hD7YDXORcfP5hh/sNnBMPl4F2bTiryc7/eoEZIubtRRO2qroLocmbZoHQ kL0G4Vnh0BIAEtW/3mpSfkyC1ZWAWxf/EUQA1uRR5giybEOSB9DcmLRKz pbbfQnD1ygmKWzarLqOHZQVRQ8UGwZDrR/WBobH2XP+PiRdChX//pQiUs ExwFiBLo9NqxYMtqQKddANZ4Ho2dAfF27L1WhygAL6pTLjJqZNuyzwrvu A==; From: Peter Kjellerstedt To: Subject: [PATCHv2 2/3] bitbake-getvar: Make --quiet work with --recipe Date: Mon, 25 Sep 2023 03:25:01 +0200 Message-ID: <20230925012502.770037-2-pkj@axis.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230925012502.770037-1-pkj@axis.com> References: <20230925012502.770037-1-pkj@axis.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 ; Mon, 25 Sep 2023 01:25:16 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15108 Initializing Tinfoil with setup_logging = False only has an effect when recipe parsing is not needed. To make it work regardless of if --recipe is used, manipulate the quiet parameter to Tinfoil.prepare() instead. Signed-off-by: Peter Kjellerstedt --- PATCHv2: New in this patch set. bitbake/bin/bitbake-getvar | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bitbake/bin/bitbake-getvar b/bitbake/bin/bitbake-getvar index 4a9eb4f311..40bf3dc620 100755 --- a/bitbake/bin/bitbake-getvar +++ b/bitbake/bin/bitbake-getvar @@ -36,12 +36,13 @@ if __name__ == "__main__": print("--flag only makes sense with --value") sys.exit(1) - with bb.tinfoil.Tinfoil(tracking=True, setup_logging=not args.quiet) as tinfoil: + quiet = args.quiet + with bb.tinfoil.Tinfoil(tracking=True) as tinfoil: if args.recipe: - tinfoil.prepare(quiet=2) + tinfoil.prepare(quiet=3 if quiet else 2) d = tinfoil.parse_recipe(args.recipe) else: - tinfoil.prepare(quiet=2, config_only=True) + tinfoil.prepare(quiet=3 if quiet else 2, config_only=True) d = tinfoil.config_data if args.flag: print(str(d.getVarFlag(args.variable, args.flag, expand=(not args.unexpand)))) From patchwork Mon Sep 25 01:25:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 31074 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 E3C3CCE7A91 for ; Mon, 25 Sep 2023 01:25:16 +0000 (UTC) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by mx.groups.io with SMTP id smtpd.web10.52172.1695605111217766162 for ; Sun, 24 Sep 2023 18:25:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=J0qLPh8M; spf=pass (domain: axis.com, ip: 195.60.68.17, mailfrom: peter.kjellerstedt@axis.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1695605113; x=1727141113; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=bKc/wlWxiW0iWZe+MeUyw/BQoY8zOS+9TrAXyfQqBY0=; b=J0qLPh8Mk0Bg8wMQbJeSP5nHQT7u/IVUDiVG82LFb9SSk8uyVC5qkgq+ +aokCCPhxeNGSDV2CRyAbrN/AkRNeV3hZR19yofUs5rZc4ucSSH+1NQ3/ vx0fm29rXryCeoYaIcqFPJNRSW8M8VHAwOcee0RcUu7IxucBicxRbIIBs Kc6AlKGqc6Q3iC2psMiKcrSUyedwqDZDiAxYtPqCv8OZl+dCBqqi16RuO /AD4UUsJy8zs4PknnfRVsu9QaduZkzkVKQVT4PMSmPyoRPiS5Lf+6lkGr ZirIFg7sRRPpAyLC4yYlv7PdEgl14TEPUIlPzYCIWgh0ABENKaI0rTNuE Q==; From: Peter Kjellerstedt To: Subject: [PATCHv2 3/3] bitbake-getvar: Make --value imply --quiet Date: Mon, 25 Sep 2023 03:25:02 +0200 Message-ID: <20230925012502.770037-3-pkj@axis.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230925012502.770037-1-pkj@axis.com> References: <20230925012502.770037-1-pkj@axis.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 ; Mon, 25 Sep 2023 01:25:16 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15109 It does not make any sense to get log output from bitbake-getvar when the --value option is used as the log output is sent to stdout and thus interferes with the output of the variable's value. Signed-off-by: Peter Kjellerstedt --- PATCHv2: Adapted to the changes in the preceding commit. bitbake/bin/bitbake-getvar | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbake/bin/bitbake-getvar b/bitbake/bin/bitbake-getvar index 40bf3dc620..ed2dad63a2 100755 --- a/bitbake/bin/bitbake-getvar +++ b/bitbake/bin/bitbake-getvar @@ -36,7 +36,7 @@ if __name__ == "__main__": print("--flag only makes sense with --value") sys.exit(1) - quiet = args.quiet + quiet = args.quiet or args.value with bb.tinfoil.Tinfoil(tracking=True) as tinfoil: if args.recipe: tinfoil.prepare(quiet=3 if quiet else 2)