diff mbox series

[v2,08/10] bitbake-setup: symlink json with fixed revisions into layers/

Message ID 20260106121033.3892596-8-alex.kanavin@gmail.com
State New
Headers show
Series [v2,01/10] bitbake-setup: move the local source tests to the end | expand

Commit Message

Alexander Kanavin Jan. 6, 2026, 12:10 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

This makes the file more visible for users, and allows easier
checks of layers current content against what was checked out
by bitbake-setup (to ensure local modifications aren't wiped out).

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

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 0d33f0896..06255b112 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -69,11 +69,15 @@  def write_upstream_config(config_dir, config_data):
     with open(os.path.join(config_dir, "config-upstream.json"),'w') as s:
         json.dump(config_data, s, sort_keys=True, indent=4)
 
-def write_sources_fixed_revisions(config_dir, config_data):
+def write_sources_fixed_revisions(config_dir, layer_dir, config_data):
+    json_path = os.path.join(config_dir, "sources-fixed-revisions.json")
+    json_link = os.path.join(layer_dir, "sources-fixed-revisions.json")
     sources = {}
     sources['sources'] = config_data
     with open(os.path.join(config_dir, "sources-fixed-revisions.json"),'w') as s:
         json.dump(sources, s, sort_keys=True, indent=4)
+    if not os.path.lexists(json_link):
+        os.symlink(os.path.relpath(json_path ,layer_dir), json_link)
 
 def commit_config(config_dir):
     bb.process.run("git -C {} add .".format(config_dir))
@@ -344,7 +348,7 @@  def update_build(config, confdir, setupdir, layerdir, d, update_bb_conf="prompt"
     bitbake_config = config["bitbake-config"]
     thisdir = os.path.dirname(config["path"]) if config["type"] == 'local' else None
     setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_conf)
-    write_sources_fixed_revisions(confdir, sources_fixed_revisions)
+    write_sources_fixed_revisions(confdir, layerdir, sources_fixed_revisions)
     commit_config(confdir)
 
 def int_input(allowed_values, prompt=''):