python: drop qemu.qmp from qemu.git tree
v4 cover python: drop qemu.qmp from qemu.git tree
Hello!
This series drops the in-tree version of our python-qemu-qmp package ("qemu.qmp") in favor of the version hosted on PyPI, whose repository is located at https://gitlab.com/qemu-project/python-qemu-qmp.
GitLab CI: https://gitlab.com/jsnow/qemu/-/pipelines/2272170300
This version reflects Dan's suggestion to always install the in-tree Python packages by default.
The major effects of this patch series are:
1. qemu.qmp and the python/ directory will be installed to the configure-time venv (build/pyvenv) by default.
2. qemu.qmp will be installed from PyPI or vendored packages instead of being utilized directly from the qemu.git tree.
3. "make check-venv" is removed as it is no longer needed.
4. functional test dependencies are installed as-needed when running those tests.
5. Unfortunately, python3-wheel and python3-setuptools are now required on the host system if tests are to be executed and >= Python 3.13 is used.
6. An awful lot of deleted lines of code, and a lot fewer headaches managing two nearly-identical copies of this source code. O:-)
v4:
- Rename "checktests" group to "tooling", install it by default alongside meson at configure-time.
- Remove "check-venv" entirely.
- Update python/README.rst to reflect the new paradigm
- Update many scripts that import qemu.qmp to give new errors when they are run outside of the configure venv
KNOWN ISSUES IN V4:
- The last patch is an RFC based on Thomas' observations, I don't have a strong opinion on if we want it or not.
- Removing "make check-venv" causes the VM tests to rebuild more often; I was not sure how to replace the old conditional behavior in an equivalent manner. Suggestions, anyone...?
v3:
- Fixed FreeBSD vm test
- Fixed Cirrus macOS test (Needed setuptools as a dep, "file:///" had one too many forward slashes, which works fine for older pip/setuptools, but was incompatibly fixed recently.)
- Fixed an issue that prevented installing the local python packages in an offline, isolated build environment (need --no-isolated-build and pip environment variable flags)
- Added the python3-wheel and python3-setuptools build dependencies to lcitool, owing to the above issues
- Ensured that the $download flag (for PyPI access) from configure is carried over into pytest/meson.build invocations. This defaults to "enabled", so test dependencies should not have any issue being fetched on most developer workstations and build environments.
- Fixed several bugs in the mkvenv.py local package installation mechanism.
- Flags and workarounds added for installing local packages offline now apply *only* to local package installations, and not "normal" depspecs.
- Reordered patches into more logical "phases" for easier review (I hope...?)
Known issues: "make check-build" still installs all of the test dependencies to the pyvenv. I'm not sure if this is desired or not, but I ran into problems preventing it from doing this without breaking a ton of CI tests. I'll continue to investigate this, but wanted to send this v3 out.
v2:
- move "make check-venv" earlier in GitLab CI/CD pipeline, to avoid re-running configure
- Fix functional tests not using PyPI to fetch pygdbmi package
- Remove pre-requisites which are now merged
--js
John Snow (17):
python/mkvenv: create timestamp file for each group "ensured" python/mkvenv: bump 'qemu.qmp' dependency for testdeps python/mkvenv: add 'tooling' and 'functests' dependency groups python/mkvenv: add mechanism to install local package(s) meson, mkvenv: add functests custom target
tests: Use configured python to run GitLab iotests
tests: use "run" script to execute device-crash-test tests/lcitool: add python3 wheel and setuptools deps for qemu
python: add vendored qemu.qmp package
meson, mkvenv: make functional tests depend on functests group meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml
configure: unconditionally install "tooling" group
tests: remove "make check-venv" target
scripts: nudge users to use 'run' script for scripts that import
qemu.qmp
python: delete qemu.qmp
python: update README.rst to reflect qemu.qmp's removal
RFC: exclude pyvenv targets from "make check-build"
python/README.rst | 50 +- configure | 2 +- meson.build | 1 + .gitlab-ci.d/buildtest.yml | 26 +- .gitlab-ci.d/cirrus/freebsd-14.vars | 2 +- .gitlab-ci.d/cirrus/macos-14.vars | 2 +- .gitlab-ci.d/windows.yml | 2 + python/qemu/qmp/__init__.py | 60 - python/qemu/qmp/error.py | 53 - python/qemu/qmp/events.py | 751 ----------- python/qemu/qmp/legacy.py | 339 ----- python/qemu/qmp/message.py | 217 ---- python/qemu/qmp/models.py | 146 --- python/qemu/qmp/protocol.py | 1101 ----------------- python/qemu/qmp/py.typed | 0 python/qemu/qmp/qmp_client.py | 732 ----------- python/qemu/qmp/qmp_shell.py | 689 ----------- python/qemu/qmp/qmp_tui.py | 665 ---------- python/qemu/qmp/util.py | 150 --- python/qemu/utils/qom_fuse.py | 1 - python/scripts/mkvenv.py | 44 +- python/scripts/vendor.py | 2 + python/setup.cfg | 31 +- python/tests/minreqs.txt | 8 +- python/tests/protocol.py | 596 --------- python/wheels/qemu_qmp-0.0.5-py3-none-any.whl | Bin 0 -> 72263 bytes pythondeps.toml | 13 +- pyvenv/meson.build | 28 + scripts/compare-machine-types.py | 7 +- scripts/device-crash-test | 5 +- scripts/mtest2make.py | 4 +- scripts/qmp/qemu-ga-client | 13 +- scripts/qmp/qmp-shell | 13 +- scripts/qmp/qmp-shell-wrap | 13 +- scripts/qmp/qom-fuse | 13 +- scripts/qmp/qom-get | 13 +- scripts/qmp/qom-list | 13 +- scripts/qmp/qom-set | 13 +- scripts/qmp/qom-tree | 13 +- scripts/qmp_helper.py | 9 +- scripts/render_block_graph.py | 10 +- scripts/simplebench/bench_block_job.py | 10 +- tests/Makefile.include | 22 +- tests/docker/dockerfiles/alpine.docker | 2 + tests/docker/dockerfiles/centos9.docker | 2 + tests/functional/meson.build | 5 +- tests/lcitool/projects/qemu.yml | 2 + tests/migration-stress/guestperf/engine.py | 15 +- tests/vm/Makefile.include | 24 +- tests/vm/generated/freebsd.json | 2 + 50 files changed, 250 insertions(+), 5684 deletions(-) delete mode 100644 python/qemu/qmp/__init__.py delete mode 100644 python/qemu/qmp/error.py delete mode 100644 python/qemu/qmp/events.py delete mode 100644 python/qemu/qmp/legacy.py delete mode 100644 python/qemu/qmp/message.py delete mode 100644 python/qemu/qmp/models.py delete mode 100644 python/qemu/qmp/protocol.py delete mode 100644 python/qemu/qmp/py.typed delete mode 100644 python/qemu/qmp/qmp_client.py delete mode 100644 python/qemu/qmp/qmp_shell.py delete mode 100644 python/qemu/qmp/qmp_tui.py delete mode 100644 python/qemu/qmp/util.py delete mode 100644 python/tests/protocol.py create mode 100644 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl create mode 100644 pyvenv/meson.build
Signature · 1 line
2.52.0
PATCH v4 1/17 python/mkvenv: create timestamp file for each group "ensured"
Each group ensured by the mkvenv script will create an empty timestamp file named {groupname}.group which can be used to conditionally trigger dependency installation from various scripts and build machinery.
--- python/scripts/mkvenv.py | 6 ++++++ 1 file changed, 6 insertions(+)
python/scripts/mkvenv.py +6 -0
@@ -838,6 +838,12 @@ def ensure_group( raise Ouch(result[0]) raise SystemExit(f"\n{result[0]}\n\n") + if inside_a_venv(): + for group in groups: + path = Path(sys.prefix).joinpath(f"{group}.group") + with open(path, "w", encoding="UTF8"): + pass + def post_venv_setup() -> None: """
Signature · 1 line
2.52.0
PATCH v4 2/17 python/mkvenv: bump 'qemu.qmp' dependency for testdeps
In reply to John SnowFirst up, use the newest v0.0.5 instead of the older v0.0.3.
Secondly, the use of a period in the key name does not behave as expected when installing and checking for dependencies, so quote this string instead.
--- pythondeps.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pythondeps.toml +1 -1
@@ -32,5 +32,5 @@ sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" } sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" } [testdeps] -qemu.qmp = { accepted = ">=0.0.3", installed = "0.0.3" } +"qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" } pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
Signature · 1 line
2.52.0
PATCH v4 3/17 python/mkvenv: add 'tooling' and 'functests' dependency groups
In reply to John Snow'tooling' contains depedencies required to run various tools (like qmp-shell) as well as dependencies required to run "make check", and as such, we promise that these dependencies can be sourced from the user's distribution repository or from vendored packages so that "make check" can be executed offline in an isolated build environment.
In contrast, pygdbmi is only needed for functional tests and not tests in general; we do not make the same offline/isolated guarantees for functional tests, and this dependency group is allowed to fetch dependencies from PyPI at runtime.
For the time being, amend the "check-venv" target to install both dependency groups, to avoid a duplicate dependency between them. By the end of this series, however, "check-venv" will be eliminated in favor of always installing "tooling" at configure time and allowing "functests" to be installed on-demand as needed by meson/ninja.
--- pythondeps.toml | 10 +++++++++- tests/Makefile.include | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-)
pythondeps.toml +9 -1
@@ -31,6 +31,14 @@ meson = { accepted = ">=1.10.0", installed = "1.10.0", canary = "meson" } sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" } sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" } -[testdeps] +# This test group is for dependencies required to run various tooling +# and tests that should always be installed at configure time. It should +# only include depedencies that can be guaranteed via configure from +# system packages, or python packages we vendor. +[tooling] "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" } + +# This test group is for functional tests, and can include dependencies +# fetched from PyPI. +[functests] pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
tests/Makefile.include +1 -1
@@ -107,7 +107,7 @@ quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \ $(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/") - $(MKVENV_ENSUREGROUP) $< testdeps + $(MKVENV_ENSUREGROUP) $< tooling functests $(call quiet-command, touch $@) check-venv: $(TESTS_VENV_TOKEN)
Signature · 1 line
2.52.0
Re: [PATCH v4 03/17] python/mkvenv: add 'tooling' and 'functests' dependency groups
Quoted 11 lines · John Snow
'tooling' contains depedencies required to run various tools (like qmp-shell) as well as dependencies required to run "make check", and as such, we promise that these dependencies can be sourced from the user's distribution repository or from vendored packages so that "make check" can be executed offline in an isolated build environment.
In contrast, pygdbmi is only needed for functional tests and not tests in general; we do not make the same offline/isolated guarantees for functional tests, and this dependency group is allowed to fetch dependencies from PyPI at runtime.
Quoted 7 lines
For the time being, amend the "check-venv" target to install both dependency groups, to avoid a duplicate dependency between them. By the end of this series, however, "check-venv" will be eliminated in favor of always installing "tooling" at configure time and allowing "functests" to be installed on-demand as needed by meson/ninja.
Signed-off-by John Snow<[email protected]>
Signature · 2 lines
Best regards, Vladimir
Re: [PATCH v4 03/17] python/mkvenv: add 'tooling' and 'functests' dependency groups
In reply to John SnowQuoted 28 lines · John Snow
'tooling' contains depedencies required to run various tools (like qmp-shell) as well as dependencies required to run "make check", and as such, we promise that these dependencies can be sourced from the user's distribution repository or from vendored packages so that "make check" can be executed offline in an isolated build environment.
In contrast, pygdbmi is only needed for functional tests and not tests in general; we do not make the same offline/isolated guarantees for functional tests, and this dependency group is allowed to fetch dependencies from PyPI at runtime.
For the time being, amend the "check-venv" target to install both dependency groups, to avoid a duplicate dependency between them. By the end of this series, however, "check-venv" will be eliminated in favor of always installing "tooling" at configure time and allowing "functests" to be installed on-demand as needed by meson/ninja.
Signed-off-by John Snow <[email protected]>--- pythondeps.toml | 10 +++++++++- tests/Makefile.include | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-)pythondeps.toml +0
-0
pythondeps.toml meson = { accepted = ">=1.10.0", installed = "1.10.0", canary = "meson" } · line 36
Quoted 7 lines
pythondeps.toml +3
-1@@ -31,6 +31,14 @@ meson = { accepted = ">=1.10.0", installed = "1.10.0", canary = "meson" } sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" } sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" } -[testdeps] +# This test group is for dependencies required to run various tooling +# and tests that should always be installed at configure time. It should +# only include depedencies that can be guaranteed via configure from
s/depedencies/dependencies/
With the typo fixed:
Re: [PATCH v4 03/17] python/mkvenv: add 'tooling' and 'functests' dependency groups
In reply to John SnowQuoted 17 lines · John Snow
'tooling' contains depedencies required to run various tools (like qmp-shell) as well as dependencies required to run "make check", and as such, we promise that these dependencies can be sourced from the user's distribution repository or from vendored packages so that "make check" can be executed offline in an isolated build environment.
In contrast, pygdbmi is only needed for functional tests and not tests in general; we do not make the same offline/isolated guarantees for functional tests, and this dependency group is allowed to fetch dependencies from PyPI at runtime.
For the time being, amend the "check-venv" target to install both dependency groups, to avoid a duplicate dependency between them. By the end of this series, however, "check-venv" will be eliminated in favor of always installing "tooling" at configure time and allowing "functests" to be installed on-demand as needed by meson/ninja.
Quoted 5 lines
Signed-off-by John Snow <[email protected]>--- pythondeps.toml | 10 +++++++++- tests/Makefile.include | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v4 4/17 python/mkvenv: add mechanism to install local package(s)
In reply to John SnowCurrently, we "implicitly" install the local 'qemu' python package for 'make check-venv' with some logic inside tests/Makefile.include. I would like to make this installation explicit in pythondeps.toml instead.
The version constraint specification that Python specifies does not support relative paths, so it is difficult (or impossible?) to specify a path within the source tree, and we will need a workaround to do so.
By specifying a package name that starts with $SRCROOT, you can now specify a file path to a local package for installation. This is done to allow us to install the python packages hosted inside of the tree while also processing dependencies; i.e. so that our "qemu" package can specify that it needs "qemu.qmp", which soon will not be included in qemu.git.
This also has the benefit of being able to specify in a declarative configuration file that our pyvenv environment *will* have our local python packages installed and available without any PYTHONPATH hacks, which should simplify iotests, device-crash-test and functional tests without needing to manage local inclusion paths in environment variables.
On the downsides, installing packages through mkvenv/ensuregroup means that there are extra steps we need to take in order to install a local package *offline*; namely we must disable build isolation (so we have access to setuptools) and we must also include python3-wheel in QEMU's build dependencies in order for "make check" to run successfully when in an offline, isolated environment. These extra dependencies are handled in a forthcoming commit; for now, nothing is utilizing this new pathway.
--- python/scripts/mkvenv.py | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-)
python/scripts/mkvenv.py +32 -6
@@ -662,6 +662,7 @@ def pip_install( args: Sequence[str], online: bool = False, wheels_dir: Optional[Union[str, Path]] = None, + env: Optional[Dict[str, str]] = None, ) -> None: """ Use pip to install a package or package(s) as specified in @args.
@@ -687,6 +688,7 @@ def pip_install( full_args += list(args) subprocess.run( full_args, + env=env, check=True, )
@@ -733,9 +735,15 @@ def _do_ensure( :param wheels_dir: If specified, search this path for packages. """ absent = [] + local_packages = [] present = [] canary = None for name, info in group.items(): + if name.startswith("$SRCROOT/"): + srcroot = Path(__file__).parents[2] + pkgpath = name.replace("$SRCROOT/", f"file://{srcroot}/") + local_packages.append(pkgpath) + continue constraint = _make_version_constraint(info, False) matcher = Matcher(name + constraint) print(f"mkvenv: checking for {matcher}", file=sys.stderr)
@@ -770,15 +778,33 @@ def _do_ensure( print(f"mkvenv: installing {', '.join(absent)}", file=sys.stderr) try: pip_install(args=absent, online=online, wheels_dir=wheels_dir) - return None + absent = [] except subprocess.CalledProcessError: pass - return diagnose( - absent[0], - online, - wheels_dir, - canary, + if absent: + return diagnose( + absent[0], + online, + wheels_dir, + canary, + ) + + # Handle local packages separately and last so we can use different + # installation arguments (-e), and so that any dependencies that may + # be covered above will be handled according to the depfile + # specifications. + if local_packages: + print(f"mkvenv: installing {', '.join(local_packages)}", + file=sys.stderr) + env = dict(os.environ) + env['PIP_CONFIG_SETTINGS'] = "editable_mode=compat" + pip_install( + args=["--no-build-isolation", + "-e"] + local_packages, + online=online, + wheels_dir=wheels_dir, + env=env, ) return None
Signature · 1 line
2.52.0
PATCH v4 5/17 meson, mkvenv: add functests custom target
In reply to John Snowadd the "pyvenv_functests_group" target to meson. This target will invoke mkvenv.py to install the associated dependency group to the build/pyvenv directory.
A "pyvenv_tooling_group" is not included here as it is the plan to always install this group by default, so it will not need an on-demand trigger.
--- meson.build | 1 + pyvenv/meson.build | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pyvenv/meson.build
meson.build +1 -0
@@ -4551,6 +4551,7 @@ subdir('scripts') subdir('tools') subdir('pc-bios') subdir('docs') +subdir('pyvenv') # Tests are disabled on emscripten because they rely on host features that aren't # supported by emscripten (e.g. fork and unix socket). if host_os != 'emscripten'
pyvenv/meson.build new file +28 -0
@@ -0,0 +1,28 @@ +# Note that this file only controls "optional" dependency groups; groups +# *required* for the build are handled directly in configure instead: +# namely, meson and sphinx. + +# NB: This command may or may not include the "--online" flag, depending +# on the results of configure. +ensuregroup_cmd = config_host['MKVENV_ENSUREGROUP'].split() + +pyvenv_common_deps = files( + meson.project_source_root() + '/pythondeps.toml', + meson.project_source_root() + '/python/scripts/mkvenv.py' +) +pyvenv_wheel_dir = meson.project_source_root() + '/python/wheels' + + +# This group is allowed to rely on internet, to fetch from PyPI. +# If --online was not passed to configure, this could fail. +pyvenv_functests_group = custom_target( + 'pyvenv_functests_group', + output: 'functests.group', + input: pyvenv_common_deps, + command: ensuregroup_cmd + [ + '--online', + '--dir', pyvenv_wheel_dir, + '@INPUT0@', + 'functests', + ], +)
Signature · 1 line
2.52.0
Re: [PATCH v4 05/17] meson, mkvenv: add functests custom target
Quoted 33 lines · John Snow
add the "
pyvenv_functests_group" target to meson. This target will invokemkvenv.pyto install the associated dependency group to the build/pyvenv directory.A "
pyvenv_tooling_group" is not included here as it is the plan to always install this group by default, so it will not need an on-demand trigger.Signed-off-by John Snow <[email protected]>--- meson.build | 1 + pyvenv/meson.build | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pyvenv/meson.buildmeson.build +1
-0@@ -4551,6 +4551,7 @@ subdir('scripts') subdir('tools') subdir('pc-bios') subdir('docs') +subdir('pyvenv') # Tests are disabled on emscripten because they rely on host features that aren't # supported by emscripten (e.g. fork and unix socket). if host_os != 'emscripten'pyvenv/meson.build new file +0
-0
pyvenv/meson.build line 7
Quoted 7 lines
pyvenv/meson.build new file +7
-0@@ -0,0 +1,28 @@ +# Note that this file only controls "optional" dependency groups; groups +# *required* for the build are handled directly in configure instead: +# namely, meson and sphinx. + +# NB: This command may or may not include the "--online" flag, depending +# on the results of configure. +ensuregroup_cmd = config_host['MKVENV_ENSUREGROUP'].split()
I'm confused because this implies that "ensuregroup_cmd" use of the --online flag is supposed to be controlled by configure
pyvenv/meson.build line 17
Quoted 10 lines
pyvenv/meson.build new file +10
-0+ +pyvenv_common_deps = files( + meson.project_source_root() + '/pythondeps.toml', + meson.project_source_root() + '/python/scripts/mkvenv.py' +) +pyvenv_wheel_dir = meson.project_source_root() + '/python/wheels' + + +# This group is allowed to rely on internet, to fetch from PyPI. +# If --online was not passed to configure, this could fail.
...and this also suggests --online is supposed to be controlled by configure, but...
pyvenv/meson.build line 23
Quoted 6 lines
pyvenv/meson.build new file +6
-0+pyvenv_functests_group = custom_target( + 'pyvenv_functests_group', + output: 'functests.group', + input: pyvenv_common_deps, + command: ensuregroup_cmd + [ + '--online',
now we just go ahead and hardcode use of --online regardless.
Quoted 8 lines
pyvenv/meson.build new file +5
-0+ '--dir', pyvenv_wheel_dir, + '@INPUT0@', + 'functests', + ], +)Signature · 1 line
2.52.0
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v4 05/17] meson, mkvenv: add functests custom target
Quoted 61 lines · Daniel P. Berrangé
Quoted 33 lines · John Snow
add the "
pyvenv_functests_group" target to meson. This target will invokemkvenv.pyto install the associated dependency group to the build/pyvenv directory.A "
pyvenv_tooling_group" is not included here as it is the plan to always install this group by default, so it will not need an on-demand trigger.Signed-off-by John Snow <[email protected]>--- meson.build | 1 + pyvenv/meson.build | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pyvenv/meson.buildmeson.build +1
-0@@ -4551,6 +4551,7 @@ subdir('scripts') subdir('tools') subdir('pc-bios') subdir('docs') +subdir('pyvenv') # Tests are disabled on emscripten because they rely on host features that aren't # supported by emscripten (e.g. fork and unix socket). if host_os != 'emscripten'pyvenv/meson.build new file +0
-0pyvenv/meson.build line 7
Quoted 7 lines
pyvenv/meson.build new file +7
-0@@ -0,0 +1,28 @@ +# Note that this file only controls "optional" dependency groups; groups +# *required* for the build are handled directly in configure instead: +# namely, meson and sphinx. + +# NB: This command may or may not include the "--online" flag, depending +# on the results of configure. +ensuregroup_cmd = config_host['MKVENV_ENSUREGROUP'].split()I'm confused because this implies that "
ensuregroup_cmd" use of the --online flag is supposed to be controlled by configurepyvenv/meson.build line 17
Quoted 10 lines
pyvenv/meson.build new file +10
-0+ +pyvenv_common_deps = files( + meson.project_source_root() + '/pythondeps.toml', + meson.project_source_root() + '/python/scripts/mkvenv.py' +) +pyvenv_wheel_dir = meson.project_source_root() + '/python/wheels' + + +# This group is allowed to rely on internet, to fetch from PyPI. +# If --online was not passed to configure, this could fail....and this also suggests --online is supposed to be controlled by configure, but...
Quoted 8 lines
pyvenv/meson.build line 23
Quoted 6 lines
pyvenv/meson.build new file +6
-0+pyvenv_functests_group = custom_target( + 'pyvenv_functests_group', + output: 'functests.group', + input: pyvenv_common_deps, + command: ensuregroup_cmd + [ + '--online',now we just go ahead and hardcode use of --online regardless.
Whoops, leftover from when I had both groups. What is now the tooling group used to obey the flags, and I garbled the comments. My gut tells me that we should force --online here, and if it fails because we're actually in an isolated environment, then so be it.
On the other hand, if we were configured offline, the error message you get from mkvenv might be better.
Do you have an opinion?
Quoted 17 lines
Quoted 9 lines
pyvenv/meson.build new file +5
-1+ '--dir', pyvenv_wheel_dir, + '@INPUT0@', + 'functests', + ], +) --2.52.0
With regards,
Daniel
--|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v4 05/17] meson, mkvenv: add functests custom target
Quoted 76 lines · John Snow
Quoted 61 lines · Daniel P. Berrangé
Quoted 33 lines · John Snow
add the "
pyvenv_functests_group" target to meson. This target will invokemkvenv.pyto install the associated dependency group to the build/pyvenv directory.A "
pyvenv_tooling_group" is not included here as it is the plan to always install this group by default, so it will not need an on-demand trigger.Signed-off-by John Snow <[email protected]>--- meson.build | 1 + pyvenv/meson.build | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pyvenv/meson.buildmeson.build +1
-0@@ -4551,6 +4551,7 @@ subdir('scripts') subdir('tools') subdir('pc-bios') subdir('docs') +subdir('pyvenv') # Tests are disabled on emscripten because they rely on host features that aren't # supported by emscripten (e.g. fork and unix socket). if host_os != 'emscripten'pyvenv/meson.build new file +0
-0pyvenv/meson.build line 7
Quoted 7 lines
pyvenv/meson.build new file +7
-0@@ -0,0 +1,28 @@ +# Note that this file only controls "optional" dependency groups; groups +# *required* for the build are handled directly in configure instead: +# namely, meson and sphinx. + +# NB: This command may or may not include the "--online" flag, depending +# on the results of configure. +ensuregroup_cmd = config_host['MKVENV_ENSUREGROUP'].split()I'm confused because this implies that "
ensuregroup_cmd" use of the --online flag is supposed to be controlled by configurepyvenv/meson.build line 17
Quoted 10 lines
pyvenv/meson.build new file +10
-0+ +pyvenv_common_deps = files( + meson.project_source_root() + '/pythondeps.toml', + meson.project_source_root() + '/python/scripts/mkvenv.py' +) +pyvenv_wheel_dir = meson.project_source_root() + '/python/wheels' + + +# This group is allowed to rely on internet, to fetch from PyPI. +# If --online was not passed to configure, this could fail....and this also suggests --online is supposed to be controlled by configure, but...
Quoted 8 lines
pyvenv/meson.build line 23
Quoted 6 lines
pyvenv/meson.build new file +6
-0+pyvenv_functests_group = custom_target( + 'pyvenv_functests_group', + output: 'functests.group', + input: pyvenv_common_deps, + command: ensuregroup_cmd + [ + '--online',now we just go ahead and hardcode use of --online regardless.
Whoops, leftover from when I had both groups. What is now the tooling group used to obey the flags, and I garbled the comments. My gut tells me that we should force --online here, and if it fails because we're actually in an isolated environment, then so be it.
Quoted 4 lines
On the other hand, if we were configured offline, the error message you get from mkvenv might be better.
Do you have an opinion?
IIUC, the later patch only adds pyvenv_functests_group to the thorough functional tests, NOT the quick tests. Given that the thorough tests mandated online access to download assets, it feels reasonable to also hardcode --online here for their code prereqs.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v4 05/17] meson, mkvenv: add functests custom target
Quoted 81 lines · Daniel P. Berrangé
Quoted 79 lines · John Snow
Quoted 61 lines · Daniel P. Berrangé
Quoted 33 lines · John Snow
add the "
pyvenv_functests_group" target to meson. This target will invokemkvenv.pyto install the associated dependency group to the build/pyvenv directory.A "
pyvenv_tooling_group" is not included here as it is the plan to always install this group by default, so it will not need an on-demand trigger.Signed-off-by John Snow <[email protected]>--- meson.build | 1 + pyvenv/meson.build | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pyvenv/meson.buildmeson.build +1
-0@@ -4551,6 +4551,7 @@ subdir('scripts') subdir('tools') subdir('pc-bios') subdir('docs') +subdir('pyvenv') # Tests are disabled on emscripten because they rely on host features that aren't # supported by emscripten (e.g. fork and unix socket). if host_os != 'emscripten'pyvenv/meson.build new file +0
-0pyvenv/meson.build line 7
Quoted 7 lines
pyvenv/meson.build new file +7
-0@@ -0,0 +1,28 @@ +# Note that this file only controls "optional" dependency groups; groups +# *required* for the build are handled directly in configure instead: +# namely, meson and sphinx. + +# NB: This command may or may not include the "--online" flag, depending +# on the results of configure. +ensuregroup_cmd = config_host['MKVENV_ENSUREGROUP'].split()I'm confused because this implies that "
ensuregroup_cmd" use of the --online flag is supposed to be controlled by configurepyvenv/meson.build line 17
Quoted 10 lines
pyvenv/meson.build new file +10
-0+ +pyvenv_common_deps = files( + meson.project_source_root() + '/pythondeps.toml', + meson.project_source_root() + '/python/scripts/mkvenv.py' +) +pyvenv_wheel_dir = meson.project_source_root() + '/python/wheels' + + +# This group is allowed to rely on internet, to fetch from PyPI. +# If --online was not passed to configure, this could fail....and this also suggests --online is supposed to be controlled by configure, but...
Quoted 8 lines
pyvenv/meson.build line 23
Quoted 6 lines
pyvenv/meson.build new file +6
-0+pyvenv_functests_group = custom_target( + 'pyvenv_functests_group', + output: 'functests.group', + input: pyvenv_common_deps, + command: ensuregroup_cmd + [ + '--online',now we just go ahead and hardcode use of --online regardless.
Whoops, leftover from when I had both groups. What is now the tooling group used to obey the flags, and I garbled the comments. My gut tells me that we should force --online here, and if it fails because we're actually in an isolated environment, then so be it.
On the other hand, if we were configured offline, the error message you get from mkvenv might be better.
Quoted 6 lines
Quoted 1 line
Do you have an opinion?
IIUC, the later patch only adds
pyvenv_functests_groupto the thorough functional tests, NOT the quick tests. Given that the thorough tests mandated online access to download assets, it feels reasonable to also hardcode --online here for their code prereqs.
Works for me; will fix my mumbled comments.
Quoted 8 lines
With regards,
Daniel
--|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v4 6/17 tests: Use configured python to run GitLab iotests
In reply to John Snowuse the configured python (and the pyvenv) to run iotests instead of the system default python3 interpreter. Use the new "run" script in the build directory to execute the command inside the meson developer environment, templated in qemu.git/run.in.
--- .gitlab-ci.d/buildtest.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
.gitlab-ci.d/buildtest.yml +9 -9
@@ -350,15 +350,15 @@ build-tcg-disabled: - make -j"$JOBS" - make check-unit - make check-qapi-schema - - cd tests/qemu-iotests/ - - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048 - 052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163 - 170 171 184 192 194 208 221 226 227 236 253 277 image-fleecing - - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122 - 124 132 139 142 144 145 151 152 155 157 165 194 196 200 202 - 208 209 216 218 227 234 246 247 248 250 254 255 257 258 - 260 261 262 263 264 270 272 273 277 279 image-fleecing - - cd ../.. + - ./run tests/qemu-iotests/check -raw 001 002 003 004 005 008 009 + 010 011 012 021 025 032 033 048 052 063 077 086 101 104 106 + 113 148 150 151 152 157 159 160 163 170 171 184 192 194 208 + 221 226 227 236 253 277 image-fleecing + - ./run tests/qemu-iotests/check -qcow2 028 051 056 057 058 065 068 + 082 085 091 095 096 102 122 124 132 139 142 144 145 151 152 + 155 157 165 194 196 200 202 208 209 216 218 227 234 246 247 + 248 250 254 255 257 258 260 261 262 263 264 270 272 273 277 + 279 image-fleecing - make distclean build-user:
Signature · 1 line
2.52.0
Re: [PATCH v4 06/17] tests: Use configured python to run GitLab iotests
Quoted 29 lines · John Snow
use the configured python (and the pyvenv) to run iotests instead of the system default python3 interpreter. Use the new "run" script in the build directory to execute the command inside the meson developer environment, templated in qemu.git/run.in.
Signed-off-by John Snow <[email protected]>--- .gitlab-ci.d/buildtest.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-).gitlab-ci.d/buildtest.yml +2
-9@@ -350,15 +350,15 @@ build-tcg-disabled: - make -j"$JOBS" - make check-unit - make check-qapi-schema - - cd tests/qemu-iotests/ - - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048 - 052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163 - 170 171 184 192 194 208 221 226 227 236 253 277 image-fleecing - - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122 - 124 132 139 142 144 145 151 152 155 157 165 194 196 200 202 - 208 209 216 218 227 234 246 247 248 250 254 255 257 258 - 260 261 262 263 264 270 272 273 277 279 image-fleecing - - cd ../.. + - ./run tests/qemu-iotests/check -raw 001 002 003 004 005 008 009 + 010 011 012 021 025 032 033 048 052 063 077 086 101 104 106
.gitlab-ci.d/buildtest.yml build-tcg-disabled: · line 364
Quoted 10 lines
.gitlab-ci.d/buildtest.yml +7
-0+ 113 148 150 151 152 157 159 160 163 170 171 184 192 194 208 + 221 226 227 236 253 277 image-fleecing + - ./run tests/qemu-iotests/check -qcow2 028 051 056 057 058 065 068 + 082 085 091 095 096 102 122 124 132 139 142 144 145 151 152 + 155 157 165 194 196 200 202 208 209 216 218 227 234 246 247 + 248 250 254 255 257 258 260 261 262 263 264 270 272 273 277 + 279 image-fleecing - make distclean build-user:
Re: [PATCH v4 06/17] tests: Use configured python to run GitLab iotests
In reply to John SnowQuoted 9 lines · John Snow
use the configured python (and the pyvenv) to run iotests instead of the system default python3 interpreter. Use the new "run" script in the build directory to execute the command inside the meson developer environment, templated in qemu.git/run.in.
Signed-off-by John Snow <[email protected]>--- .gitlab-ci.d/buildtest.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v4 7/17 tests: use "run" script to execute device-crash-test
In reply to John SnowInstead of invoking python from the configure venv manually, instruct developers to use the "run" script instead. Change the test invocation to be a good example going forward.
--- .gitlab-ci.d/buildtest.yml | 6 +++--- scripts/device-crash-test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
.gitlab-ci.d/buildtest.yml +3 -3
@@ -102,7 +102,7 @@ crash-test-debian: script: - cd build - make NINJA=":" check-venv - - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only ./qemu-system-i386 + - ./run scripts/device-crash-test -q --tcg-only ./qemu-system-i386 build-system-fedora: extends:
@@ -159,8 +159,8 @@ crash-test-fedora: script: - cd build - make NINJA=":" check-venv - - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc - - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32 + - ./run scripts/device-crash-test -q ./qemu-system-ppc + - ./run scripts/device-crash-test -q ./qemu-system-riscv32 build-system-centos: extends:
scripts/device-crash-test +1 -1
@@ -42,7 +42,7 @@ except ModuleNotFoundError as exc: print(f"Module '{exc.name}' not found.") print(" Try 'make check-venv' from your build directory,") print(" and then one way to run this script is like so:") - print(f' > $builddir/pyvenv/bin/python3 "{path}"') + print(f' > $builddir/run "{path}"') sys.exit(1) logger = logging.getLogger('device-crash-test')
Signature · 1 line
2.52.0
Re: [PATCH v4 07/17] tests: use "run" script to execute device-crash-test
Quoted 9 lines · John Snow
Instead of invoking python from the configure venv manually, instruct developers to use the "run" script instead. Change the test invocation to be a good example going forward.
Signed-off-by John Snow <[email protected]>--- .gitlab-ci.d/buildtest.yml | 6 +++--- scripts/device-crash-test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
Re: [PATCH v4 07/17] tests: use "run" script to execute device-crash-test
In reply to John SnowQuoted 9 lines · John Snow
Instead of invoking python from the configure venv manually, instruct developers to use the "run" script instead. Change the test invocation to be a good example going forward.
Signed-off-by John Snow <[email protected]>--- .gitlab-ci.d/buildtest.yml | 6 +++--- scripts/device-crash-test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v4 8/17 tests/lcitool: add python3 wheel and setuptools deps for qemu
In reply to John SnowInstalling local dependencies while offline, without PyPI access, requires the python3-setuptools and python3-wheel packages. Most distributions have these available anyway for one reason or another, but not all of them.
If you are asking yourself "Wait, aren't these packages guaranteed via installation of pip, via the ensurepip module, which mkvenv takes immense pains to provide for us?" - Well... since Python 3.13, "pip" does not actually come with "setuptools" or "wheel" anymore, and so if we want to build and install a python package, we actually need these available in the host environment.
(Note that you don't need these packages just to install a pre-built package, you only need them to *build* a package. With cutting edge setuptools and pip, all locally installed packages, even in editable mode, must be "built" first before being installed. Thus, these dependencies are being added specifically to facilitate installing qemu.git/python/qemu to the configure-time venv.)
--- .gitlab-ci.d/cirrus/freebsd-14.vars | 2 +- .gitlab-ci.d/cirrus/macos-14.vars | 2 +- .gitlab-ci.d/windows.yml | 2 ++ tests/docker/dockerfiles/alpine.docker | 2 ++ tests/docker/dockerfiles/centos9.docker | 2 ++ tests/lcitool/projects/qemu.yml | 2 ++ tests/vm/generated/freebsd.json | 2 ++ 7 files changed, 12 insertions(+), 2 deletions(-)
.gitlab-ci.d/cirrus/freebsd-14.vars +1 -1
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PACKAGING_COMMAND='pkg' PIP3='/usr/local/bin/pip' -PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka coreutils ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-sphinx py311-sphinx_rtd_theme py311-tomli python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 vulkan-tools xorriso zstd' +PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka coreutils ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-setuptools py311-sphinx py311-sphinx_rtd_theme py311-tomli py311-wheel python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 vulkan-tools xorriso zstd' PYPI_PKGS='' PYTHON='/usr/local/bin/python3'
.gitlab-ci.d/cirrus/macos-14.vars +1 -1
@@ -12,5 +12,5 @@ NINJA='/opt/homebrew/bin/ninja' PACKAGING_COMMAND='brew' PIP3='/opt/homebrew/bin/pip3' PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd' -PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli' +PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli setuptools wheel' PYTHON='/opt/homebrew/bin/python3'
.gitlab-ci.d/windows.yml +2 -0
@@ -89,6 +89,8 @@ msys2-64bit: mingw-w64-x86_64-pkgconf mingw-w64-x86_64-python mingw-w64-x86_64-python-certifi + mingw-w64-x86_64-python-setuptools + mingw-w64-x86_64-python-wheel mingw-w64-x86_64-rust mingw-w64-x86_64-rust-bindgen mingw-w64-x86_64-zstd"
tests/docker/dockerfiles/alpine.docker +2 -0
@@ -87,8 +87,10 @@ RUN apk update && \ py3-numpy \ py3-pillow \ py3-pip \ + py3-setuptools \ py3-sphinx \ py3-sphinx_rtd_theme \ + py3-wheel \ py3-yaml \ python3 \ rpm2cpio \
tests/docker/dockerfiles/centos9.docker +2 -0
@@ -101,9 +101,11 @@ RUN dnf distro-sync -y && \ python3-numpy \ python3-pillow \ python3-pip \ + python3-setuptools \ python3-sphinx \ python3-sphinx_rtd_theme \ python3-tomli \ + python3-wheel \ rdma-core-devel \ rust \ rust-std-static \
tests/lcitool/projects/qemu.yml +2 -0
@@ -98,11 +98,13 @@ packages: - python3-pillow - python3-pip - python3-PyYAML + - python3-setuptools - python3-sphinx - python3-sphinx-rtd-theme - python3-sqlite3 - python3-tomli - python3-venv + - python3-wheel - rpm2cpio - rust - rust-std
tests/vm/generated/freebsd.json +2 -0
@@ -57,9 +57,11 @@ "py311-pillow", "py311-pip", "py311-pyyaml", + "py311-setuptools", "py311-sphinx", "py311-sphinx_rtd_theme", "py311-tomli", + "py311-wheel", "python3", "rpm2cpio", "rust",
Signature · 1 line
2.52.0
Re: [PATCH v4 08/17] tests/lcitool: add python3 wheel and setuptools deps for qemu
Quoted 20 lines · John Snow
Installing local dependencies while offline, without PyPI access, requires the python3-setuptools and python3-wheel packages. Most distributions have these available anyway for one reason or another, but not all of them.
If you are asking yourself "Wait, aren't these packages guaranteed via installation of pip, via the ensurepip module, which mkvenv takes immense pains to provide for us?" - Well... since Python 3.13, "pip" does not actually come with "setuptools" or "wheel" anymore, and so if we want to build and install a python package, we actually need these available in the host environment.
(Note that you don't need these packages just to install a pre-built package, you only need them to *build* a package. With cutting edge setuptools and pip, all locally installed packages, even in editable mode, must be "built" first before being installed. Thus, these dependencies are being added specifically to facilitate installing qemu.git/python/qemu to the configure-time venv.)
Signed-off-by John Snow <[email protected]>
Quoted 9 lines
--- .gitlab-ci.d/cirrus/freebsd-14.vars | 2 +- .gitlab-ci.d/cirrus/macos-14.vars | 2 +- .gitlab-ci.d/windows.yml | 2 ++ tests/docker/dockerfiles/alpine.docker | 2 ++ tests/docker/dockerfiles/centos9.docker | 2 ++ tests/lcitool/projects/qemu.yml | 2 ++ tests/vm/generated/freebsd.json | 2 ++ 7 files changed, 12 insertions(+), 2 deletions(-)
Re: [PATCH v4 08/17] tests/lcitool: add python3 wheel and setuptools deps for qemu
In reply to John SnowQuoted 20 lines · John Snow
Installing local dependencies while offline, without PyPI access, requires the python3-setuptools and python3-wheel packages. Most distributions have these available anyway for one reason or another, but not all of them.
If you are asking yourself "Wait, aren't these packages guaranteed via installation of pip, via the ensurepip module, which mkvenv takes immense pains to provide for us?" - Well... since Python 3.13, "pip" does not actually come with "setuptools" or "wheel" anymore, and so if we want to build and install a python package, we actually need these available in the host environment.
(Note that you don't need these packages just to install a pre-built package, you only need them to *build* a package. With cutting edge setuptools and pip, all locally installed packages, even in editable mode, must be "built" first before being installed. Thus, these dependencies are being added specifically to facilitate installing qemu.git/python/qemu to the configure-time venv.)
Signed-off-by John Snow <[email protected]>
Quoted 9 lines
--- .gitlab-ci.d/cirrus/freebsd-14.vars | 2 +- .gitlab-ci.d/cirrus/macos-14.vars | 2 +- .gitlab-ci.d/windows.yml | 2 ++ tests/docker/dockerfiles/alpine.docker | 2 ++ tests/docker/dockerfiles/centos9.docker | 2 ++ tests/lcitool/projects/qemu.yml | 2 ++ tests/vm/generated/freebsd.json | 2 ++ 7 files changed, 12 insertions(+), 2 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v4 9/17 python: add vendored qemu.qmp package
In reply to John SnowIn anticipation of deleting the python/qemu/qmp source from the tree, add a vendored version of the qemu.qmp package to ensure that "make check" can be run in isolated build environments, offline.
--- python/scripts/vendor.py | 2 ++ python/wheels/qemu_qmp-0.0.5-py3-none-any.whl | Bin 0 -> 72263 bytes 2 files changed, 2 insertions(+) create mode 100644 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl
python/scripts/vendor.py +2 -0
@@ -43,6 +43,8 @@ def main() -> int: packages = { "meson==1.10.0": "4b27aafce281e652dcb437b28007457411245d975c48b5db3a797d3e93ae1585", + "qemu.qmp==0.0.5": + "e05782d6df5844b34e0d2f7c68693525da074deef7b641c1401dda6e4e3d6303", } vendor_dir = Path(__file__, "..", "..", "wheels").resolve()
python/wheels/qemu_qmp-0.0.5-py3-none-any.whl new file binary +0 -0
Signature · 1 line
2.52.0
PATCH v4 10/17 meson, mkvenv: make functional tests depend on functests group
In reply to John SnowNote that only the thorough group requires the extra testing dependencies; the quick group will run with just the "tooling" group, which we intend to install by default at configure time in a forthcoming commit.
--- tests/functional/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tests/functional/meson.build +4 -1
@@ -57,6 +57,8 @@ foreach speed : ['quick', 'thorough'] continue endif + test_deps = [roms, keymap_targets] + if speed == 'quick' suites = ['func-quick', 'func-' + target_base] target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
@@ -64,9 +66,9 @@ foreach speed : ['quick', 'thorough'] else suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed] target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, []) + test_deps += [pyvenv_functests_group] endif - test_deps = [roms, keymap_targets] test_env = environment() if have_tools test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
@@ -99,6 +101,7 @@ foreach speed : ['quick', 'thorough'] precache = custom_target('func-precache-' + testname, output: teststamp, command: [python, testpath], + depends: pyvenv_functests_group, depend_files: files(testpath), build_by_default: false, env: test_precache_env)
Signature · 1 line
2.52.0
Re: [PATCH v4 10/17] meson, mkvenv: make functional tests depend on functests group
Quoted 9 lines · John Snow
Note that only the thorough group requires the extra testing dependencies; the quick group will run with just the "tooling" group, which we intend to install by default at configure time in a forthcoming commit.
Signed-off-by John Snow <[email protected]>--- tests/functional/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v4 10/17] meson, mkvenv: make functional tests depend on functests group
In reply to John SnowQuoted 9 lines · John Snow
Note that only the thorough group requires the extra testing dependencies; the quick group will run with just the "tooling" group, which we intend to install by default at configure time in a forthcoming commit.
Signed-off-by John Snow <[email protected]>--- tests/functional/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
PATCH v4 11/17 meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml
In reply to John SnowAdd the local python package group into pythondeps.toml for the tooling This makes qemu.qmp, qemu.machine and qemu.utils packages unconditionally available for tests and scripts.
--- pythondeps.toml | 1 + 1 file changed, 1 insertion(+)
pythondeps.toml +1 -0
@@ -37,6 +37,7 @@ sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" } # system packages, or python packages we vendor. [tooling] "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" } +"$SRCROOT/python/" = { } # This test group is for functional tests, and can include dependencies # fetched from PyPI.
Signature · 1 line
2.52.0
PATCH v4 12/17 configure: unconditionally install "tooling" group
In reply to John SnowAlongside meson, always ensure our in-tree tooling group and its out-of-tree dependency, qemu.qmp, is always installed.
As a result, several "check-venv" invocations can be removed from various testing scripts.
--- configure | 2 +- .gitlab-ci.d/buildtest.yml | 2 -- scripts/device-crash-test | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-)
configure +1 -1
@@ -966,7 +966,7 @@ mkvenv="$python ${source_path}/python/scripts/mkvenv.py" # Finish preparing the virtual environment using vendored .whl files $mkvenv ensuregroup --dir "${source_path}/python/wheels" \ - ${source_path}/pythondeps.toml meson || exit 1 + ${source_path}/pythondeps.toml meson tooling || exit 1 # At this point, we expect Meson to be installed and available. # We expect mkvenv or pip to have created pyvenv/bin/meson for us.
.gitlab-ci.d/buildtest.yml +0 -2
@@ -101,7 +101,6 @@ crash-test-debian: IMAGE: debian script: - cd build - - make NINJA=":" check-venv - ./run scripts/device-crash-test -q --tcg-only ./qemu-system-i386 build-system-fedora:
@@ -158,7 +157,6 @@ crash-test-fedora: IMAGE: fedora script: - cd build - - make NINJA=":" check-venv - ./run scripts/device-crash-test -q ./qemu-system-ppc - ./run scripts/device-crash-test -q ./qemu-system-riscv32
scripts/device-crash-test +1 -2
@@ -40,8 +40,7 @@ try: except ModuleNotFoundError as exc: path = Path(__file__).resolve() print(f"Module '{exc.name}' not found.") - print(" Try 'make check-venv' from your build directory,") - print(" and then one way to run this script is like so:") + print(" Try running this script like so:") print(f' > $builddir/run "{path}"') sys.exit(1)
Signature · 1 line
2.52.0
Re: [PATCH v4 12/17] configure: unconditionally install "tooling" group
Quoted 6 lines · John Snow
Alongside meson, always ensure our in-tree tooling group and its out-of-tree dependency, qemu.qmp, is always installed.
As a result, several "check-venv" invocations can be removed from various testing scripts.
Quoted 6 lines
Signed-off-by John Snow <[email protected]>--- configure | 2 +- .gitlab-ci.d/buildtest.yml | 2 -- scripts/device-crash-test | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v4 12/17] configure: unconditionally install "tooling" group
In reply to John SnowQuoted 8 lines · John Snow
Alongside meson, always ensure our in-tree tooling group and its out-of-tree dependency, qemu.qmp, is always installed.
As a result, several "check-venv" invocations can be removed from various testing scripts.
Signed-off-by John Snow <[email protected]>---
PATCH v4 13/17 tests: remove "make check-venv" target
In reply to John SnowWith the qemu.qmp and qemu.machine dependencies now installed by default at configure time and additional dependencies required by functional testing installed on demand, there is no longer any reason to have an explicit target.
FIXME: This forces image regeneration for vm tests whenever Make determines that the image needs to be rebuilt; which is a regression over the previous behavior.
--- tests/Makefile.include | 22 ++-------------------- tests/vm/Makefile.include | 24 +++++++----------------- 2 files changed, 9 insertions(+), 37 deletions(-)
tests/Makefile.include +2 -20
@@ -21,7 +21,6 @@ ifneq ($(filter $(all-check-targets), check-softfloat),) endif @echo @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report" - @echo " $(MAKE) check-venv Creates a Python venv for tests" @echo " $(MAKE) check-clean Clean the tests and related data" @echo @echo "The following are useful for CI builds"
@@ -92,33 +91,16 @@ clean-tcg: $(CLEAN_TCG_TARGET_RULES) .PHONY: distclean-tcg distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES) -# Python venv for running tests - -.PHONY: check-venv - # Build up our target list from the filtered list of ninja targets TARGETS=$(patsubst libqemu-%.a, %, $(filter libqemu-%.a, $(ninja-targets))) -TESTS_VENV_TOKEN=$(BUILD_DIR)/pyvenv/tests.group - -quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \ - $(PYTHON) -m pip -q --disable-pip-version-check $1, \ - "VENVPIP","$1") - -$(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml - $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/") - $(MKVENV_ENSUREGROUP) $< tooling functests - $(call quiet-command, touch $@) - -check-venv: $(TESTS_VENV_TOKEN) - FUNCTIONAL_TARGETS=$(patsubst %-softmmu,check-functional-%, $(filter %-softmmu,$(TARGETS))) .PHONY: $(FUNCTIONAL_TARGETS) -$(FUNCTIONAL_TARGETS): check-venv +$(FUNCTIONAL_TARGETS): @$(MAKE) SPEED=thorough $(subst -functional,-func,$@) .PHONY: check-functional -check-functional: check-venv +check-functional: @$(NINJA) precache-functional @$(PYTHON) $(SRC_PATH)/scripts/clean_functional_cache.py @QEMU_TEST_NO_DOWNLOAD=1 $(MAKE) SPEED=thorough check-func check-func-quick
tests/vm/Makefile.include +7 -17
@@ -1,14 +1,5 @@ # Makefile for VM tests -# Hack to allow running in an unconfigured build tree -ifeq ($(realpath $(SRC_PATH)),$(realpath .)) -VM_PYTHON = PYTHONPATH=$(SRC_PATH)/python /usr/bin/env python3 -VM_VENV = -else -VM_PYTHON = $(PYTHON) -VM_VENV = check-venv -endif - .PHONY: vm-build-all vm-clean-all EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd)
@@ -90,11 +81,10 @@ vm-clean-all: $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ $(SRC_PATH)/tests/vm/basevm.py \ - $(SRC_PATH)/tests/vm/Makefile.include \ - $(VM_VENV) + $(SRC_PATH)/tests/vm/Makefile.include @mkdir -p $(IMAGES_DIR) $(call quiet-command, \ - $(VM_PYTHON) $< \ + $(PYTHON) $< \ $(if $(V)$(DEBUG), --debug) \ $(if $(GENISOIMAGE),--genisoimage $(GENISOIMAGE)) \ $(if $(QEMU_LOCAL),--build-path $(BUILD_DIR)) \
@@ -102,14 +92,14 @@ $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ $(if $(LOG_CONSOLE),--log-console) \ --source-path $(SRC_PATH) \ --image "$@" \ - $(if $(filter-out check-venv, $?), --force) \ + --force \ --build-image $@, \ " VM-IMAGE $*") # Build in VM $(IMAGE) -vm-build-%: $(IMAGES_DIR)/%.img $(VM_VENV) +vm-build-%: $(IMAGES_DIR)/%.img $(call quiet-command, \ - $(VM_PYTHON) $(SRC_PATH)/tests/vm/$* \ + $(PYTHON) $(SRC_PATH)/tests/vm/$* \ $(if $(V)$(DEBUG), --debug) \ $(if $(DEBUG), --interactive) \ $(if $(J),--jobs $(J)) \
@@ -133,9 +123,9 @@ vm-boot-serial-%: $(IMAGES_DIR)/%.img -device virtio-net-pci,netdev=vnet \ || true -vm-boot-ssh-%: $(IMAGES_DIR)/%.img $(VM_VENV) +vm-boot-ssh-%: $(IMAGES_DIR)/%.img $(call quiet-command, \ - $(VM_PYTHON) $(SRC_PATH)/tests/vm/$* \ + $(PYTHON) $(SRC_PATH)/tests/vm/$* \ $(if $(J),--jobs $(J)) \ $(if $(V)$(DEBUG), --debug) \ $(if $(QEMU_LOCAL),--build-path $(BUILD_DIR)) \
Signature · 1 line
2.52.0
Re: [PATCH v4 13/17] tests: remove "make check-venv" target
Quoted 9 lines · John Snow
With the qemu.qmp and qemu.machine dependencies now installed by default at configure time and additional dependencies required by functional testing installed on demand, there is no longer any reason to have an explicit target.
FIXME: This forces image regeneration for vm tests whenever Make determines that the image needs to be rebuilt; which is a regression over the previous behavior.
Quoted 5 lines
Signed-off-by John Snow <[email protected]>--- tests/Makefile.include | 22 ++-------------------- tests/vm/Makefile.include | 24 +++++++----------------- 2 files changed, 9 insertions(+), 37 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v4 14/17 scripts: nudge users to use 'run' script for scripts that import qemu.qmp
In reply to John SnowNow that qmp has to be installed and isn't local, we can no longer offer a simple forwarder for these scripts (nor path hacks) and hope that it works. Encourage users to use the 'run' script to use these scripts instead.
--- scripts/compare-machine-types.py | 7 ++----- scripts/qmp/qemu-ga-client | 13 ++++++------- scripts/qmp/qmp-shell | 13 ++++++------- scripts/qmp/qmp-shell-wrap | 13 ++++++------- scripts/qmp/qom-fuse | 13 ++++++------- scripts/qmp/qom-get | 13 ++++++------- scripts/qmp/qom-list | 13 ++++++------- scripts/qmp/qom-set | 13 ++++++------- scripts/qmp/qom-tree | 13 ++++++------- scripts/qmp_helper.py | 9 ++------- scripts/render_block_graph.py | 10 +++++++--- scripts/simplebench/bench_block_job.py | 10 +++++++--- tests/migration-stress/guestperf/engine.py | 15 ++++++++++++--- 13 files changed, 78 insertions(+), 77 deletions(-)
scripts/compare-machine-types.py +2 -5
@@ -27,19 +27,16 @@ # along with this program; if not, see <http://www.gnu.org/licenses/>. import sys -from os import path from argparse import ArgumentParser, RawTextHelpFormatter, Namespace import pandas as pd from contextlib import ExitStack from typing import Optional, List, Dict, Generator, Tuple, Union, Any, Set try: - qemu_dir = path.abspath(path.dirname(path.dirname(__file__))) - sys.path.append(path.join(qemu_dir, 'python')) from qemu.machine import QEMUMachine except ModuleNotFoundError as exc: - print(f"Module '{exc.name}' not found.") - print("Try export PYTHONPATH=top-qemu-dir/python or run from top-qemu-dir") + print(f"Module '{exc.name}' not found.", file=sys.stderr) + print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr) sys.exit(1)
scripts/qmp/qemu-ga-client +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils import qemu_ga_client - - -if __name__ == '__main__': - sys.exit(qemu_ga_client.main()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qemu-ga-client [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qmp-shell +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.qmp import qmp_shell - - -if __name__ == '__main__': - qmp_shell.main() +print( + "This script has moved; after running configure," + " please use '$builddir/run qmp-shell [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qmp-shell-wrap +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.qmp import qmp_shell - - -if __name__ == '__main__': - qmp_shell.main_wrap() +print( + "This script has moved; after running configure," + " please use '$builddir/run qmp-shell-wrap [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-fuse +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom_fuse import QOMFuse - - -if __name__ == '__main__': - sys.exit(QOMFuse.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-fuse [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-get +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMGet - - -if __name__ == '__main__': - sys.exit(QOMGet.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-get [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-list +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMList - - -if __name__ == '__main__': - sys.exit(QOMList.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-list [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-set +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMSet - - -if __name__ == '__main__': - sys.exit(QOMSet.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-set [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-tree +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMTree - - -if __name__ == '__main__': - sys.exit(QOMTree.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-tree [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp_helper.py +2 -7
@@ -13,17 +13,12 @@ import sys from datetime import datetime -from os import path as os_path try: - qemu_dir = os_path.abspath(os_path.dirname(os_path.dirname(__file__))) - sys.path.append(os_path.join(qemu_dir, 'python')) - from qemu.qmp.legacy import QEMUMonitorProtocol - except ModuleNotFoundError as exc: - print(f"Module '{exc.name}' not found.") - print("Try export PYTHONPATH=top-qemu-dir/python or run from top-qemu-dir") + print(f"Module '{exc.name}' not found.", file=sys.stderr) + print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr) sys.exit(1) from base64 import b64encode
scripts/render_block_graph.py +7 -3
@@ -24,9 +24,13 @@ import json from graphviz import Digraph -sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python')) -from qemu.qmp import QMPError -from qemu.qmp.legacy import QEMUMonitorProtocol +try: + from qemu.qmp import QMPError + from qemu.qmp.legacy import QEMUMonitorProtocol +except ModuleNotFoundError as exc: + print(f"Module '{exc.name}' not found.", file=sys.stderr) + print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr) + sys.exit(1) def perm(arr):
scripts/simplebench/bench_block_job.py +7 -3
@@ -25,9 +25,13 @@ import socket import json -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.machine import QEMUMachine -from qemu.qmp import ConnectError +try: + from qemu.machine import QEMUMachine + from qemu.qmp import ConnectError +except ModuleNotFoundError as exc: + print(f"Module '{exc.name}' not found.", file=sys.stderr) + print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr) + sys.exit(1) def bench_block_job(cmd, cmd_args, qemu_args):
tests/migration-stress/guestperf/engine.py +12 -3
@@ -27,9 +27,18 @@ from guestperf.report import Report, ReportResult from guestperf.timings import TimingRecord, Timings -sys.path.append(os.path.join(os.path.dirname(__file__), - '..', '..', '..', 'python')) -from qemu.machine import QEMUMachine +try: + from qemu.machine import QEMUMachine +except ModuleNotFoundError as exc: + print( + f"Module '{exc.name}' not found.\n" + "It should be installed as part of the configure-time " + "virtual environment in $builddir/pyvenv.\n" + "Try re-running this script as:\n" + f"> $builddir/run {' '.join(sys.argv)}", + file=sys.stderr + ) + sys.exit(1) # multifd supported compression algorithms MULTIFD_CMP_ALGS = ("zlib", "zstd", "qpl", "uadk")
Signature · 1 line
2.52.0
Re: [PATCH v4 14/17] scripts: nudge users to use 'run' script for scripts that import qemu.qmp
Quoted 6 lines · John Snow
Now that qmp has to be installed and isn't local, we can no longer offer a simple forwarder for these scripts (nor path hacks) and hope that it works. Encourage users to use the 'run' script to use these scripts instead.
Signed-off-by John Snow <[email protected]>
Quoted 15 lines
--- scripts/compare-machine-types.py | 7 ++----- scripts/qmp/qemu-ga-client | 13 ++++++------- scripts/qmp/qmp-shell | 13 ++++++------- scripts/qmp/qmp-shell-wrap | 13 ++++++------- scripts/qmp/qom-fuse | 13 ++++++------- scripts/qmp/qom-get | 13 ++++++------- scripts/qmp/qom-list | 13 ++++++------- scripts/qmp/qom-set | 13 ++++++------- scripts/qmp/qom-tree | 13 ++++++------- scripts/qmp_helper.py | 9 ++------- scripts/render_block_graph.py | 10 +++++++--- scripts/simplebench/bench_block_job.py | 10 +++++++--- tests/migration-stress/guestperf/engine.py | 15 ++++++++++++--- 13 files changed, 78 insertions(+), 77 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v4 15/17 python: delete qemu.qmp
In reply to John SnowStart relying on the external python-qemu-qmp dependency instead, to prevent desync between the internal and external libraries.
This library is now entirely independent; to contribute changes, see
https://gitlab.com/qemu-project/python-qemu-qmp/
--- python/qemu/qmp/__init__.py | 60 -- python/qemu/qmp/error.py | 53 -- python/qemu/qmp/events.py | 751 ---------------------- python/qemu/qmp/legacy.py | 339 ---------- python/qemu/qmp/message.py | 217 ------- python/qemu/qmp/models.py | 146 ----- python/qemu/qmp/protocol.py | 1101 --------------------------------- python/qemu/qmp/py.typed | 0 python/qemu/qmp/qmp_client.py | 732 ---------------------- python/qemu/qmp/qmp_shell.py | 689 --------------------- python/qemu/qmp/qmp_tui.py | 665 -------------------- python/qemu/qmp/util.py | 150 ----- python/qemu/utils/qom_fuse.py | 1 - python/setup.cfg | 31 +- python/tests/minreqs.txt | 8 +- python/tests/protocol.py | 596 ------------------ 16 files changed, 6 insertions(+), 5533 deletions(-) delete mode 100644 python/qemu/qmp/__init__.py delete mode 100644 python/qemu/qmp/error.py delete mode 100644 python/qemu/qmp/events.py delete mode 100644 python/qemu/qmp/legacy.py delete mode 100644 python/qemu/qmp/message.py delete mode 100644 python/qemu/qmp/models.py delete mode 100644 python/qemu/qmp/protocol.py delete mode 100644 python/qemu/qmp/py.typed delete mode 100644 python/qemu/qmp/qmp_client.py delete mode 100644 python/qemu/qmp/qmp_shell.py delete mode 100644 python/qemu/qmp/qmp_tui.py delete mode 100644 python/qemu/qmp/util.py delete mode 100644 python/tests/protocol.py
python/qemu/qmp/__init__.py deleted +0 -60
@@ -1,60 +0,0 @@ -""" -QEMU Monitor Protocol (QMP) development library & tooling. - -This package provides a fairly low-level class for communicating -asynchronously with QMP protocol servers, as implemented by QEMU, the -QEMU Guest Agent, and the QEMU Storage Daemon. - -`QMPClient` provides the main functionality of this package. All errors -raised by this library derive from `QMPError`, see `qmp.error` for -additional detail. See `qmp.events` for an in-depth tutorial on -managing QMP events. -""" - -# Copyright (C) 2020-2022 John Snow for Red Hat, Inc. -# -# Authors: -# John Snow <[email protected]> -# -# Based on earlier work by Luiz Capitulino <[email protected]>. -# -# This work is licensed under the terms of the GNU LGPL, version 2 or -# later. See the COPYING file in the top-level directory. - -import logging - -from .error import QMPError -from .events import EventListener -from .message import Message -from .protocol import ( - ConnectError, - Runstate, - SocketAddrT, - StateError, -) -from .qmp_client import ExecInterruptedError, ExecuteError, QMPClient - - -# Suppress logging unless an application engages it. -logging.getLogger('qemu.qmp').addHandler(logging.NullHandler()) - - -# IMPORTANT: When modifying this list, update the Sphinx overview docs. -# Anything visible in the qemu.qmp namespace should be on the overview page. -__all__ = ( - # Classes, most to least important - 'QMPClient', - 'Message', - 'EventListener', - 'Runstate', - - # Exceptions, most generic to most explicit - 'QMPError', - 'StateError', - 'ConnectError', - 'ExecuteError', - 'ExecInterruptedError', - - # Type aliases - 'SocketAddrT', -)
python/qemu/qmp/error.py deleted +0 -53
53 lines not on this page · raw message
python/qemu/qmp/events.py deleted +0 -751
751 lines not on this page · raw message
python/qemu/qmp/legacy.py deleted +0 -339
339 lines not on this page · raw message
python/qemu/qmp/message.py deleted +0 -217
217 lines not on this page · raw message
python/qemu/qmp/models.py deleted +0 -146
146 lines not on this page · raw message
python/qemu/qmp/protocol.py deleted +0 -1101
1,101 lines not on this page · raw message
python/qemu/qmp/py.typed deleted +0 -0
python/qemu/qmp/qmp_client.py deleted +0 -732
333 lines not on this page · raw message
python/qemu/qmp/qmp_shell.py deleted +0 -689
689 lines not on this page · raw message
python/qemu/qmp/qmp_tui.py deleted +0 -665
665 lines not on this page · raw message
python/qemu/qmp/util.py deleted +0 -150
150 lines not on this page · raw message
python/tests/protocol.py deleted +0 -596
596 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.52.0
Part of the diff is not shown here. View the raw message.
PATCH v4 16/17 python: update README.rst to reflect qemu.qmp's removal
In reply to John SnowIt is no longer simply possible to just use this directory as if it were an installed package now that it has dependencies, so update the README to reflect this.
--- python/README.rst | 50 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-)
python/README.rst +43 -7
@@ -3,7 +3,17 @@ QEMU Python Tooling This directory houses Python tooling used by the QEMU project to build, configure, and test QEMU. It is organized by namespace (``qemu``), and -then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc). +then by package (e.g. ``qemu/machine``, ``qemu/utils``, etc). + +These tools and libraries are installed to the QEMU configure-time +Python virtual environment by default (see qemu.git/pythondeps.toml +"tooling" group), and are available for use by any Python script +executed by the build system. To have these libraries available for +manual invocations of scripts, use of the "run" script executable in +your build directory is recommended. + +General structure +----------------- ``setup.py`` is used by ``pip`` to install this tooling to the current environment. ``setup.cfg`` provides the packaging configuration used by
@@ -20,9 +30,9 @@ environment. ``setup.cfg`` provides the packaging configuration used by If you append the ``--editable`` or ``-e`` argument to either invocation above, pip will install in "editable" mode. This installs the package as -a forwarder ("qemu.egg-link") that points to the source tree. In so -doing, the installed package always reflects the latest version in your -source tree. +a forwarder that points to the source tree. In so doing, the installed +package always reflects the latest version in your source tree. This is +the mode used to install these packages at configure time. Installing ".[devel]" instead of "." will additionally pull in required packages for testing this package. They are not runtime requirements,
@@ -40,8 +50,18 @@ for more information. Using these packages without installing them -------------------------------------------- -These packages may be used without installing them first, by using one -of two tricks: +It is no longer recommended to try to use these packages without +installing them to a virtual environment, but depending on your use +case, it may still be possible to do. + +The "qemu.qmp" library is now hosted outside of the qemu.git repository, +and the "qemu.machine" library that remains in-tree here has qemu.qmp as +a dependency. It is possible to install "qemu.qmp" independently and +then use the rest of these packages without installing them, but be +advised that if future dependencies are introduced, bypassing the +installation phase may introduce breakages to your script in the future. + +That said, you can use these packages without installing them by either: 1. Set your PYTHONPATH environment variable to include this source directory, e.g. ``~/src/qemu/python``. See
@@ -61,8 +81,24 @@ invoke them without installation, you can invoke e.g.: ``> PYTHONPATH=~/src/qemu/python python3 -m qemu.qmp.qmp_shell`` +Or, with the runscript available in the QEMU build directory, simply: + +``> $builddir/run qmp-shell`` + The mappings between console script name and python module path can be -found in ``setup.cfg``. +found in ``setup.cfg``, but the console scripts available are listed +here for reference: + +* ``qemu-ga-client`` +* ``qmp-shell`` +* ``qmp-shell-wrap`` +* ``qmp-tui`` (prototype urwid interface for async QMP) +* ``qom`` +* ``qom-fuse`` (requires fusepy to be installed!) +* ``qom-get`` +* ``qom-list`` +* ``qom-set`` +* ``qom-tree`` Files in this directory
Signature · 1 line
2.52.0
Re: [PATCH v4 16/17] python: update README.rst to reflect qemu.qmp's removal
Quoted 16 lines · John Snow
It is no longer simply possible to just use this directory as if it were an installed package now that it has dependencies, so update the README to reflect this.
Signed-off-by John Snow <[email protected]>--- python/README.rst | 50 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-)python/README.rst +0
-0@@ -3,7 +3,17 @@ QEMU Python Tooling This directory houses Python tooling used by the QEMU project to build,
python/README.rst QEMU Python Tooling · line 13
Quoted 10 lines
python/README.rst +8
-1configure, and test QEMU. It is organized by namespace (``qemu``), and -then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc). +then by package (e.g. ``qemu/machine``, ``qemu/utils``, etc). + +These tools and libraries are installed to the QEMU configure-time +Python virtual environment by default (see qemu.git/pythondeps.toml +"tooling" group), and are available for use by any Python script +executed by the build system. To have these libraries available for +manual invocations of scripts, use of the "run" script executable in +your build directory is recommended.
s/executable//, it is just a "script"
python/README.rst invoke them without installation, you can invoke e.g.: · line 84
Quoted 5 lines
python/README.rst +1
-0@@ -61,8 +81,24 @@ invoke them without installation, you can invoke e.g.: ``> PYTHONPATH=~/src/qemu/python python3 -m qemu.qmp.qmp_shell`` +Or, with the runscript available in the QEMU build directory, simply:
s/runscript/run script/
Quoted 8 lines
python/README.rst +6
-1+ +``> $builddir/run qmp-shell`` + The mappings between console script name and python module path can be -found in ``setup.cfg``. +found in ``setup.cfg``, but the console scripts available are listed +here for reference: +
python/README.rst invoke them without installation, you can invoke e.g.: · line 101
Quoted 10 lines
python/README.rst +10
-0+* ``qemu-ga-client`` +* ``qmp-shell`` +* ``qmp-shell-wrap`` +* ``qmp-tui`` (prototype urwid interface for async QMP) +* ``qom`` +* ``qom-fuse`` (requires fusepy to be installed!) +* ``qom-get`` +* ``qom-list`` +* ``qom-set`` +* ``qom-tree``
Those scripts all exist in $GIT/scripts/qmp/. Are you saying that they get installed into the venv now ? If so, should this series also delete scripts/qmp ?
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v4 16/17] python: update README.rst to reflect qemu.qmp's removal
Quoted 17 lines · Daniel P. Berrangé
Quoted 15 lines · John Snow
It is no longer simply possible to just use this directory as if it were an installed package now that it has dependencies, so update the README to reflect this.
Signed-off-by John Snow <[email protected]>--- python/README.rst | 50 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-)python/README.rst +0
-0@@ -3,7 +3,17 @@ QEMU Python Tooling
Quoted 13 lines
python/README.rst QEMU Python Tooling · line 13
Quoted 11 lines
python/README.rst +8
-1This directory houses Python tooling used by the QEMU project to build, configure, and test QEMU. It is organized by namespace (``qemu``), and -then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc). +then by package (e.g. ``qemu/machine``, ``qemu/utils``, etc). + +These tools and libraries are installed to the QEMU configure-time +Python virtual environment by default (see qemu.git/pythondeps.toml +"tooling" group), and are available for use by any Python script +executed by the build system. To have these libraries available for +manual invocations of scripts, use of the "run" script executable in +your build directory is recommended.s/executable//, it is just a "script"
ATM machine, HIV virus, LCD display ... (oops)
Quoted 23 lines
python/README.rst invoke them without installation, you can invoke e.g.: · line 84
Quoted 6 lines
python/README.rst +1
-0@@ -61,8 +81,24 @@ invoke them without installation, you can invoke e.g.: ``> PYTHONPATH=~/src/qemu/python python3 -m qemu.qmp.qmp_shell`` +Or, with the runscript available in the QEMU build directory, simply:s/runscript/run script/
Quoted 14 lines
python/README.rst +12
-1+ +``> $builddir/run qmp-shell`` + The mappings between console script name and python module path can be -found in ``setup.cfg``. +found in ``setup.cfg``, but the console scripts available are listed +here for reference: + +* ``qemu-ga-client`` +* ``qmp-shell`` +* ``qmp-shell-wrap`` +* ``qmp-tui`` (prototype urwid interface for async QMP) +* ``qom`` +* ``qom-fuse`` (requires fusepy to be installed!)
Quoted 8 lines
python/README.rst invoke them without installation, you can invoke e.g.: · line 101
Quoted 4 lines
python/README.rst +4
-0+* ``qom-get`` +* ``qom-list`` +* ``qom-set`` +* ``qom-tree``Those scripts all exist in $GIT/scripts/qmp/. Are you saying that they get installed into the venv now ? If so, should this series also delete
scripts/qmp?
Right, those files are all long since obsolete. For the past several years, they've been simple forwarders to the real scripts. However, I thought it was good to leave the stubs there for a little while to teach people where they now live as a bid to increase discoverability of the scripts. I was afraid that if I deleted them outright, they'd become functionally invisible to most people. After all, we only JUST added that run script, so it may not yet be established knowledge that the meson development venv comes with various "goodies" that we promise will work, so I was concerned people may not know how to find them.
Quoted 8 lines
With regards,
Daniel
--|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v4 17/17 RFC: exclude pyvenv targets from "make check-build"
In reply to John SnowThis patch removes python venv preparation steps from "make check-build".
Thomas pointed out that "make check-build" was installing all venv preparation targets, which may or may not be desired. In case it isn't desired, this patch showcases a crude hack to bypass it.
--- scripts/mtest2make.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/mtest2make.py +3 -1
@@ -82,9 +82,11 @@ def emit_prolog(suites, prefix): def emit_suite(name, suite, prefix): deps = ' '.join(suite.deps) + testdeps = ' '.join([x for x in suite.deps if 'pyvenv' not in x]) print() print(f'.{prefix}-{name}.deps = {deps}') - print(f'.ninja-goals.check-build += $(.{prefix}-{name}.deps)') + print(f'.{prefix}-{name}.testdeps = {testdeps}') + print(f'.ninja-goals.check-build += $(.{prefix}-{name}.testdeps)') names = ' '.join(suite.names(name)) targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml'
Signature · 1 line
2.52.0
Quoted 8 lines · John Snow
Hello!
This series drops the in-tree version of our python-qemu-qmp package ("qemu.qmp") in favor of the version hosted on PyPI, whose repository is located at https://gitlab.com/qemu-project/python-qemu-qmp.
GitLab CI: https://gitlab.com/jsnow/qemu/-/pipelines/2272170300
Current status of this series: all patches reviewed by either Thomas, Dan or Vladimir; except:
[PATCH v4 04/17] python/mkvenv: add mechanism to install local package(s)
- Review from Paolo would be nice, if he has the time.
[PATCH v4 05/17] meson, mkvenv: add functests custom target
- Fixed comments as per Dan's review
[PATCH v4 11/17] meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml
- Probably fine, but a Paolo ACK would be nice.
[PATCH v4 13/17] tests: remove "make check-venv" target
- I regress an optimization Alex Bennee made, would like to fix
this before merge.
[PATCH v4 16/17] python: update README.rst to reflect qemu.qmp's removal
- Discussing this with Dan
[PATCH v4 17/17] RFC: exclude pyvenv targets from "make check-build"
- Still not clear if we want this or not, I'm pretty neutral.
Quoted 164 lines
This version reflects Dan's suggestion to always install the in-tree Python packages by default.
The major effects of this patch series are:
1. qemu.qmp and the python/ directory will be installed to the configure-time venv (build/pyvenv) by default.
2. qemu.qmp will be installed from PyPI or vendored packages instead of being utilized directly from the qemu.git tree.
3. "make check-venv" is removed as it is no longer needed.
4. functional test dependencies are installed as-needed when running those tests.
5. Unfortunately, python3-wheel and python3-setuptools are now required on the host system if tests are to be executed and >= Python 3.13 is used.
6. An awful lot of deleted lines of code, and a lot fewer headaches managing two nearly-identical copies of this source code. O:-)v4:
- Rename "checktests" group to "tooling", install it by default alongside meson at configure-time.
- Remove "check-venv" entirely.
- Updatepython/README.rstto reflect the new paradigm
- Update many scripts that import qemu.qmp to give new errors when they are run outside of the configure venvKNOWN ISSUES IN V4:
- The last patch is an RFC based on Thomas' observations, I don't have a strong opinion on if we want it or not.
- Removing "make check-venv" causes the VM tests to rebuild more often; I was not sure how to replace the old conditional behavior in an equivalent manner. Suggestions, anyone...?v3:
- Fixed FreeBSD vm test
- Fixed Cirrus macOS test (Needed setuptools as a dep, "file:///" had one too many forward slashes, which works fine for older pip/setuptools, but was incompatibly fixed recently.)
- Fixed an issue that prevented installing the local python packages in an offline, isolated build environment (need --no-isolated-build and pip environment variable flags)
- Added the python3-wheel and python3-setuptools build dependencies to lcitool, owing to the above issues
- Ensured that the $download flag (for PyPI access) from configure is carried over into pytest/meson.build invocations. This defaults to "enabled", so test dependencies should not have any issue being fetched on most developer workstations and build environments.
- Fixed several bugs in themkvenv.pylocal package installation mechanism.
- Flags and workarounds added for installing local packages offline now apply *only* to local package installations, and not "normal" depspecs.
- Reordered patches into more logical "phases" for easier review (I hope...?)Known issues: "make check-build" still installs all of the test dependencies to the pyvenv. I'm not sure if this is desired or not, but I ran into problems preventing it from doing this without breaking a ton of CI tests. I'll continue to investigate this, but wanted to send this v3 out.
v2:
- move "make check-venv" earlier in GitLab CI/CD pipeline, to avoid re-running configure
- Fix functional tests not using PyPI to fetch pygdbmi package
- Remove pre-requisites which are now merged--js
John Snow (17):
python/mkvenv: create timestamp file for each group "ensured" python/mkvenv: bump 'qemu.qmp' dependency for testdeps python/mkvenv: add 'tooling' and 'functests' dependency groups python/mkvenv: add mechanism to install local package(s) meson, mkvenv: add functests custom target
tests: Use configured python to run GitLab iotests
tests: use "run" script to execute device-crash-test tests/lcitool: add python3 wheel and setuptools deps for qemu
python: add vendored qemu.qmp package
meson, mkvenv: make functional tests depend on functests group meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml
configure: unconditionally install "tooling" group
tests: remove "make check-venv" target
scripts: nudge users to use 'run' script for scripts that import
qemu.qmp
python: delete qemu.qmp
python: updateREADME.rstto reflect qemu.qmp's removal
RFC: exclude pyvenv targets from "make check-build"python/README.rst | 50 +- configure | 2 +- meson.build | 1 + .gitlab-ci.d/buildtest.yml | 26 +- .gitlab-ci.d/cirrus/freebsd-14.vars | 2 +- .gitlab-ci.d/cirrus/macos-14.vars | 2 +- .gitlab-ci.d/windows.yml | 2 + python/qemu/qmp/__init__.py | 60 - python/qemu/qmp/error.py | 53 - python/qemu/qmp/events.py | 751 ----------- python/qemu/qmp/legacy.py | 339 ----- python/qemu/qmp/message.py | 217 ---- python/qemu/qmp/models.py | 146 --- python/qemu/qmp/protocol.py | 1101 ----------------- python/qemu/qmp/py.typed | 0 python/qemu/qmp/qmp_client.py | 732 ----------- python/qemu/qmp/qmp_shell.py | 689 ----------- python/qemu/qmp/qmp_tui.py | 665 ---------- python/qemu/qmp/util.py | 150 --- python/qemu/utils/qom_fuse.py | 1 - python/scripts/mkvenv.py | 44 +- python/scripts/vendor.py | 2 + python/setup.cfg | 31 +- python/tests/minreqs.txt | 8 +- python/tests/protocol.py | 596 --------- python/wheels/qemu_qmp-0.0.5-py3-none-any.whl | Bin 0 -> 72263 bytes pythondeps.toml | 13 +- pyvenv/meson.build | 28 + scripts/compare-machine-types.py | 7 +- scripts/device-crash-test | 5 +- scripts/mtest2make.py | 4 +- scripts/qmp/qemu-ga-client | 13 +- scripts/qmp/qmp-shell | 13 +- scripts/qmp/qmp-shell-wrap | 13 +- scripts/qmp/qom-fuse | 13 +- scripts/qmp/qom-get | 13 +- scripts/qmp/qom-list | 13 +- scripts/qmp/qom-set | 13 +- scripts/qmp/qom-tree | 13 +- scripts/qmp_helper.py | 9 +- scripts/render_block_graph.py | 10 +- scripts/simplebench/bench_block_job.py | 10 +- tests/Makefile.include | 22 +- tests/docker/dockerfiles/alpine.docker | 2 + tests/docker/dockerfiles/centos9.docker | 2 + tests/functional/meson.build | 5 +- tests/lcitool/projects/qemu.yml | 2 + tests/migration-stress/guestperf/engine.py | 15 +- tests/vm/Makefile.include | 24 +- tests/vm/generated/freebsd.json | 2 + 50 files changed, 250 insertions(+), 5684 deletions(-) delete mode 100644 python/qemu/qmp/__init__.py delete mode 100644 python/qemu/qmp/error.py delete mode 100644 python/qemu/qmp/events.py delete mode 100644 python/qemu/qmp/legacy.py delete mode 100644 python/qemu/qmp/message.py delete mode 100644 python/qemu/qmp/models.py delete mode 100644 python/qemu/qmp/protocol.py delete mode 100644 python/qemu/qmp/py.typed delete mode 100644 python/qemu/qmp/qmp_client.py delete mode 100644 python/qemu/qmp/qmp_shell.py delete mode 100644 python/qemu/qmp/qmp_tui.py delete mode 100644 python/qemu/qmp/util.py delete mode 100644 python/tests/protocol.py create mode 100644 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl create mode 100644 pyvenv/meson.build--
2.52.0