Bug 13822

Summary: Easy to have misleading warnings if env script is executed instead of sourced
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Richard Purdie <richard.purdie>
Component: coreAssignee: New Comer Bugs <newcomer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: akuster, ankur.tyagi85, dorindabassey, meta.mr.watcher, meta.watcher, randy.macleod
Version: 3.0   
Target Milestone: 3.3 M2   
Hardware: x86   
OS: Multiple   
Whiteboard: NEWCOMMER
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Richard Purdie 2020-03-02 23:10:35 UTC
If I user executes the environment script instead of sourcing it, they see errors about a "" element in PATH. This is because bitbake isn't present in PATH which breaks the PATH change in layer.conf.

We should add a sanity check for bitbake being present in PATH and error if not about the environment not being correct (did they source the script?).
Comment 1 Dorinda 2020-10-21 00:19:00 UTC
hi,
I want to work on this bug, but i need a little bit of clarity from your description, this means i should add a sanity check in the environment script for if bitbake is present in the path, and if they sourced the script?
Comment 2 Richard Purdie 2020-11-19 16:11:34 UTC
The intent here was to check PATH in sanity.bbclass alongside other checks.
Comment 3 Richard Purdie 2020-12-31 14:44:37 UTC
To give more of a hint, where we check this in sanity.bbclass:

http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/classes/sanity.bbclass#n786

we could also add a call along the lines of "bb.utils.which(d.getVar('PATH'), 'bitbake')" which would determine if bitbake can be found in PATH. If not, we should error with a more specific error to the user.
Comment 5 Randy MacLeod 2021-01-29 15:11:21 UTC
Can you confirm that it's in oe-core/master and provide a link? Thanks.
Comment 7 Randy MacLeod 2021-01-29 15:41:44 UTC
Thanks for the link Dorinda!