[PATCH RFC 6/6] spec: Move libvirt-guests to guests subpackage

Jim Fehlig jfehlig at suse.com
Wed Nov 23 23:11:55 UTC 2022


Signed-off-by: Jim Fehlig <jfehlig at suse.com>
---
 libvirt.spec.in | 64 +++++++++++++++++++++++++++++++------------------
 1 file changed, 41 insertions(+), 23 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index c83e6a1ab3..11c163fa69 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -443,11 +443,8 @@ Requires: %{name}-daemon-core = %{version}-%{release}
 # The client side, i.e. shared libs are in a subpackage
 Requires: %{name}-libs = %{version}-%{release}
 
-# The libvirt-guests.sh script requires virsh from libvirt-client subpackage,
-# but not every deployment wants to use libvirt-guests service. Using
-# Recommends here will install libvirt-client by default (if available), but
-# RPM won't complain if the package is unavailable, masked, or removed later.
-Recommends: %{name}-client = %{version}-%{release}
+# Weak dependency on libvirt-guests for a smoother upgrade
+Recommends: %{name}-guests = %{version}-%{release}
 
 # netcat is needed on the server side so that clients that have
 # libvirt < 6.9.0 can connect, but newer versions will prefer
@@ -478,12 +475,6 @@ Requires: numad
 Requires: dbus
 # For uid creation during pre
 Requires(pre): shadow-utils
-# Needed by /usr/libexec/libvirt-guests.sh script.
-%if 0%{?fedora} >= 37
-Requires: gettext-runtime
-%else
-Requires: gettext
-%endif
 
 # Ensure smooth upgrades
 Obsoletes: %{name}-admin < 7.3.0
@@ -502,6 +493,21 @@ Requires: %{name}-libs = %{version}-%{release}
 %description daemon-core
 Core daemons, utilities, and files used by the primary daemons
 
+%package guests
+Summary: Service for suspending and resuming guests
+Requires: %{name}-client = %{version}-%{release}
+
+# Needed by /usr/libexec/libvirt-guests.sh script.
+%if 0%{?fedora} >= 37
+Requires: gettext-runtime
+%else
+Requires: gettext
+%endif
+
+%description guests
+libvirt-guests provides a service that can be used to coordinate guest
+and host lifecycle actions
+
 %package daemon-config-network
 Summary: Default configuration files for the libvirtd daemon
 
@@ -1439,7 +1445,7 @@ fi \
 %define libvirt_daemon_systemd_preun_priv() %systemd_preun %1.service %1-admin.socket %1.socket
 
 %pre daemon
-%libvirt_sysconfig_pre libvirtd libvirt-guests
+%libvirt_sysconfig_pre libvirtd
 # 'libvirt' group is just to allow password-less polkit access to
 # libvirtd. The uid number is irrelevant, so we use dynamic allocation
 # described at the above link.
@@ -1452,21 +1458,13 @@ exit 0
 %libvirt_daemon_systemd_post_inet libvirtd
 %endif
 
-%systemd_post libvirt-guests.service
-
 %libvirt_daemon_schedule_restart libvirtd
 
 %preun daemon
-%systemd_preun libvirt-guests.service
-
 %libvirt_daemon_systemd_preun_inet libvirtd
 
-%postun daemon
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-%systemd_postun libvirt-guests.service
-
 %posttrans daemon
-%libvirt_sysconfig_posttrans libvirtd libvirt-guests
+%libvirt_sysconfig_posttrans libvirtd
 if test %libvirt_daemon_needs_restart libvirtd
 then
     # See if user has previously modified their install to
@@ -1501,6 +1499,22 @@ fi
 
 %libvirt_daemon_finish_restart libvirtd
 
+%pre guests
+%libvirt_sysconfig_pre libvirt-guests
+
+%post guests
+%systemd_post libvirt-guests.service
+
+%preun guests
+%systemd_preun libvirt-guests.service
+
+%postun guests
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%systemd_postun libvirt-guests.service
+
+%posttrans guests
+%libvirt_sysconfig_posttrans libvirt-guests
+
 %pre daemon-core
 %libvirt_sysconfig_pre virtproxyd virtlogd virtlockd
 
@@ -1804,7 +1818,6 @@ exit 0
 %{_unitdir}/libvirtd-tcp.socket
 %{_unitdir}/libvirtd-tls.socket
 %{_unitdir}/virt-guest-shutdown.target
-%{_unitdir}/libvirt-guests.service
 %config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf
 %config(noreplace) %{_sysconfdir}/sasl2/libvirt.conf
 %config(noreplace) %{_prefix}/lib/sysctl.d/60-libvirtd.conf
@@ -1815,10 +1828,15 @@ exit 0
 %{_datadir}/augeas/lenses/tests/test_libvirtd.aug
 
 %attr(0755, root, root) %{_sbindir}/libvirtd
+
+%{_mandir}/man8/libvirtd.8*
+
+%files guests
+%{_unitdir}/libvirt-guests.service
+
 %attr(0755, root, root) %{_libexecdir}/libvirt-guests.sh
 
 %{_mandir}/man8/libvirt-guests.8*
-%{_mandir}/man8/libvirtd.8*
 
 %files daemon-core
 %{_unitdir}/virtproxyd.service
-- 
2.37.3



More information about the libvir-list mailing list