diff options
author | Richard GrĂ¼nert <r.gruenert@pironex.com> | 2025-08-27 08:49:40 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-04 15:16:03 +0100 |
commit | 83840a21c50950dbeff9db0b73a6ef531331bb14 (patch) | |
tree | c81c431b34e534e13743ae69192e2875aa2e42dd | |
parent | 367c76f8f0bf367e6b33b8f122e859c579e66496 (diff) | |
download | poky-83840a21c50950dbeff9db0b73a6ef531331bb14.tar.gz |
scripts/runqemu: raise an error when bitbake was not found
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: 04d91eb144283d736bc398716e12f89926ada042)
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>
-rwxr-xr-x | scripts/runqemu | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 32c7a2aab3..c28980e616 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -1714,9 +1714,6 @@ to your build configuration. | |||
1714 | self.cleaned = True | 1714 | self.cleaned = True |
1715 | 1715 | ||
1716 | def run_bitbake_env(self, mach=None, target=''): | 1716 | def run_bitbake_env(self, mach=None, target=''): |
1717 | bitbake = shutil.which('bitbake') | ||
1718 | if not bitbake: | ||
1719 | return | ||
1720 | 1717 | ||
1721 | if not mach: | 1718 | if not mach: |
1722 | mach = self.get('MACHINE') | 1719 | mach = self.get('MACHINE') |
@@ -1733,6 +1730,10 @@ to your build configuration. | |||
1733 | else: | 1730 | else: |
1734 | cmd = 'bitbake -e %s %s' % (multiconfig, target) | 1731 | cmd = 'bitbake -e %s %s' % (multiconfig, target) |
1735 | 1732 | ||
1733 | bitbake = shutil.which('bitbake') | ||
1734 | if not bitbake: | ||
1735 | raise OEPathError("Bitbake is needed to run '%s', but it is not found in PATH. Please source the bitbake build environment." % cmd.strip()) | ||
1736 | |||
1736 | logger.info('Running %s...' % cmd) | 1737 | logger.info('Running %s...' % cmd) |
1737 | try: | 1738 | try: |
1738 | return subprocess.check_output(cmd, shell=True).decode('utf-8') | 1739 | return subprocess.check_output(cmd, shell=True).decode('utf-8') |