From patchwork Thu Aug 24 08:31:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Niebel X-Patchwork-Id: 29415 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 AAB77C7113B for ; Thu, 24 Aug 2023 09:00:04 +0000 (UTC) Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by mx.groups.io with SMTP id smtpd.web10.6523.1692865909267050982 for ; Thu, 24 Aug 2023 01:31:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@tq-group.com header.s=key1 header.b=H5rcMVw5; spf=pass (domain: ew.tq-group.com, ip: 93.104.207.81, mailfrom: markus.niebel@ew.tq-group.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1692865909; x=1724401909; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=kTReOQk4FKrvM6K4zsLaAzj5mRjFikYZ/ZYjawwq5UI=; b=H5rcMVw5T5wnQflqTBoWKeUsPElY167OLL7qarHNBQ9RCMFPVBlVUAab iFc2J5Z29Ii1lQyKkkj744BT0t8M/pLeZCcgETMND1kldaz5Q/4Mmz7Mh nosR6wGfufMII27Axzh8AVdqJBIAaRr6b0n9c1Y+0bo2J5RS2jAsB+T9s JXYiJnCs3rfWFl55Nhj1eeemnUdhmGYmlGJ/kjFt9pOHvpGM0o/fhY+Un ZXwrhoABWiKrVPwtwakKdB+rTShqA4yGboDlqoQUqBOX+cfOX88/lxXHJ mSShgHMLVzfzaFnwOEBjfeCYqonB8AsiNUKtKRuTDYN0/HTw94KK4UpNV Q==; X-IronPort-AV: E=Sophos;i="6.01,195,1684792800"; d="scan'208";a="32603113" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 24 Aug 2023 10:31:45 +0200 Received: from NIEBEL-W3.tq-net.de (NIEBEL-W3.tq-net.de [10.123.53.155]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id AFC0C280075; Thu, 24 Aug 2023 10:31:45 +0200 (CEST) From: "Markus Niebel" To: bitbake-devel@lists.openembedded.org Cc: oss@ew.tq-group.com, Paulo Neves , Alexandre Belloni , Markus Niebel Subject: [kirkstone][2.0][PATCH] bitbake-getvar: Add a quiet command line argument Date: Thu, 24 Aug 2023 10:31:09 +0200 Message-Id: <20230824083109.1821425-1-Markus.Niebel@ew.tq-group.com> X-Mailer: git-send-email 2.25.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 ; Thu, 24 Aug 2023 09:00:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/14972 From: Paulo Neves bitbake-getvar does not have a way to silence bitbake server's logger and that makes the tool hard to use for text processing. This is especially true when one wants to get a bitbake value to be piped to some other utility and instead we get uncontrolled logging messages or warnings together with bitbake's variable value. Example without quiet: bitbake-getvar --value MACHINE NOTE: Starting bitbake server... qemux86-64 With quiet: bitbake-getvar --value MACHINE --quiet qemux86-64 Signed-off-by: Paulo Neves Signed-off-by: Alexandre Belloni (cherry picked from commit af354e975d0b4c26d0e91e3c82946b093bc11b45) Signed-off-by: Markus Niebel --- bin/bitbake-getvar | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/bitbake-getvar b/bin/bitbake-getvar index 5435a8d7..4a9eb4f3 100755 --- a/bin/bitbake-getvar +++ b/bin/bitbake-getvar @@ -25,6 +25,7 @@ if __name__ == "__main__": parser.add_argument('-u', '--unexpand', help='Do not expand the value (with --value)', action="store_true") parser.add_argument('-f', '--flag', help='Specify a variable flag to query (with --value)', default=None) parser.add_argument('--value', help='Only report the value, no history and no variable name', action="store_true") + parser.add_argument('-q', '--quiet', help='Silence bitbake server logging', action="store_true") args = parser.parse_args() if args.unexpand and not args.value: @@ -35,7 +36,7 @@ if __name__ == "__main__": print("--flag only makes sense with --value") sys.exit(1) - with bb.tinfoil.Tinfoil(tracking=True) as tinfoil: + with bb.tinfoil.Tinfoil(tracking=True, setup_logging=not args.quiet) as tinfoil: if args.recipe: tinfoil.prepare(quiet=2) d = tinfoil.parse_recipe(args.recipe)