Skip to content

Commit

Permalink
mock: check for qemu-user-static to raise InvalidArchitecture()
Browse files Browse the repository at this point in the history
This specific error is better handled by upper Mock's code;  e.g. we
don't raise the ugly traceback:

INFO: Unable to build arch armv7hl natively on arch x86_64. Setting forcearch to use software emulation.
ERROR: The --forcearch=armv7hl feature requires the /usr/bin/qemu-arm-static file to be installed (typically qemu-user-static* package)
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 1087, in <module>
    exitStatus = main()
                 ^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/libexec/mock/mock", line 709, in main
    check_arch_combination(config_opts['rpmbuild_arch'], config_opts)
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/libexec/mock/mock", line 565, in check_arch_combination
    raise RuntimeError(
RuntimeError: The --forcearch=armv7hl feature requires the /usr/bin/qemu-arm-static file to be installed (typically qemu-user-static* package)
  • Loading branch information
praiskup committed Nov 24, 2022
1 parent 817c3c3 commit 3e38215
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mock/py/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def check_arch_combination(target_arch, config_opts):
time.sleep(5)
return

raise RuntimeError(
raise mockbuild.exception.InvalidArchitecture(
f'The {option} feature requires the {binary} '
'file to be installed (typically qemu-user-static* package)')

Expand Down

0 comments on commit 3e38215

Please sign in to comment.