From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: "Richard Grünert" <r.gruenert@pironex.com>,
"Richard Purdie" <richard.purdie@linuxfoundation.org>,
"Alexander Kanavin" <alex.kanavin@gmail.com>,
"Mathieu Dubois-Briand" <mathieu.dubois-briand@bootlin.com>
Subject: [PATCH 1/3] scripts/runqemu: raise an error when bitbake was not found
Date: Tue, 7 Oct 2025 14:46:50 +0200 [thread overview]
Message-ID: <20251007124652.259629-1-alex.kanavin@gmail.com> (raw)
From: Richard Grünert <r.gruenert@pironex.com>
Running 'scrupts/runqemu' without bitbake in PATH causes the
following error:
```
Traceback (most recent call last):
File "/home/rg/temp_stuff/oe_2/./scripts/runqemu", line 1807, in main
config.check_args()
~~~~~~~~~~~~~~~~~^^
File "/home/rg/temp_stuff/oe_2/./scripts/runqemu", line 624, in check_args
s = re.search('^DEPLOY_DIR_IMAGE="(.*)"', self.bitbake_e, re.M)
File "/usr/lib/python3.13/re/__init__.py", line 177, in search
return _compile(pattern, flags).search(string)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'
```
This patch adds a more helpful error message to inform the user that
bitbake was not found, e.g. because oe-init-build-env was not sourced.
This is an example of the new error message after the patch:
```
runqemu - ERROR - In order for this script to dynamically infer paths
kernels or filesystem images, you either need bitbake in your PATH
or to source oe-init-build-env before running this script.
Dynamic path inference can be avoided by passing a *.qemuboot.conf to
runqemu, i.e. `runqemu /path/to/my-image-name.qemuboot.conf`
Bitbake is needed to run 'bitbake -e', but it is not found in PATH. Please source the bitbake build environment.
```
CC: Richard Purdie <richard.purdie@linuxfoundation.org>
CC: Alexander Kanavin <alex.kanavin@gmail.com>
(From OE-Core rev: c9744f2d294f5baa8c4c9c795eb73d269f943b0c)
Signed-off-by: Richard Grünert <r.gruenert@pironex.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
scripts/runqemu | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/runqemu b/scripts/runqemu
index 32c7a2aab3b..c28980e6163 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1714,9 +1714,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')
@@ -1733,6 +1730,10 @@ to your build configuration.
else:
cmd = 'bitbake -e %s %s' % (multiconfig, target)
+ bitbake = shutil.which('bitbake')
+ if not bitbake:
+ raise OEPathError("Bitbake is needed to run '%s', but it is not found in PATH. Please source the bitbake build environment." % cmd.strip())
+
logger.info('Running %s...' % cmd)
try:
return subprocess.check_output(cmd, shell=True).decode('utf-8')
--
2.39.5
next reply other threads:[~2025-10-07 12:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 12:46 Alexander Kanavin [this message]
2025-10-07 12:46 ` [PATCH 2/3] runqemu: ensure that bitbake environment is either returned, or an exception is raised Alexander Kanavin
2025-10-07 12:46 ` [PATCH 3/3] scripts/runqemu: remove the code block that works around the missing bitbake environment Alexander Kanavin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251007124652.259629-1-alex.kanavin@gmail.com \
--to=alex.kanavin@gmail.com \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=r.gruenert@pironex.com \
--cc=richard.purdie@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox