diff mbox series

[v2,05/10] bitbake-setup: fix are_layers_changed when use local source

Message ID 20260106121033.3892596-5-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: Anibal Limon <anibal@limonsoftware.com>

When use local source the git-remote isn't set causing exception because
takes repodir as default value.

Fixes:

```
NOTE: Looking up config ls-master in configuration registry
Traceback (most recent call last):
  File "/home/workspaces/ls/bitbake/bin/bitbake-setup", line 1042, in <module>
    main()
    ~~~~^^
  File "/home/workspaces/ls/bitbake/bin/bitbake-setup", line 1035, in main
    args.func(top_dir, all_settings, args, d)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/workspaces/ls/bitbake/bin/bitbake-setup", line 667, in build_update
    build_status(top_dir, settings, args, d, update=True)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/workspaces/ls/bitbake/bin/bitbake-setup", line 658, in build_status
    if are_layers_changed(current_upstream_config["data"]["sources"], layerdir, d):
       ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/workspaces/ls/bitbake/bin/bitbake-setup", line 627, in are_layers_changed
    changed = changed | _is_git_remote_changed(git_remote, repodir)
                        ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/home/workspaces/ls/bitbake/bin/bitbake-setup", line 601, in _is_git_remote_changed
    rev = r_remote['rev']
          ~~~~~~~~^^^^^^^
TypeError: string indices must be integers, not 'str'
```

Signed-off-by: Anibal Limon <anibal@limonsoftware.com>

Alex: remove the default '' value from get() as None is used otherwise, which is also suitable.

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

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 7c4fa1934..0d33f0896 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -625,7 +625,7 @@  def are_layers_changed(layers, layerdir, d):
         r_data = layers[r_name]
         repodir = r_data.get("path", r_name)
 
-        git_remote = r_data.get('git-remote', repodir)
+        git_remote = r_data.get('git-remote')
         if git_remote:
             changed = changed | _is_git_remote_changed(git_remote, repodir)