From 63596521d0877855dc1c69a1fae322ca5356ef56 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Thu, 4 Aug 2022 19:25:38 +0000 Subject: [PATCH] Accepting request 990258 from home:bnavigator:branches:Virtualization - Add Source URL - Add upstream patch virtman-pr381-setuptools-61.patch gh#virt-manager/virt-manager#381 - Enable tests * No python package should go untested * Use multibuild so that all runtime requirements are checked * Add virtman-34662fe-argcomplete.patch OBS-URL: https://build.opensuse.org/request/show/990258 OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=570 --- _multibuild | 3 ++ virt-manager.changes | 11 +++++++ virt-manager.spec | 55 ++++++++++++++++++++++++++++--- virtman-34662fe-argcomplete.patch | 40 ++++++++++++++++++++++ virtman-pr381-setuptools-61.patch | 31 +++++++++++++++++ 5 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 _multibuild create mode 100644 virtman-34662fe-argcomplete.patch create mode 100644 virtman-pr381-setuptools-61.patch diff --git a/_multibuild b/_multibuild new file mode 100644 index 00000000..83bd4e96 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + test + diff --git a/virt-manager.changes b/virt-manager.changes index f848020d..dd66ec2e 100644 --- a/virt-manager.changes +++ b/virt-manager.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Tue Jul 19 10:03:04 UTC 2022 - Ben Greiner + +- Add Source URL +- Add upstream patch virtman-pr381-setuptools-61.patch + gh#virt-manager/virt-manager#381 +- Enable tests + * No python package should go untested + * Use multibuild so that all runtime requirements are checked + * Add virtman-34662fe-argcomplete.patch + ------------------------------------------------------------------- Tue Jul 12 14:41:21 MDT 2022 - carnold@suse.com diff --git a/virt-manager.spec b/virt-manager.spec index 780e45a6..ef4d29a4 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -1,5 +1,5 @@ # -# spec file for package virt-manager +# spec file # # Copyright (c) 2022 SUSE LLC # @@ -20,20 +20,31 @@ %global with_guestfs 0 %global default_hvs "qemu,xen,lxc" -Name: virt-manager +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "test" +%bcond_without test +%define psuffix -%{flavor} +%else +%bcond_with test +%define psuffix %{nil} +%endif + +Name: virt-manager%{psuffix} Version: 4.0.0 Release: 0 Summary: Virtual Machine Manager License: GPL-2.0-or-later Group: System/Monitoring URL: http://virt-manager.org/ -Source0: %{name}-%{version}.tar.gz +Source0: https://virt-manager.org/download/sources/virt-manager/virt-manager-%{version}.tar.gz Source1: virt-install.rb Source2: virt-install.desktop Source3: virt-manager-supportconfig # Upstream Patches Patch1: revert-363fca41-virt-install-Require-osinfo-for-non-x86-HVM-case-too.patch Patch2: d51541e1-Fix-UI-rename-with-firmware-efi.patch +Patch3: https://github.com/virt-manager/virt-manager/pull/381.patch#/virtman-pr381-setuptools-61.patch +Patch4: https://github.com/virt-manager/virt-manager/commit/34662fecc9535c7d8d0a8e7d42fafa4b9e005c89.patch#/virtman-34662fe-argcomplete.patch # SUSE Only Patch70: virtman-desktop.patch Patch71: virtman-kvm.patch @@ -84,7 +95,6 @@ Patch183: virtinst-add-oracle-linux-support.patch Patch184: virtinst-windows-server-detection.patch BuildArch: noarch -BuildRoot: %{_tmppath}/%{name}-%{version}-build %define verrel %{version}-%{release} Requires: dbus-1-x11 @@ -109,6 +119,12 @@ BuildRequires: gettext BuildRequires: python3-devel BuildRequires: python3-docutils BuildRequires: python3-setuptools +%if %{with test} +BuildRequires: python3-argcomplete +BuildRequires: python3-pytest +BuildRequires: virt-install = %{version} +BuildRequires: virt-manager = %{version} +%endif %description Virtual Machine Manager provides a graphical tool for administering virtual @@ -158,8 +174,9 @@ Package includes several command line utilities, including virt-install machine). %prep -%autosetup -p1 +%autosetup -p1 -n virt-manager-%{version} +%if !%{with test} %build %if %{default_hvs} %global _default_hvs --default-hvs %{default_hvs} @@ -183,8 +200,34 @@ install -m644 %SOURCE2 %{buildroot}/%{_datadir}/applications/YaST2/virt-install. # Oddly, supportconfig doesn't execute plugins with '-' in the name, so use 'virt_manager' mkdir -p %{buildroot}/usr/lib/supportconfig/plugins install -m 755 %SOURCE3 %{buildroot}/usr/lib/supportconfig/plugins/virt_manager +chmod -x %{buildroot}%{_datadir}/virt-manager/virtManager/virtmanager.py %find_lang %{name} +%endif + +%if %{with test} +%check +# wrong hard disk device name +donttest="test_disk_numtotarget" +# RuntimeError: unsupported configuration: unfiltered sgio is no longer supported +donttest="$donttest or test_misc_nonpredicatble_generate or testAlterDisk" +# additional +donttest="$donttest or testCLI0052virt_install_cdrom_url" +donttest="$donttest or testCLI0079virt_install_w2k3_cdrom" +donttest="$donttest or testCLI0094virt_install_osvariant_defaults_pxe" +donttest="$donttest or testCLI0095virt_install_cloud_init_default" +donttest="$donttest or testCLI0096virt_install_cloud_init_options1" +donttest="$donttest or testCLI0097virt_install_cloud_init_options2" +donttest="$donttest or testCLI0098virt_install_cloud_init_options3" +donttest="$donttest or testCLI0099virt_install_cloud_init_options4" +donttest="$donttest or testCLI0100virt_install_cloud_init_options5" +donttest="$donttest or testCLI0107virt_install_cdrom_double" +# wrong device name and driver cache entry +donttest="$donttest or testCLI0111virt_install_reinstall_cdrom" +# wrong device name +donttest="$donttest or testCLI0369virt_xml_add_disk_create_storage_start" +pytest -v -rfEs -k "not ($donttest)" +%endif %post /bin/touch --no-create %{_datadir}/icons/hicolor >/dev/null 2>&1 || : @@ -202,6 +245,7 @@ fi /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor >/dev/null 2>&1 || : /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas > /dev/null 2>&1 || : +%if !%{with test} %files %defattr(-,root,root,-) %{_bindir}/%{name} @@ -250,5 +294,6 @@ fi %dir %{_datadir}/YaST2/clients %dir %{_datadir}/applications/YaST2 %{_datadir}/YaST2/clients/virt-install.rb +%endif %changelog diff --git a/virtman-34662fe-argcomplete.patch b/virtman-34662fe-argcomplete.patch new file mode 100644 index 00000000..e994b7f2 --- /dev/null +++ b/virtman-34662fe-argcomplete.patch @@ -0,0 +1,40 @@ +From 34662fecc9535c7d8d0a8e7d42fafa4b9e005c89 Mon Sep 17 00:00:00 2001 +From: Cole Robinson +Date: Mon, 13 Jun 2022 12:55:31 -0400 +Subject: [PATCH] tests: Fix with latest argcomplete + +Signed-off-by: Cole Robinson +--- + virtinst/cli.py | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/virtinst/cli.py b/virtinst/cli.py +index 52be9f298..c42fc0f0a 100644 +--- a/virtinst/cli.py ++++ b/virtinst/cli.py +@@ -552,7 +552,15 @@ def autocomplete(parser): + kwargs = {"validator": _completer_validator} + if xmlutil.in_testsuite(): + import io +- kwargs["output_stream"] = io.BytesIO() ++ class MyStream(io.StringIO): ++ # Custom class to handle both bytes() and str() on write. ++ # With argcomplete 2.0.0 and/or python3.10 something changed ++ # here, so this should hopefully cover back compat ++ def write(self, msg, *args, **kwargs): ++ if type(msg) is bytes: ++ msg = msg.decode("utf-8") # pragma: no cover ++ return super().write(msg, *args, **kwargs) ++ kwargs["output_stream"] = MyStream() + kwargs["exit_method"] = sys.exit + + # This fdopen hackery is to avoid argcomplete debug_stream behavior +@@ -568,7 +576,7 @@ def fake_fdopen_cb(*args, **kwargs): + argcomplete.autocomplete(parser, **kwargs) + except SystemExit: + if xmlutil.in_testsuite(): +- output = kwargs["output_stream"].getvalue().decode("utf-8") ++ output = kwargs["output_stream"].getvalue() + print(output) + raise + diff --git a/virtman-pr381-setuptools-61.patch b/virtman-pr381-setuptools-61.patch new file mode 100644 index 00000000..cf6cfcb6 --- /dev/null +++ b/virtman-pr381-setuptools-61.patch @@ -0,0 +1,31 @@ +From c6fc4524d4448259ea85f93f85898b64a4380154 Mon Sep 17 00:00:00 2001 +From: Peter Alfredsen +Date: Tue, 5 Apr 2022 22:04:20 +0200 +Subject: [PATCH] setup: add bits for setuptools-61 + +Quoting https://github.com/pypa/setuptools/issues/3227 +"Setuptools >= 61, intentionally changes the way packages are built in the + sensec that it will try to find files and fail if something is weird. + + Empty packages (like this one), are asked to explicitly add packages=[] + to their configuration. + + This intentional change in behaviour is described in + https://setuptools.pypa.io/en/latest/history.html#v61-0-0." + +Bug: https://bugs.gentoo.org/836645 +Signed-off-by: Peter Alfredsen +--- + setup.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/setup.py b/setup.py +index e95acd39f..7e47e7c71 100755 +--- a/setup.py ++++ b/setup.py +@@ -547,4 +547,5 @@ def run(self): + }, + + distclass=VMMDistribution, ++ packages=[], + )