diff mbox series

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

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

Commit Message

Alexander Kanavin Jan. 2, 2026, 7:34 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(-)

Comments

Anibal Limon Jan. 2, 2026, 11:09 p.m. UTC | #1
Just hit the case fixed by this commit,

...
  File "/workspaces/ls/bitbake/bin/bitbake-setup", line 121, in
_has_local_modifications
    fixed_revisions = json.load(open(os.path.join(layerdir,
"sources-fixed-revisions.json")))
FileNotFoundError: [Errno 2] No such file or directory:
'/workspaces/ls/bitbake-setup/ls-master/stm32-sdk-stm32h503/la
yers/sources-fixed-revisions.json
...

Thanks!,
Anibal

On Fri, Jan 2, 2026 at 1:34 PM Alexander Kanavin via lists.openembedded.org
<alex.kanavin=gmail.com@lists.openembedded.org> wrote:

> 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 --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=''):
> --
> 2.47.3
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#18678):
> https://lists.openembedded.org/g/bitbake-devel/message/18678
> Mute This Topic: https://lists.openembedded.org/mt/117046548/8181911
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [
> anibal@limonsoftware.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Alexander Kanavin Jan. 3, 2026, 9:38 a.m. UTC | #2
On Sat, 3 Jan 2026 at 00:09, Anibal Limon <anibal@limonsoftware.com> wrote:
>
> Just hit the case fixed by this commit,
>
> ...
>   File "/workspaces/ls/bitbake/bin/bitbake-setup", line 121, in _has_local_modifications
>     fixed_revisions = json.load(open(os.path.join(layerdir, "sources-fixed-revisions.json")))
> FileNotFoundError: [Errno 2] No such file or directory: '/workspaces/ls/bitbake-setup/ls-master/stm32-sdk-stm32h503/la
> yers/sources-fixed-revisions.json
> ...

No, this is an issue with the patchset. The _has_local_modifications()
function expects the file in layers/ but the file is only there if the
build was set up by a version of bitbake-setup that has the patchset.
So bitbake-setup needs to read the file from config/ to maintain
compatibility with existing version in master. I'll come up with a
fixup.

Alex
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=''):