| Message ID | 20250821131006.831214-1-r.gruenert@pironex.com |
|---|---|
| State | New |
| Headers | show |
| Series | [v3] scripts/runqemu: raise an error when bitbake was not found | expand |
On Thu, 21 Aug 2025 at 15:10, Richard Grünert via lists.openembedded.org <r.gruenert=pironex.com@lists.openembedded.org> wrote: > I am new to Yocto/OpenEmbedded and compiled poky by following the Yocto > "Quick Build" guide. I later tried to call runqemu > from a terminal different to the one I ran the compilation in > and runqemu was not found. > Wondering why it was not found, I ran it directly as `./scripts/runqemu`, > which was a misconception I had because you are supposed to have > `oe-init-build-env` sourced. However, there was no error that told me > this when running runqemu like I did. So I thought it would be > good to add this error message to notify the user that bitbake > was not found. At least it would have helped me and saved me > some minutes of head scratching. It's better to trim details of your skills and personal experience out of the commit message. Describe what the problem is and how the patch solves it. For example: - what happens if you run runqemu without having bitbake in PATH - how the patch solves or improves the issue: what happens when the patch is applied. > + raise OEPathError("bitbake could not be found") This should be improved: "Bitbake is needed to run {cmd}, but it is not found in PATH. Please source the bitbake build environment." Alex
diff --git a/scripts/runqemu b/scripts/runqemu index c24528eac8..5dbeb518c6 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -1713,9 +1713,6 @@ to your build configuration. self.cleaned = True def run_bitbake_env(self, mach=None, target=''): - bitbake = shutil.which('bitbake') - if not bitbake: - return if not mach: mach = self.get('MACHINE') @@ -1732,6 +1729,10 @@ to your build configuration. else: cmd = 'bitbake -e %s %s' % (multiconfig, target) + bitbake = shutil.which('bitbake') + if not bitbake: + raise OEPathError("bitbake could not be found") + logger.info('Running %s...' % cmd) try: return subprocess.check_output(cmd, shell=True).decode('utf-8')
I am new to Yocto/OpenEmbedded and compiled poky by following the Yocto "Quick Build" guide. I later tried to call runqemu from a terminal different to the one I ran the compilation in and runqemu was not found. Wondering why it was not found, I ran it directly as `./scripts/runqemu`, which was a misconception I had because you are supposed to have `oe-init-build-env` sourced. However, there was no error that told me this when running runqemu like I did. So I thought it would be good to add this error message to notify the user that bitbake was not found. At least it would have helped me and saved me some minutes of head scratching. CC: Richard Purdie <richard.purdie@linuxfoundation.org>, Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Grünert <r.gruenert@pironex.com> --- changes in v3: Messed up the CC tag :) changes in v2: Changed the position according to suggestion by Alexander Kanavin. I also changed the error to OEPathError as this seems to be made for this exact situation. --- --- scripts/runqemu | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)