diff mbox series

[3/3] bitbake-setup: add information about enabling fragments to toolcfg.conf, tool output and written-out README

Message ID 20251119124832.3906214-3-alex.kanavin@gmail.com
State New
Headers show
Series [1/3] bitbake-setup: Tell the user what to do if they don't like the top dir | expand

Commit Message

Alexander Kanavin Nov. 19, 2025, 12:48 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

Also adjust the order of those pieces to be more logical, and tweak
the newlines so that each item is separated by a single newline
from the previous and next ones.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bin/bitbake-setup | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index b331eac53..a8da10e4f 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -259,6 +259,12 @@  def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_c
     shell = "bash"
     fragments = bitbake_config.get("oe-fragments", []) + sorted(bitbake_config.get("oe-fragment-choices",{}).values())
     if fragments:
+        toolcfg_file = os.path.join(bitbake_builddir,'conf/toolcfg.conf')
+        toolcfg_comment = """# Run 'bitbake-config-build enable-fragment <fragment-name>' to enable additional fragments
+# or replace built-in ones (e.g. machine/<name> or distro/<name> to change MACHINE or DISTRO).
+"""
+        with open(toolcfg_file, 'w') as f:
+            f.write(toolcfg_comment)
         bb.process.run("{} -c '. {} && bitbake-config-build enable-fragment {}'".format(shell, init_script, " ".join(fragments)))
 
     if os.path.exists(backup_bitbake_confdir):
@@ -287,23 +293,29 @@  def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_c
         print('Applying upstream bitbake configuration changes')
         print(f'Leaving the previous configuration in {backup_bitbake_confdir}')
 
-    print("This bitbake configuration provides:\n    {}\n".format(bitbake_config["description"]))
+    fragment_note = "Run 'bitbake-config-build enable-fragment <fragment-name>' to enable additional fragments or replace built-in ones (e.g. machine/<name> or distro/<name> to change MACHINE or DISTRO)."
+
     readme = """{}\n\nAdditional information is in {} and {}\n
-Source the environment using '. {}' to run builds from the command line.
+Source the environment using '. {}' to run builds from the command line.\n
+{}\n
 The bitbake configuration files (local.conf, bblayers.conf and more) can be found in {}/conf
 """.format(
         bitbake_config["description"],
         os.path.join(bitbake_builddir,'conf/conf-summary.txt'),
         os.path.join(bitbake_builddir,'conf/conf-notes.txt'),
         init_script,
+        fragment_note,
         bitbake_builddir
         )
     readme_file = os.path.join(bitbake_builddir, "README")
     with open(readme_file, 'w') as f:
         f.write(readme)
+
+    print("This bitbake configuration provides:\n    {}\n".format(bitbake_config["description"]))
     print("Usage instructions and additional information are in\n     {}\n".format(readme_file))
+    print("To run builds, source the environment using\n    . {}\n".format(init_script))
+    print("{}\n".format(fragment_note))
     print("The bitbake configuration files (local.conf, bblayers.conf and more) can be found in\n    {}/conf\n".format(bitbake_builddir))
-    print("To run builds, source the environment using\n    . {}".format(init_script))
 
 def get_registry_config(registry_path, id):
     for root, dirs, files in os.walk(registry_path):