diff mbox series

[v2,1/3] bitbake-setup: ensure that config_id is always an absolute path

Message ID 20260309141238.1785102-1-alex.kanavin@gmail.com
State New
Headers show
Series [v2,1/3] bitbake-setup: ensure that config_id is always an absolute path | expand

Commit Message

Alexander Kanavin March 9, 2026, 2:12 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

If config_id (given on command line in 'init' operation) is provided and
interpreted as a relative path to a local file (by checking for the file
existence), it should be recorded into configuration instance as an absolute path.

Otherwise status/update operations will fail if executed from a different
directory that the template file was in, as they won't be able to find
the file.

Note that the patch context doesn't show where having the absolute path actually matters:
further down in the function, config_id is used to set a 'non-interactive-cmdline-options'
property in configuration instance dictionary. This property is used by status/update
operations.

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

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index bdf134aea..54f2015a2 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -600,9 +600,10 @@  def obtain_config(top_dir, registry, args, source_overrides, d):
         config_id = args.config[0]
         config_parameters = args.config[1:]
         if os.path.exists(config_id):
+            config_id = os.path.abspath(config_id)
             logger.info("Reading configuration from local file\n    {}".format(config_id))
             upstream_config = {'type':'local',
-                               'path':os.path.abspath(config_id),
+                               'path':config_id,
                                'name':get_config_name(config_id),
                                'data':json.load(open(config_id))
                                }