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-09 10:58:07 +0100 |
| commit | 57d97d5970ffbfb726f9510f62b334db3cd8ee5b (patch) | |
| tree | be735c2fb5d423dd0ab43b32fd6b955696ca2d8d | |
| parent | 21466040c358c218d119d9fe47e9a658df9fd0f5 (diff) | |
| download | poky-57d97d5970ffbfb726f9510f62b334db3cd8ee5b.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: 0c10a78796fbdfaa5be4a824c0c9f5cb97c88046)
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 55b8c05217..2be7a0f286 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
| @@ -1692,9 +1692,6 @@ to your build configuration. | |||
| 1692 | self.cleaned = True | 1692 | self.cleaned = True |
| 1693 | 1693 | ||
| 1694 | def run_bitbake_env(self, mach=None, target=''): | 1694 | def run_bitbake_env(self, mach=None, target=''): |
| 1695 | bitbake = shutil.which('bitbake') | ||
| 1696 | if not bitbake: | ||
| 1697 | return | ||
| 1698 | 1695 | ||
| 1699 | if not mach: | 1696 | if not mach: |
| 1700 | mach = self.get('MACHINE') | 1697 | mach = self.get('MACHINE') |
| @@ -1711,6 +1708,10 @@ to your build configuration. | |||
| 1711 | else: | 1708 | else: |
| 1712 | cmd = 'bitbake -e %s %s' % (multiconfig, target) | 1709 | cmd = 'bitbake -e %s %s' % (multiconfig, target) |
| 1713 | 1710 | ||
| 1711 | bitbake = shutil.which('bitbake') | ||
| 1712 | if not bitbake: | ||
| 1713 | raise OEPathError("Bitbake is needed to run '%s', but it is not found in PATH. Please source the bitbake build environment." % cmd.strip()) | ||
| 1714 | |||
| 1714 | logger.info('Running %s...' % cmd) | 1715 | logger.info('Running %s...' % cmd) |
| 1715 | try: | 1716 | try: |
| 1716 | return subprocess.check_output(cmd, shell=True).decode('utf-8') | 1717 | return subprocess.check_output(cmd, shell=True).decode('utf-8') |
