From: Adrian Freihofer <[email protected]>

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 <[email protected]>
---
 scripts/lib/devtool/ide_sdk.py | 5 +++++
 1 file changed, 5 insertions(+)

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)',
-- 
2.55.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#245508): 
https://lists.openembedded.org/g/openembedded-core/message/245508
Mute This Topic: https://lists.openembedded.org/mt/121171404/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to