diff mbox series

[bitbake-devel] bitbake-setup: Do not override site.conf if it already exists

Message ID 20251111172505.2838669-1-JPEWhacker@gmail.com
State New
Headers show
Series [bitbake-devel] bitbake-setup: Do not override site.conf if it already exists | expand

Commit Message

Joshua Watt Nov. 11, 2025, 5:25 p.m. UTC
Overriding site.conf each time bitbake-setup is run is highly annoying
to users, since the intention is to have site specific configuration
that is common across all builds.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 bin/bitbake-setup | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 86c556944..282fa82ff 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -672,19 +672,18 @@  def install_buildtools(top_dir, settings, args, d):
 
 def create_siteconf(top_dir, non_interactive=True):
     siteconfpath = os.path.join(top_dir, 'site.conf')
-    print('A common site.conf file will be created, please edit or replace before running builds\n    {}\n'.format(siteconfpath))
-    if not non_interactive:
-        y_or_n = input('Proceed? (y/N): ')
-        if y_or_n != 'y':
-            exit()
-
-    os.makedirs(os.path.dirname(top_dir), exist_ok=True)
     if os.path.exists(siteconfpath):
-        backup_siteconf = siteconfpath + "-backup.{}".format(time.strftime("%Y%m%d%H%M%S"))
-        os.rename(siteconfpath, backup_siteconf)
-        print("Previous settings are in {}".format(backup_siteconf))
-    with open(siteconfpath, 'w') as siteconffile:
-        siteconffile.write('# This file is intended for build host-specific bitbake settings\n')
+        print('A site.conf file already exists. Please remove it if you would like to replace it with a default one')
+    else:
+        print('A common site.conf file will be created, please edit or replace before running builds\n    {}\n'.format(siteconfpath))
+        if not non_interactive:
+            y_or_n = input('Proceed? (y/N): ')
+            if y_or_n != 'y':
+                exit()
+
+        os.makedirs(os.path.dirname(top_dir), exist_ok=True)
+        with open(siteconfpath, 'w') as siteconffile:
+            siteconffile.write('# This file is intended for build host-specific bitbake settings\n')
 
 def topdir_settings_path(top_dir):
     return os.path.join(top_dir, 'settings.conf')