RHEL 5 is based on libvirt 0.8.2, as was Fedora 13. RHEL 5 also
happens to be the oldest box that we actively support with a
buildbot, so it is time to clean up some crufty conditionals in
the spec file that no longer are necessary for modern Fedora.
Although it is probably okay to make further simplifications to
a newer minimum Fedora version, that can be done as a later patch.
This patch just focuses on cleaning any comparison of %{?fedora}
that will always be true or false once we assume a minimum of F13.
* libvirt.spec.in: Make with_audit default to on. Move other
conditionals to a single RHEL-5 block. Simplify any fedora
comparison older than 13. Document our assumptions.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
libvirt.spec.in | 69 ++++++++++++++++++++-------------------------------------
1 file changed, 24 insertions(+), 45 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 9c7b241..091eec8 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1,5 +1,7 @@
# -*- rpm-spec -*-
+# This spec file assumes you are building for Fedora 13 or newer,
+# or for RHEL 5 or newer. It may need some tweaks for other distros.
# If neither fedora nor rhel was defined, try to guess them from %{dist}
%if !0%{?rhel} && !0%{?fedora}
%{expand:%(echo "%{?dist}" | \
@@ -122,7 +124,6 @@
%define with_libpcap 0%{!?_without_libpcap:0}
%define with_macvtap 0%{!?_without_macvtap:0}
%define with_libnl 0%{!?_without_libnl:0}
-%define with_audit 0%{!?_without_audit:0}
%define with_dtrace 0%{!?_without_dtrace:0}
%define with_cgconfig 0%{!?_without_cgconfig:0}
%define with_sanlock 0%{!?_without_sanlock:0}
@@ -136,6 +137,7 @@
# Non-server/HV driver defaults which are always enabled
%define with_sasl 0%{!?_without_sasl:1}
+%define with_audit 0%{!?_without_audit:1}
# Finally set the OS / architecture specific special cases
@@ -224,31 +226,21 @@
%define with_libxl 0
%endif
-# PolicyKit was introduced in Fedora 8 / RHEL-6 or newer
-%if 0%{?fedora} >= 8 || 0%{?rhel} >= 6
- %define with_polkit 0%{!?_without_polkit:1}
-%endif
-
-# libcapng is used to manage capabilities in Fedora 12 / RHEL-6 or newer
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
- %define with_capng 0%{!?_without_capng:1}
-%endif
-
# fuse is used to provide virtualized /proc for LXC
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
%define with_fuse 0%{!?_without_fuse:1}
%endif
-# netcf is used to manage network interfaces in Fedora 12 / RHEL-6 or newer
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
- %define with_netcf 0%{!?_without_netcf:%{server_drivers}}
-%endif
-
-# udev is used to manage host devices in Fedora 12 / RHEL-6 or newer
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
- %define with_udev 0%{!?_without_udev:%{server_drivers}}
-%else
+# RHEL 5 lacks newer tools
+%if 0%{?rhel} == 5
%define with_hal 0%{!?_without_hal:%{server_drivers}}
+%else
+ %define with_polkit 0%{!?_without_polkit:1}
+ %define with_capng 0%{!?_without_capng:1}
+ %define with_netcf 0%{!?_without_netcf:%{server_drivers}}
+ %define with_udev 0%{!?_without_udev:%{server_drivers}}
+ %define with_yajl 0%{!?_without_yajl:%{server_drivers}}
+ %define with_dtrace 1
%endif
# interface requires netcf
@@ -256,11 +248,6 @@
%define with_interface 0
%endif
-# Enable yajl library for JSON mode with QEMU
-%if 0%{?fedora} >= 13 || 0%{?rhel} >= 6
- %define with_yajl 0%{!?_without_yajl:%{server_drivers}}
-%endif
-
# Enable sanlock library for lock management with QEMU
# Sanlock is available only on x86_64 for RHEL
%if 0%{?fedora} >= 16
@@ -321,16 +308,8 @@
%define with_libnl 1
%endif
-%if 0%{?fedora} >= 11 || 0%{?rhel} >= 5
- %define with_audit 0%{!?_without_audit:1}
-%endif
-
-%if 0%{?fedora} >= 13 || 0%{?rhel} >= 6
- %define with_dtrace 1
-%endif
-
# Pull in cgroups config system
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
%if %{with_qemu} || %{with_lxc}
%define with_cgconfig 0%{!?_without_cgconfig:1}
%endif
@@ -350,7 +329,7 @@
# Force QEMU to run as non-root
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
%define qemu_user qemu
%define qemu_group qemu
%else
@@ -473,7 +452,7 @@ BuildRequires: libattr-devel
# For pool-build probing for existing pools
BuildRequires: libblkid-devel >= 2.17
%endif
-%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+%if 0%{?fedora} || 0%{?rhel} >= 6
# for augparse, optionally used in testing
BuildRequires: augeas
%endif
@@ -538,7 +517,7 @@ BuildRequires: cyrus-sasl-devel
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
BuildRequires: polkit-devel >= 0.112
%else
- %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+ %if 0%{?fedora} || 0%{?rhel} >= 6
BuildRequires: polkit-devel >= 0.93
%else
BuildRequires: PolicyKit-devel >= 0.6
@@ -621,7 +600,7 @@ BuildRequires: netcf-devel >= 0.1.4
%endif
%endif
%if %{with_esx}
- %if 0%{?fedora} >= 9 || 0%{?rhel} >= 6
+ %if 0%{?fedora} || 0%{?rhel} >= 6
BuildRequires: libcurl-devel
%else
BuildRequires: curl-devel
@@ -705,7 +684,7 @@ Requires: avahi-libs
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
Requires: polkit >= 0.112
%else
- %if 0%{?fedora} >= 12 || 0%{?rhel} >=6
+ %if 0%{?fedora} || 0%{?rhel} >=6
Requires: polkit >= 0.93
%else
Requires: PolicyKit >= 0.6
@@ -865,7 +844,7 @@ Requires: nfs-utils
# For mkfs
Requires: util-linux
# For glusterfs
- %if 0%{?fedora} >= 11
+ %if 0%{?fedora}
Requires: glusterfs-client >= 2.0.1
%endif
%endif
@@ -1579,7 +1558,7 @@ mv
$RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \
%endif
%endif
-%if 0%{?fedora} < 14 && 0%{?rhel} < 6
+%if 0%{?rhel} == 5
rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf
%endif
@@ -1607,7 +1586,7 @@ fi
%if ! %{with_driver_modules}
%if %{with_qemu}
%pre daemon
- %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+ %if 0%{?fedora} || 0%{?rhel} >= 6
# We want soft static allocation of well-known ids, as disk images
# are commonly shared across NFS mounts by id rather than name; see
#
https://fedoraproject.org/wiki/Packaging:UsersAndGroups
@@ -1762,7 +1741,7 @@ fi
%if %{with_driver_modules}
%if %{with_qemu}
%pre daemon-driver-qemu
- %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+ %if 0%{?fedora} || 0%{?rhel} >= 6
# We want soft static allocation of well-known ids, as disk images
# are commonly shared across NFS mounts by id rather than name; see
#
https://fedoraproject.org/wiki/Packaging:UsersAndGroups
@@ -1869,7 +1848,7 @@ exit 0
%config(noreplace) %{_sysconfdir}/sysconfig/virtlockd
%config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf
%config(noreplace) %{_sysconfdir}/libvirt/virtlockd.conf
- %if 0%{?fedora} >= 14 || 0%{?rhel} >= 6
+ %if 0%{?fedora} || 0%{?rhel} >= 6
%config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf
%endif
@@ -1897,7 +1876,7 @@ exit 0
%endif
%if %{with_polkit}
- %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+ %if 0%{?fedora} || 0%{?rhel} >= 6
%{_datadir}/polkit-1/actions/org.libvirt.unix.policy
%{_datadir}/polkit-1/actions/org.libvirt.api.policy
%else
--
1.9.3