diff mbox series

[14/15] devtool: ide-sdk: pin BBPATH in generated do_install script

Message ID 20260909215337.89106-15-adrian.freihofer@siemens.com
State New
Headers show
Series devtool ide-sdk: support booting from NFS, VSCode clangd | expand

Commit Message

AdrianF Sept. 9, 2026, 9:53 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

The generated bb_run_do_install script already os.chdir()s into the
recipe's build topdir before starting tinfoil, but that only covers the
fallback case: bb.cookerdata.findConfigFile() checks BBPATH entries for
conf/bblayers.conf before ever falling back to cwd. If BBPATH happens to
still be set in the caller's environment and points at another valid
build directory (e.g. a leftover from a sibling checkout), bitbake would
pick up that build's config instead of the intended one.

Set os.environ["BBPATH"] to the recipe's topdir alongside the chdir so
the generated script doesn't depend on the caller's environment being
clean.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 scripts/lib/devtool/ide_sdk.py | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py
index f9a92ac5ca..21442ce83b 100755
--- a/scripts/lib/devtool/ide_sdk.py
+++ b/scripts/lib/devtool/ide_sdk.py
@@ -1633,6 +1633,11 @@  class RecipeModified:
                           os.path.join(self.bitbakepath, '..', 'lib')),
                       'import bb.tinfoil',
                       'os.chdir(%r)' % self.topdir,
+                      # A stale BBPATH from the caller's environment (e.g. a
+                      # different, still-valid build dir) would otherwise take
+                      # precedence over cwd when bitbake looks for
+                      # conf/bblayers.conf (see bb.cookerdata.findConfigFile).
+                      'os.environ["BBPATH"] = %r' % self.topdir,
                       'tinfoil = bb.tinfoil.Tinfoil()',
                       'try:',
                       '    tinfoil.prepare(config_only=False, quiet=2)',