[libvirt PATCH 9/9] spec: Introduce arches_*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this commit, all architecture lists that we base feature
enablement decisions on are defined within a few lines of each
other, increasing maintainability.

Additionally, generic architecture lists that appear in the
conditions for multiple features are defined, so that repetition
is reduced.

Note that a few checks (numactl, zfs, ceph) have been changed
from %ifarch to %ifnarch for consistency: while doing so, the
corresponding list of architectures has also been replaced with
the complement of the original one to ensure the overall behavior
would be preserved.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 libvirt.spec.in | 48 ++++++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index b62b17ee80..32bc51b33c 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -17,10 +17,22 @@
     %define _vpath_builddir %{_target_platform}
 %endif
 
+%define arches_64bit            x86_64 %{power64} aarch64 s390x riscv64
+%define arches_x86              %{ix86} x86_64
+
+%define arches_systemtap_64bit  %{arches_64bit}
+%define arches_dmidecode        %{arches_x86}
+%define arches_xen              %{arches_x86}
+%define arches_vbox             %{arches_x86}
+%define arches_ceph             %{arches_64bit}
+%define arches_zfs              %{arches_x86} %{power64} %{arm}
+%define arches_numactl          %{arches_x86} %{power64} aarch64
+%define arches_numad            %{arches_x86} %{power64} aarch64
+
 %if 0%{?fedora}
-    %define qemu_kvm_arches     %{ix86} x86_64 %{power64} s390x %{arm} aarch64
+    %define arches_qemu_kvm     %{arches_x86} %{power64} s390x %{arm} aarch64
 %else
-    %define qemu_kvm_arches     x86_64 %{power64} aarch64 s390x
+    %define arches_qemu_kvm     x86_64 %{power64} aarch64 s390x
 %endif
 
 # The hypervisor drivers that run in libvirtd
@@ -29,7 +41,7 @@
 %define with_libxl         0%{!?_without_libxl:1}
 %define with_vbox          0%{!?_without_vbox:1}
 
-%ifarch %{qemu_kvm_arches}
+%ifarch %{arches_qemu_kvm}
     %define with_qemu_kvm      %{with_qemu}
 %else
     %define with_qemu_kvm      0
@@ -61,7 +73,7 @@
 %endif
 
 %define with_storage_gluster 0%{!?_without_storage_gluster:1}
-%ifnarch %{qemu_kvm_arches}
+%ifnarch %{arches_qemu_kvm}
     # gluster is only built where qemu driver is enabled on RHEL 8
     %if 0%{?rhel} >= 8
         %define with_storage_gluster 0
@@ -98,28 +110,20 @@
 
 # Finally set the OS / architecture specific special cases
 
-# Xen is available only on i386 x86_64
-%ifnarch %{ix86} x86_64
+# Architecture-dependent features
+%ifnarch %{arches_xen}
     %define with_libxl 0
 %endif
-
-# vbox is available only on i386 x86_64
-%ifnarch %{ix86} x86_64
+%ifnarch %{arches_vbox}
     %define with_vbox 0
 %endif
-
-# Numactl is not available on many non-x86 archs
-%ifarch s390x %{arm} riscv64
+%ifnarch %{arches_numactl}
     %define with_numactl 0
 %endif
-
-# zfs-fuse is not available on some architectures
-%ifarch s390x aarch64 riscv64
+%ifnarch %{arches_zfs}
     %define with_storage_zfs 0
 %endif
-
-# Ceph dropped support for 32-bit hosts
-%ifarch %{arm} %{ix86}
+%ifnarch %{arches_ceph}
     %define with_storage_rbd 0
 %endif
 
@@ -155,7 +159,7 @@
     %define with_sanlock 0%{!?_without_sanlock:1}
 %endif
 %if 0%{?rhel}
-    %ifarch %{qemu_kvm_arches}
+    %ifarch %{arches_qemu_kvm}
         %define with_sanlock 0%{!?_without_sanlock:1}
     %endif
 %endif
@@ -179,12 +183,12 @@
 %if %{with_qemu} || %{with_lxc}
 # numad is used to manage the CPU and memory placement dynamically,
 # it's not available on many non-x86 architectures.
-    %ifnarch s390x %{arm} riscv64
+    %ifnarch %{arches_numad}
         %define with_numad    0%{!?_without_numad:1}
     %endif
 %endif
 
-%ifarch %{ix86} x86_64
+%ifarch %{arches_dmidecode}
     %define with_dmidecode 0%{!?_without_dmidecode:1}
 %endif
 
@@ -1256,7 +1260,7 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
 # Copied into libvirt-docs subpackage eventually
 mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt libvirt-docs
 
-%ifarch %{power64} s390x x86_64 aarch64 riscv64
+%ifarch %{arches_systemtap_64bit}
 mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes.stp \
    $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes-64.stp
 
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux