[libvirt] [PATCH 0/6] spec: Misc cleanups and improvements

Jiri Denemark (6): spec: Enable fuse only if LXC is enabled spec: Build virt-login-shell iff LXC driver is enabled spec: Drop checks for old Fedora releases spec: Prepare for future RHEL spec: Fix indentation in daemon's triggerpostun spec: Drop overlapping triggers libvirt.spec.in | 64 ++++++++++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 39 deletions(-) -- 2.16.1

Enabling fuse without LXC does not make a lot of sense because fuse is used only by LXC. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 44f846a169..4821da826e 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -163,7 +163,7 @@ %endif # fuse is used to provide virtualized /proc for LXC -%if 0%{?fedora} || 0%{?rhel} >= 7 +%if %{with_lxc} %define with_fuse 0%{!?_without_fuse:1} %endif -- 2.16.1

On Wed, Feb 14, 2018 at 03:11:36PM +0100, Jiri Denemark wrote:
Enabling fuse without LXC does not make a lot of sense because fuse is used only by LXC.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 44f846a169..4821da826e 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -163,7 +163,7 @@ %endif
# fuse is used to provide virtualized /proc for LXC -%if 0%{?fedora} || 0%{?rhel} >= 7 +%if %{with_lxc} %define with_fuse 0%{!?_without_fuse:1} %endif
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

Building virt-login-shell doesn't really make any sense without LXC and doing so even breaks "make rpm" since the associated files are installed but unpackaged (the login-shell sub package already depends on LXC). Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 4821da826e..5d05acd620 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1182,8 +1182,10 @@ exit 1 %if %{with_lxc} %define arg_lxc --with-lxc + %define arg_login_shell --with-login-shell %else %define arg_lxc --without-lxc + %define arg_login_shell --without-login-shell %endif %if %{with_vbox} @@ -1393,7 +1395,8 @@ rm -f po/stamp-po %{?arg_loader_nvram} \ %{?enable_werror} \ --enable-expensive-tests \ - %{arg_init_script} + %{arg_init_script} \ + %{?arg_login_shell} make %{?_smp_mflags} V=1 gzip -9 ChangeLog -- 2.16.1

On Wed, Feb 14, 2018 at 03:11:37PM +0100, Jiri Denemark wrote:
Building virt-login-shell doesn't really make any sense without LXC and doing so even breaks "make rpm" since the associated files are installed but unpackaged (the login-shell sub package already depends on LXC).
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 4821da826e..5d05acd620 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1182,8 +1182,10 @@ exit 1
%if %{with_lxc} %define arg_lxc --with-lxc + %define arg_login_shell --with-login-shell %else %define arg_lxc --without-lxc + %define arg_login_shell --without-login-shell %endif
%if %{with_vbox} @@ -1393,7 +1395,8 @@ rm -f po/stamp-po %{?arg_loader_nvram} \ %{?enable_werror} \ --enable-expensive-tests \ - %{arg_init_script} + %{arg_init_script} \ + %{?arg_login_shell} make %{?_smp_mflags} V=1 gzip -9 ChangeLog
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

The oldest Fedora release supported by the spec file is 26. Checking for anything older makes no sense. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 5d05acd620..daf7098216 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -73,7 +73,7 @@ %define with_numactl 0%{!?_without_numactl:1} # F25+ has zfs-fuse -%if 0%{?fedora} >= 25 +%if 0%{?fedora} %define with_storage_zfs 0%{!?_without_storage_zfs:1} %else %define with_storage_zfs 0 @@ -233,14 +233,10 @@ %define enable_werror --disable-werror %endif -%if 0%{?fedora} >= 25 +%if 0%{?fedora} %define tls_priority "@LIBVIRT,SYSTEM" %else - %if 0%{?fedora} - %define tls_priority "@SYSTEM" - %else - %define tls_priority "NORMAL" - %endif + %define tls_priority "NORMAL" %endif @@ -451,11 +447,7 @@ BuildRequires: numad %endif %if %{with_wireshark} - %if 0%{fedora} >= 24 BuildRequires: wireshark-devel >= 2.1.0 - %else -BuildRequires: wireshark-devel >= 1.12.1 - %endif %endif %if %{with_libssh} @@ -794,7 +786,7 @@ Requires: gzip Requires: bzip2 Requires: lzop Requires: xz - %if 0%{?fedora} >= 24 + %if 0%{?fedora} Requires: systemd-container %endif @@ -812,7 +804,7 @@ Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} # There really is a hard cross-driver dependency here Requires: libvirt-daemon-driver-network = %{version}-%{release} - %if 0%{?fedora} >= 24 + %if 0%{?fedora} Requires: systemd-container %endif @@ -1421,13 +1413,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.a rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/storage-backend/*.la rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/storage-backend/*.a %if %{with_wireshark} - %if 0%{fedora} >= 24 rm -f $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/libvirt.la - %else -rm -f $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/*/libvirt.la -mv $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/*/libvirt.so \ - $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/libvirt.so - %endif %endif install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/ -- 2.16.1

On Wed, Feb 14, 2018 at 03:11:38PM +0100, Jiri Denemark wrote:
The oldest Fedora release supported by the spec file is 26. Checking for anything older makes no sense.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 5d05acd620..daf7098216 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -73,7 +73,7 @@ %define with_numactl 0%{!?_without_numactl:1}
# F25+ has zfs-fuse -%if 0%{?fedora} >= 25 +%if 0%{?fedora} %define with_storage_zfs 0%{!?_without_storage_zfs:1} %else %define with_storage_zfs 0 @@ -233,14 +233,10 @@ %define enable_werror --disable-werror %endif
-%if 0%{?fedora} >= 25 +%if 0%{?fedora} %define tls_priority "@LIBVIRT,SYSTEM" %else - %if 0%{?fedora} - %define tls_priority "@SYSTEM" - %else - %define tls_priority "NORMAL" - %endif + %define tls_priority "NORMAL" %endif
@@ -451,11 +447,7 @@ BuildRequires: numad %endif
%if %{with_wireshark} - %if 0%{fedora} >= 24 BuildRequires: wireshark-devel >= 2.1.0 - %else -BuildRequires: wireshark-devel >= 1.12.1 - %endif %endif
%if %{with_libssh} @@ -794,7 +786,7 @@ Requires: gzip Requires: bzip2 Requires: lzop Requires: xz - %if 0%{?fedora} >= 24 + %if 0%{?fedora} Requires: systemd-container %endif
@@ -812,7 +804,7 @@ Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} # There really is a hard cross-driver dependency here Requires: libvirt-daemon-driver-network = %{version}-%{release} - %if 0%{?fedora} >= 24 + %if 0%{?fedora} Requires: systemd-container %endif
@@ -1421,13 +1413,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.a rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/storage-backend/*.la rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/storage-backend/*.a %if %{with_wireshark} - %if 0%{fedora} >= 24 rm -f $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/libvirt.la - %else -rm -f $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/*/libvirt.la -mv $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/*/libvirt.so \ - $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/libvirt.so - %endif %endif
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index daf7098216..c5cb0439a0 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -143,6 +143,10 @@ %define with_libxl 0 %define with_hyperv 0 %define with_vz 0 + + %if 0%{?rhel} > 7 + %define with_lxc 0 + %endif %endif # Fedora 17 / RHEL-7 are first where we use systemd. Although earlier @@ -295,7 +299,7 @@ BuildRequires: libtool BuildRequires: /usr/bin/pod2man %endif BuildRequires: git -%if 0%{?fedora} >= 27 +%if 0%{?fedora} >= 27 || 0%{?rhel} > 7 BuildRequires: perl-interpreter %else BuildRequires: perl @@ -786,7 +790,7 @@ Requires: gzip Requires: bzip2 Requires: lzop Requires: xz - %if 0%{?fedora} + %if 0%{?fedora} || 0%{?rhel} > 7 Requires: systemd-container %endif @@ -804,7 +808,7 @@ Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} # There really is a hard cross-driver dependency here Requires: libvirt-daemon-driver-network = %{version}-%{release} - %if 0%{?fedora} + %if 0%{?fedora} || 0%{?rhel} > 7 Requires: systemd-container %endif -- 2.16.1

On Wed, Feb 14, 2018 at 03:11:39PM +0100, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index daf7098216..c5cb0439a0 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -143,6 +143,10 @@ %define with_libxl 0 %define with_hyperv 0 %define with_vz 0 + + %if 0%{?rhel} > 7 + %define with_lxc 0 + %endif %endif
# Fedora 17 / RHEL-7 are first where we use systemd. Although earlier @@ -295,7 +299,7 @@ BuildRequires: libtool BuildRequires: /usr/bin/pod2man %endif BuildRequires: git -%if 0%{?fedora} >= 27 +%if 0%{?fedora} >= 27 || 0%{?rhel} > 7 BuildRequires: perl-interpreter %else BuildRequires: perl @@ -786,7 +790,7 @@ Requires: gzip Requires: bzip2 Requires: lzop Requires: xz - %if 0%{?fedora} + %if 0%{?fedora} || 0%{?rhel} > 7 Requires: systemd-container %endif
@@ -804,7 +808,7 @@ Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} # There really is a hard cross-driver dependency here Requires: libvirt-daemon-driver-network = %{version}-%{release} - %if 0%{?fedora} + %if 0%{?fedora} || 0%{?rhel} > 7 Requires: systemd-container %endif
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index c5cb0439a0..f73fcab494 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1615,15 +1615,15 @@ fi %triggerpostun daemon -- libvirt-daemon < 1.3.0 if [ $1 -ge 1 ] ; then %if %{with_systemd} - /bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 && - /bin/systemctl enable virtlogd.socket virtlogd-admin.socket || : - /bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 && - /bin/systemctl start virtlogd.socket virtlogd-admin.socket || : + /bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 && + /bin/systemctl enable virtlogd.socket virtlogd-admin.socket || : + /bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 && + /bin/systemctl start virtlogd.socket virtlogd-admin.socket || : %else - /sbin/chkconfig libvirtd 1>/dev/null 2>&1 && - /sbin/chkconfig virtlogd on || : - /sbin/service libvirtd status 1>/dev/null 2>&1 && - /sbin/service virtlogd start || : + /sbin/chkconfig libvirtd 1>/dev/null 2>&1 && + /sbin/chkconfig virtlogd on || : + /sbin/service libvirtd status 1>/dev/null 2>&1 && + /sbin/service virtlogd start || : %endif fi -- 2.16.1

On Wed, Feb 14, 2018 at 03:11:40PM +0100, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index c5cb0439a0..f73fcab494 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1615,15 +1615,15 @@ fi %triggerpostun daemon -- libvirt-daemon < 1.3.0 if [ $1 -ge 1 ] ; then %if %{with_systemd} - /bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 && - /bin/systemctl enable virtlogd.socket virtlogd-admin.socket || : - /bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 && - /bin/systemctl start virtlogd.socket virtlogd-admin.socket || : + /bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 && + /bin/systemctl enable virtlogd.socket virtlogd-admin.socket || : + /bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 && + /bin/systemctl start virtlogd.socket virtlogd-admin.socket || : %else - /sbin/chkconfig libvirtd 1>/dev/null 2>&1 && - /sbin/chkconfig virtlogd on || : - /sbin/service libvirtd status 1>/dev/null 2>&1 && - /sbin/service virtlogd start || : + /sbin/chkconfig libvirtd 1>/dev/null 2>&1 && + /sbin/chkconfig virtlogd on || : + /sbin/service libvirtd status 1>/dev/null 2>&1 && + /sbin/service virtlogd start || : %endif fi
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

The postun trigger for libvirt-daemon was defined twice for overlapping ranges of package verions if systemd support was switched off (which happens when building on something ancient, such as RHEL-6). Let's combine the two triggers into the one which is called when libvirt-daemon < 1.3.0 is uninstalled. As a side effect, virtlockd and virtlogd might be reloaded twice after an upgrade from libvirt newer than 1.2.1 and older than 1.3.0 (by postun script from the old libvirt and postun trigger from the new libvirt). Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index f73fcab494..e1e902c5e4 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1599,15 +1599,6 @@ if [ $1 -ge 1 ]; then fi %endif -%if %{with_systemd} -%else -%triggerpostun daemon -- libvirt-daemon < 1.2.1 -if [ "$1" -ge "1" ]; then - /sbin/service virtlockd reload > /dev/null 2>&1 || : - /sbin/service virtlogd reload > /dev/null 2>&1 || : -fi -%endif - # In upgrade scenario we must explicitly enable virtlockd/virtlogd # sockets, if libvirtd is already enabled and start them if # libvirtd is running, otherwise you'll get failures to start @@ -1624,6 +1615,8 @@ if [ $1 -ge 1 ] ; then /sbin/chkconfig virtlogd on || : /sbin/service libvirtd status 1>/dev/null 2>&1 && /sbin/service virtlogd start || : + /sbin/service virtlockd reload > /dev/null 2>&1 || : + /sbin/service virtlogd reload > /dev/null 2>&1 || : %endif fi -- 2.16.1

On Wed, Feb 14, 2018 at 03:11:41PM +0100, Jiri Denemark wrote:
The postun trigger for libvirt-daemon was defined twice for overlapping ranges of package verions if systemd support was switched off (which happens when building on something ancient, such as RHEL-6).
Let's combine the two triggers into the one which is called when libvirt-daemon < 1.3.0 is uninstalled. As a side effect, virtlockd and virtlogd might be reloaded twice after an upgrade from libvirt newer than 1.2.1 and older than 1.3.0 (by postun script from the old libvirt and postun trigger from the new libvirt).
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- libvirt.spec.in | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index f73fcab494..e1e902c5e4 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1599,15 +1599,6 @@ if [ $1 -ge 1 ]; then fi %endif
-%if %{with_systemd} -%else -%triggerpostun daemon -- libvirt-daemon < 1.2.1 -if [ "$1" -ge "1" ]; then - /sbin/service virtlockd reload > /dev/null 2>&1 || : - /sbin/service virtlogd reload > /dev/null 2>&1 || : -fi -%endif - # In upgrade scenario we must explicitly enable virtlockd/virtlogd # sockets, if libvirtd is already enabled and start them if # libvirtd is running, otherwise you'll get failures to start @@ -1624,6 +1615,8 @@ if [ $1 -ge 1 ] ; then /sbin/chkconfig virtlogd on || : /sbin/service libvirtd status 1>/dev/null 2>&1 && /sbin/service virtlogd start || : + /sbin/service virtlockd reload > /dev/null 2>&1 || : + /sbin/service virtlogd reload > /dev/null 2>&1 || : %endif fi
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|
participants (2)
-
Daniel P. Berrangé
-
Jiri Denemark