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
This commit is contained in:
Charles Arnold 2022-08-04 19:25:38 +00:00 committed by Git OBS Bridge
parent 34a07e32be
commit 63596521d0
5 changed files with 135 additions and 5 deletions

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Jul 19 10:03:04 UTC 2022 - Ben Greiner <code@bnavigator.de>
- 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

View File

@ -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 <driver cache="unsafe" />
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

View File

@ -0,0 +1,40 @@
From 34662fecc9535c7d8d0a8e7d42fafa4b9e005c89 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 13 Jun 2022 12:55:31 -0400
Subject: [PATCH] tests: Fix with latest argcomplete
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
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

View File

@ -0,0 +1,31 @@
From c6fc4524d4448259ea85f93f85898b64a4380154 Mon Sep 17 00:00:00 2001
From: Peter Alfredsen <crabbedhaloablution@icloud.com>
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 <crabbedhaloablution@icloud.com>
---
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=[],
)