From patchwork Mon Sep 25 02:18:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 31077 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 7FB4DCE7A8B for ; Mon, 25 Sep 2023 02:18:47 +0000 (UTC) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by mx.groups.io with SMTP id smtpd.web10.52909.1695608318351341141 for ; Sun, 24 Sep 2023 19:18:38 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=VbHr+BBj; 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=1695608318; x=1727144318; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=yjF8Ce6YQH5QSWUD95AIG6dnX4Ehvqs7mNsN2W2EmYM=; b=VbHr+BBjgbhNA70QOICABjBDDy07o91F8souovbgr5GtSfUAU8ysok+q +K2HxhTJAj5SPQsJ6fRWTT6n+vARWvm5CzJrV7EUOCNF5I3dKQoTN1vMJ /FdFzmZnbnqU0+Dmh12GzMcXiWU6iTvffOYpTXjYcsPbbOD9irWLe0+LX zUax9YaDpQeB4t3v/SCQ81bUbIMxBUCIpX2OE4jTw/RVca1BbW+P6BN7O oDZn4WGFLs1pLxOMCHDM1pt9X7sgDuo5mIynnLyfHQD3xOAkTuzfmlhqG 5xJmXv+f5nsSRILdP6P9nwBsM6rBfgULKioJCFXSbWfNMVpHWuH6EbsFc g==; From: Peter Kjellerstedt To: Subject: [PATCHv3 1/3] tinfoil: Do not fail when logging is disabled and full config is used Date: Mon, 25 Sep 2023 04:18:31 +0200 Message-ID: <20230925021833.1303449-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 02:18:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15110 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. PATCHv3: No change. 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 02:18:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 31078 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 81D5ACE7A95 for ; Mon, 25 Sep 2023 02:18:47 +0000 (UTC) Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by mx.groups.io with SMTP id smtpd.web10.52909.1695608318351341141 for ; Sun, 24 Sep 2023 19:18:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=iv1yeMNE; 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=1695608319; x=1727144319; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ZOJ+iDkLnvIqY5iU1gqlmKJOuoBs+J/xse7dU1sDctY=; b=iv1yeMNESWDrth4DZJz1z/PH88tqAZsaCDQVR9WQyZTgNwNQDvCG8PQc ThwYt0M1FtEslVuCrvqQnTgZBtJPzoKUuFFRyZ1NhQk4sDOO/DJjU0IfW 1PQKVWw0ph3xXwFQOhypDLW45zU4zywrjeEpqFCvbshnbEklLBHDalqBW 42TMs0rxRZQBm/gmkcAbDXFP/7eV+TG3/SyhyApcQfw9j51vzcX4DFrdc p7EI61TR7KFgLYh1Pr3shXFruHoQfPpJ+gpczajQcshTOBHfDsctmrMop ++ijm5KaGlIs3Vbp/oZt1GsI+qFRsJjs6Z4tBnfeAkijkgp5Z/ezPLo4O g==; From: Peter Kjellerstedt To: Subject: [PATCHv3 2/3] bitbake-getvar: Make --quiet work with --recipe Date: Mon, 25 Sep 2023 04:18:32 +0200 Message-ID: <20230925021833.1303449-2-pkj@axis.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230925021833.1303449-1-pkj@axis.com> References: <20230925021833.1303449-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 02:18:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15111 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. PATCHv3: Apparently setup_logging still needs to be configured when config_only=True... bitbake/bin/bitbake-getvar | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bitbake/bin/bitbake-getvar b/bitbake/bin/bitbake-getvar index 4a9eb4f311..13a317e1d6 100755 --- a/bitbake/bin/bitbake-getvar +++ b/bitbake/bin/bitbake-getvar @@ -36,9 +36,10 @@ 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, setup_logging=not quiet) 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) From patchwork Mon Sep 25 02:18:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Kjellerstedt X-Patchwork-Id: 31076 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 80AA2CE7A94 for ; Mon, 25 Sep 2023 02:18:47 +0000 (UTC) Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by mx.groups.io with SMTP id smtpd.web10.52911.1695608320280432287 for ; Sun, 24 Sep 2023 19:18:40 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@axis.com header.s=axis-central1 header.b=IymbNvfS; spf=pass (domain: axis.com, ip: 195.60.68.18, 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=1695608321; x=1727144321; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ojKOiXKEZevmOjOo/OHI8f/VxY/8EymTXrNtSpRF6aI=; b=IymbNvfS1eCFoLp/tXpH0b5xRuV4k9e14GWAjOMQwijI0VCg6/jxrItX J6DxBMK4c1ZP3MYl5XKIVeKHZMPHnHH6qbe914j17G7Vs30xPFPJJS/Ah FfLErS08uekciZ2jpq6sp7o8oEeIAutMrK2jxZqx8YYLwouRICbrbDEYq ZJcyro6JhOdeC3bvnSwTQNmbaYyVrAN4OuEBSHhdSf89jXCcQJyThI0XD X5MqmtPK6A+yvvkN99NAoGm1Ag8rEZlJm99xIkp3Hg4Ds5ZcGb44SIHC8 ByWXRpm6qhHu7aI0f/IqSGZQb/nKzmTrb8VOEgoUTjlMb4glPPiOUGPjn g==; From: Peter Kjellerstedt To: Subject: [PATCHv3 3/3] bitbake-getvar: Make --value imply --quiet Date: Mon, 25 Sep 2023 04:18:33 +0200 Message-ID: <20230925021833.1303449-3-pkj@axis.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230925021833.1303449-1-pkj@axis.com> References: <20230925021833.1303449-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 02:18:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15112 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. PATCHv3: No change. 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 13a317e1d6..afd2849846 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, setup_logging=not quiet) as tinfoil: if args.recipe: tinfoil.prepare(quiet=3 if quiet else 2)