From patchwork Fri Sep 12 20:45:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Eatmon X-Patchwork-Id: 70104 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 9460ECAC592 for ; Fri, 12 Sep 2025 20:46:06 +0000 (UTC) Received: from fllvem-ot04.ext.ti.com (fllvem-ot04.ext.ti.com [198.47.19.246]) by mx.groups.io with SMTP id smtpd.web11.1169.1757709961323042971 for ; Fri, 12 Sep 2025 13:46:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=G2ORGB61; spf=pass (domain: ti.com, ip: 198.47.19.246, mailfrom: reatmon@ti.com) Received: from fllvem-sh04.itg.ti.com ([10.64.41.54]) by fllvem-ot04.ext.ti.com (8.15.2/8.15.2) with ESMTP id 58CKk0871045520 for ; Fri, 12 Sep 2025 15:46:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1757709960; bh=tGCxaWp3GSWqAis9wxdN8ooi2JJWRT51fWhzIUhuCdo=; h=From:To:Subject:Date; b=G2ORGB619BwW0qL7MU+8bXOj0wOOTudw7LUns4K1CsP687Jr6NEB6eOTglOxbbVY0 qeOPPs72rKm9v/QOCc1q31Ymg5Z59IjRGT9HXTZMiOkRvIrOMnZAtwmokUZiOME+F6 IBM789RVsClBuMn8PWMvm2xAGTMZpXv4wM4sYajU= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllvem-sh04.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 58CKk06u3032728 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL) for ; Fri, 12 Sep 2025 15:46:00 -0500 Received: from DFLE213.ent.ti.com (10.64.6.71) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55; Fri, 12 Sep 2025 15:46:00 -0500 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DFLE213.ent.ti.com (10.64.6.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Fri, 12 Sep 2025 15:46:00 -0500 Received: from uda0214219 (uda0214219.dhcp.ti.com [128.247.81.222]) by lelvem-mr05.itg.ti.com (8.18.1/8.18.1) with ESMTP id 58CKk0Il273149 for ; Fri, 12 Sep 2025 15:46:00 -0500 Received: from reatmon by uda0214219 with local (Exim 4.90_1) (envelope-from ) id 1uxAed-0002hp-UU for bitbake-devel@lists.openembedded.org; Fri, 12 Sep 2025 15:46:00 -0500 From: Ryan Eatmon To: Subject: [bitbake][PATCH 1/3] bitbake-setup: Tweak user inputs Date: Fri, 12 Sep 2025 15:45:57 -0500 Message-ID: <20250912204559.10360-1-reatmon@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea 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 ; Fri, 12 Sep 2025 20:46:06 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18014 Create a common function to get the user input when choosing an item from a list. Add support for not returning from the function until the user has selected a number. When choosing items from the option list, if there is only one item, then auto select it. This is similar to code when picking the configuration. Signed-off-by: Ryan Eatmon --- bin/bitbake-setup | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index dc2de30a8..36103f1e8 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -252,6 +252,14 @@ def flatten_bitbake_configs(configs): flattened_configs.append(merge_configs(c, sub_c)) return flattened_configs +def get_user_input(prompt): + choice_s = '' + while choice_s.isdigit() == False: + print("\n{}:".format(prompt)) + choice_s = input() + choice_n = int(choice_s) + return choice_n + def choose_bitbake_config(configs, parameters, non_interactive): flattened_configs = flatten_bitbake_configs(configs) configs_dict = {i["name"]:i for i in flattened_configs} @@ -274,8 +282,7 @@ 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()) + config_n = get_user_input('Please select one of the above bitbake configurations by its number') return flattened_configs[config_n] def choose_config(configs, non_interactive): @@ -298,8 +305,7 @@ 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()) + config_n = get_user_input('Please select one of the above configurations by its number') return config_list[config_n][1] def choose_fragments(possibilities, parameters, non_interactive): @@ -317,10 +323,16 @@ def choose_fragments(possibilities, parameters, non_interactive): print("\n" + v["description"] + ":") options_enumerated = list(enumerate(v["options"])) + + if len(options_enumerated) == 1: + only_config = options_enumerated[0] + print("\nSelecting the only available option {}".format(only_config)) + choices[k] = options_enumerated[only_config[0]][1] + continue + 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()) + option_n = get_user_input('Please select one of the above options by its number') choices[k] = options_enumerated[option_n][1] return choices From patchwork Fri Sep 12 20:45:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Eatmon X-Patchwork-Id: 70102 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 95F1ACAC582 for ; Fri, 12 Sep 2025 20:46:06 +0000 (UTC) Received: from lelvem-ot02.ext.ti.com (lelvem-ot02.ext.ti.com [198.47.23.235]) by mx.groups.io with SMTP id smtpd.web11.1171.1757709961521459772 for ; Fri, 12 Sep 2025 13:46:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FIdJfIpq; spf=pass (domain: ti.com, ip: 198.47.23.235, mailfrom: reatmon@ti.com) Received: from lelvem-sh02.itg.ti.com ([10.180.78.226]) by lelvem-ot02.ext.ti.com (8.15.2/8.15.2) with ESMTP id 58CKk0dI1106423 for ; Fri, 12 Sep 2025 15:46:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1757709960; bh=4XH5ibqzhkQEhgZ43mrtKZwVAYz4+HWn5o4r/t5Olm0=; h=From:To:Subject:Date:In-Reply-To:References; b=FIdJfIpqoAEioTUdO+Sp/6j/N0Ab2uGYmszfTaaxG26ecktSu7ub23Lqt5AFWJ2vP uws+1KhYnZsU4J8GoW6687qYTmBXPRWp6/pFRX9ML3K/mx5zNU9KQLWY9Gdr0kTYMx S35Hy0vw1bGHP8LrFK8Qtqk+Qe8FAWr/O9j0m0rg= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelvem-sh02.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 58CKk0Iq2111153 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL) for ; Fri, 12 Sep 2025 15:46:00 -0500 Received: from lewvowa02.ent.ti.com (10.180.75.80) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55; Fri, 12 Sep 2025 15:46:00 -0500 Received: from DLEE215.ent.ti.com (157.170.170.118) by lewvowa02.ent.ti.com (10.180.75.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.55; Fri, 12 Sep 2025 15:46:00 -0500 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DLEE215.ent.ti.com (157.170.170.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Fri, 12 Sep 2025 15:46:00 -0500 Received: from uda0214219 (uda0214219.dhcp.ti.com [128.247.81.222]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 58CKk0OC4164887 for ; Fri, 12 Sep 2025 15:46:00 -0500 Received: from reatmon by uda0214219 with local (Exim 4.90_1) (envelope-from ) id 1uxAee-0002hs-2v for bitbake-devel@lists.openembedded.org; Fri, 12 Sep 2025 15:46:00 -0500 From: Ryan Eatmon To: Subject: [bitbake][PATCH 2/3] bitbake-setup: Fix extracting config name Date: Fri, 12 Sep 2025 15:45:58 -0500 Message-ID: <20250912204559.10360-2-reatmon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20250912204559.10360-1-reatmon@ti.com> References: <20250912204559.10360-1-reatmon@ti.com> MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea 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 ; Fri, 12 Sep 2025 20:46:06 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18016 When extracting the config name from from the filename, just splitting on . does not allow for . in the config name. For example: coresdk-11.01.08-config.json -> coresdk-11 when it should be: coresdk-11.01.08-config.json -> coresdk-11.01.08-config os.path.splitext() already does this logic correctly, so use that instead. Signed-off-by: Ryan Eatmon --- bin/bitbake-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 36103f1e8..342251bd5 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -50,7 +50,7 @@ def save_bb_cache(): bb.fetch2.fetcher_parse_done() def get_config_name(config): - return os.path.basename(config).split('.')[0] + return os.path.splitext(os.path.basename(config))[0] def write_config(config, config_dir): with open(os.path.join(config_dir, "config-upstream.json"),'w') as s: From patchwork Fri Sep 12 20:45:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Eatmon X-Patchwork-Id: 70103 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 93751CA101F for ; Fri, 12 Sep 2025 20:46:06 +0000 (UTC) Received: from fllvem-ot04.ext.ti.com (fllvem-ot04.ext.ti.com [198.47.19.246]) by mx.groups.io with SMTP id smtpd.web11.1170.1757709961337295659 for ; Fri, 12 Sep 2025 13:46:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lweaf7+N; spf=pass (domain: ti.com, ip: 198.47.19.246, mailfrom: reatmon@ti.com) Received: from lelvem-sh01.itg.ti.com ([10.180.77.71]) by fllvem-ot04.ext.ti.com (8.15.2/8.15.2) with ESMTP id 58CKk0gS1045522 for ; Fri, 12 Sep 2025 15:46:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1757709960; bh=jxyB1NRy7mmXrHliXJcxaxpa/eRSEvx1qtTKNLbPzrI=; h=From:To:Subject:Date:In-Reply-To:References; b=lweaf7+N/Pbf8J4MweOtfqGbZItn3TWN8xhRz8H6ohMrvyVGLCTqblIuuC3fV8hW+ xilxLeHLzjy+yHuwXQ/e5CBillw2rBlIL1Icvsnd0hSyOnurvMrHDDtzCbBuMwAgmE +eQ1BEpef3DjbuknWl8eKo94SuSs98giryKDmog0= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelvem-sh01.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 58CKk0741553821 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL) for ; Fri, 12 Sep 2025 15:46:00 -0500 Received: from DLEE209.ent.ti.com (157.170.170.98) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55; Fri, 12 Sep 2025 15:46:00 -0500 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DLEE209.ent.ti.com (157.170.170.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Fri, 12 Sep 2025 15:46:00 -0500 Received: from uda0214219 (uda0214219.dhcp.ti.com [128.247.81.222]) by lelvem-mr05.itg.ti.com (8.18.1/8.18.1) with ESMTP id 58CKk0sA273155 for ; Fri, 12 Sep 2025 15:46:00 -0500 Received: from reatmon by uda0214219 with local (Exim 4.90_1) (envelope-from ) id 1uxAee-0002hu-6B for bitbake-devel@lists.openembedded.org; Fri, 12 Sep 2025 15:46:00 -0500 From: Ryan Eatmon To: Subject: [bitbake][PATCH 3/3] bitbake-setup: Add --build-dir-style to init Date: Fri, 12 Sep 2025 15:45:59 -0500 Message-ID: <20250912204559.10360-3-reatmon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20250912204559.10360-1-reatmon@ti.com> References: <20250912204559.10360-1-reatmon@ti.com> MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea 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 ; Fri, 12 Sep 2025 20:46:06 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/18015 To allow for user control over the name of the build directory, add a new command line argument to the init function that allows you to choose from a list of options: flat - ---...- hier - ///.../ config - options - --...- Where the is the sequence of option choices configured in the json file. Signed-off-by: Ryan Eatmon --- bin/bitbake-setup | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 342251bd5..cce9dcc70 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -386,7 +386,15 @@ def init_config(settings, args, d): upstream_config = obtain_config(settings, args, source_overrides, d) print("\nRun 'bitbake-setup init --non-interactive {}' to select this configuration non-interactively.\n".format(" ".join(upstream_config['non-interactive-cmdline-options']))) - builddir = os.path.join(os.path.abspath(args.top_dir), "{}-{}".format(upstream_config['name']," ".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_"))) + if args.build_dir_style == "hier": + builddir = os.path.join(os.path.abspath(args.top_dir), "{}/{}".format(upstream_config['name'],"*slash*".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_").replace("*slash*","/"))) + elif args.build_dir_style == "config": + builddir = os.path.join(os.path.abspath(args.top_dir), "{}".format(upstream_config['name'])) + elif args.build_dir_style == "options": + builddir = os.path.join(os.path.abspath(args.top_dir), "{}".format(" ".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_"))) + else: + builddir = os.path.join(os.path.abspath(args.top_dir), "{}-{}".format(upstream_config['name']," ".join(upstream_config['non-interactive-cmdline-options'][1:]).replace(" ","-").replace("/","_"))) + if os.path.exists(builddir): print("Build already initialized in {}\nUse 'bitbake-setup status' to check if it needs to be updated or 'bitbake-setup update' to perform the update.".format(builddir)) return @@ -749,6 +757,7 @@ def main(): parser_init.add_argument('config', nargs='*', help="path/URL/id to a configuration file (use 'list' command to get available ids), followed by configuration options. Bitbake-setup will ask to choose from available choices if command line doesn't completely specify them.") parser_init.add_argument('--non-interactive', action='store_true', help='Do not ask to interactively choose from available options; if bitbake-setup cannot make a decision it will stop with a failure.') parser_init.add_argument('--source-overrides', action='store', help='Override sources information (repositories/revisions) with values from a local json file.') + parser_init.add_argument('--build-dir-style', action='store', default='flat', choices=['flat','hier','config','options'], help='Style to use for assembling the path to the build directory. Default is flat.') parser_init.set_defaults(func=init_config) parser_status = subparsers.add_parser('status', help='Check if the build needs to be synchronized with configuration')