From patchwork Wed Dec 3 12:15:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 75794 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 9AC29D12D56 for ; Wed, 3 Dec 2025 12:15:56 +0000 (UTC) Received: from smtp-bc0d.mail.infomaniak.ch (smtp-bc0d.mail.infomaniak.ch [45.157.188.13]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.13673.1764764154957456209 for ; Wed, 03 Dec 2025 04:15:55 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: 0leil.net, ip: 45.157.188.13, mailfrom: foss+yocto@0leil.net) Received: from smtp-4-0000.mail.infomaniak.ch (smtp-4-0000.mail.infomaniak.ch [10.7.10.107]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4dLxS92YTZz3YC; Wed, 3 Dec 2025 13:15:53 +0100 (CET) Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4dLxS86lJnzZJ0; Wed, 3 Dec 2025 13:15:52 +0100 (CET) From: Quentin Schulz Date: Wed, 03 Dec 2025 13:15:41 +0100 Subject: [PATCH 1/3] bitbake-setup: allow to pass a prompt to int_input MIME-Version: 1.0 Message-Id: <20251203-bitbake-setup-input-consistent-v1-1-3c7e6edecd57@cherry.de> References: <20251203-bitbake-setup-input-consistent-v1-0-3c7e6edecd57@cherry.de> In-Reply-To: <20251203-bitbake-setup-input-consistent-v1-0-3c7e6edecd57@cherry.de> To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin , Quentin Schulz X-Mailer: b4 0.14.3 X-Infomaniak-Routing: alpha List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 03 Dec 2025 12:15:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18524 From: Quentin Schulz This will allow us to have consistency between expected user inputs by having them all doing something along the lines of: Type number: 2 instead of Type number: 2 This migrates the retry prompts to use that new mechanism. Signed-off-by: Quentin Schulz --- bin/bitbake-setup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 75be90940..54faa7e30 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -330,16 +330,16 @@ def update_build(config, confdir, setupdir, layerdir, d, update_bb_conf="prompt" setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_conf) write_sources_fixed_revisions(confdir, sources_fixed_revisions) -def int_input(allowed_values): +def int_input(allowed_values, prompt=''): n = None while n is None: try: - n = int(input()) + n = int(input(prompt)) except ValueError: - print('Not a valid number, please try again:') + prompt = 'Not a valid number, please try again: ' continue if n not in allowed_values: - print('Number {} not one of {}, please try again:'.format(n, allowed_values)) + prompt = 'Number {} not one of {}, please try again: '.format(n, allowed_values) n = None return n From patchwork Wed Dec 3 12:15:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 75795 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 A6E32D12D58 for ; Wed, 3 Dec 2025 12:15:56 +0000 (UTC) Received: from smtp-8fad.mail.infomaniak.ch (smtp-8fad.mail.infomaniak.ch [83.166.143.173]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.13674.1764764155355231387 for ; Wed, 03 Dec 2025 04:15:55 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: 0leil.net, ip: 83.166.143.173, mailfrom: foss+yocto@0leil.net) Received: from smtp-4-0000.mail.infomaniak.ch (unknown [IPv6:2001:1600:7:10::a6b]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4dLxS96W9Mz235; Wed, 3 Dec 2025 13:15:53 +0100 (CET) Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4dLxS93HgczbYq; Wed, 3 Dec 2025 13:15:53 +0100 (CET) From: Quentin Schulz Date: Wed, 03 Dec 2025 13:15:42 +0100 Subject: [PATCH 2/3] bitbake-setup: make all callers of int_input pass their prompt MIME-Version: 1.0 Message-Id: <20251203-bitbake-setup-input-consistent-v1-2-3c7e6edecd57@cherry.de> References: <20251203-bitbake-setup-input-consistent-v1-0-3c7e6edecd57@cherry.de> In-Reply-To: <20251203-bitbake-setup-input-consistent-v1-0-3c7e6edecd57@cherry.de> To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin , Quentin Schulz X-Mailer: b4 0.14.3 X-Infomaniak-Routing: alpha List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 03 Dec 2025 12:15:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18525 From: Quentin Schulz This aligns the behavior of int_input() with input() so that the user input is printed on the same line as the prompt. Signed-off-by: Quentin Schulz --- bin/bitbake-setup | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 54faa7e30..7173fec1f 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -388,8 +388,8 @@ def choose_bitbake_config(configs, parameters, non_interactive): print("\nAvailable bitbake configurations:") for n, config_data in enumerated_configs: print("{}. {}\t{}".format(n, config_data["name"], config_data["description"])) - print("\nPlease select one of the above bitbake configurations by its number:") - config_n = int_input([i[0] for i in enumerated_configs]) - 1 + config_n = int_input([i[0] for i in enumerated_configs], + "\nPlease select one of the above bitbake configurations by its number: ") - 1 return flattened_configs[config_n] def choose_config(configs, non_interactive): @@ -412,8 +412,8 @@ def choose_config(configs, non_interactive): print("{}. {}\t{} (supported until {})".format(n, config_name, config_desc, expiry_date)) else: print("{}. {}\t{}".format(n, config_name, config_desc)) - print("\nPlease select one of the above configurations by its number:") - config_n = int_input([i[0] for i in config_list]) - 1 + config_n = int_input([i[0] for i in config_list], + "\nPlease select one of the above configurations by its number: ") - 1 return config_list[config_n][1] def choose_fragments(possibilities, parameters, non_interactive, skip_selection): @@ -436,8 +436,8 @@ def choose_fragments(possibilities, parameters, non_interactive, skip_selection) options_enumerated = list(enumerate(v["options"], 1)) for n,o in options_enumerated: print("{}. {}".format(n, o)) - print("\nPlease select one of the above options by its number:") - option_n = int_input([i[0] for i in options_enumerated]) - 1 + option_n = int_input([i[0] for i in options_enumerated], + "\nPlease select one of the above options by its number: ") - 1 choices[k] = options_enumerated[option_n][1] return choices From patchwork Wed Dec 3 12:15:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 75793 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 95EECD12D55 for ; Wed, 3 Dec 2025 12:15:56 +0000 (UTC) Received: from smtp-190d.mail.infomaniak.ch (smtp-190d.mail.infomaniak.ch [185.125.25.13]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.13675.1764764155845126817 for ; Wed, 03 Dec 2025 04:15:56 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: 0leil.net, ip: 185.125.25.13, mailfrom: foss+yocto@0leil.net) Received: from smtp-4-0000.mail.infomaniak.ch (unknown [IPv6:2001:1600:7:10::a6b]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4dLxSB2wdsz3jM; Wed, 3 Dec 2025 13:15:54 +0100 (CET) Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4dLxS96wZrzblW; Wed, 3 Dec 2025 13:15:53 +0100 (CET) From: Quentin Schulz Date: Wed, 03 Dec 2025 13:15:43 +0100 Subject: [PATCH 3/3] bitbake-setup: put colon of prompt after suggested default MIME-Version: 1.0 Message-Id: <20251203-bitbake-setup-input-consistent-v1-3-3c7e6edecd57@cherry.de> References: <20251203-bitbake-setup-input-consistent-v1-0-3c7e6edecd57@cherry.de> In-Reply-To: <20251203-bitbake-setup-input-consistent-v1-0-3c7e6edecd57@cherry.de> To: bitbake-devel@lists.openembedded.org Cc: Alexander Kanavin , Quentin Schulz X-Mailer: b4 0.14.3 X-Infomaniak-Routing: alpha List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 03 Dec 2025 12:15:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18526 From: Quentin Schulz Otherwise it differs from other input prompts we have and it's not really clear whether anything is expected from the user. Signed-off-by: Quentin Schulz --- Also wondering if we shouldn't switch to () instead of [] for surrounding the default value if no input is provided by the user --- bin/bitbake-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 7173fec1f..ecfcd677a 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -514,7 +514,7 @@ def init_config(top_dir, settings, args): setup_dir_name = config_setup_dir_name if not args.non_interactive: - n = input(f"Enter setup directory name: [{setup_dir_name}] ") + n = input(f"Enter setup directory name [{setup_dir_name}]: ") if n: setup_dir_name = n