diff mbox series

[v3] scripts/runqemu: raise an error when bitbake was not found

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

Commit Message

Richard GrĂ¼nert Aug. 21, 2025, 1:10 p.m. UTC
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(-)
diff mbox series

Patch

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