Support apparmor in RPM spec

If libapparmor-devel happens to be installed when building the
RPM, it will failed due to unlisted virt-aa-helper in %files.
Add support for apparmor in the spec, so that we can explicitly
turn it on/off, defaulting to off in all distros. This causes
--without-apparmor to be given to configure, preventing the
build failures if the user happens to have libapparmor-devel
present.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-07-30 12:04:55 +01:00
parent 5bb2a245ab
commit 6aa5ebbecd
1 changed files with 16 additions and 0 deletions

View File

@ -100,6 +100,9 @@
%define with_numactl 0%{!?_without_numactl:%{server_drivers}}
%define with_selinux 0%{!?_without_selinux:%{server_drivers}}
# Just hardcode to off, since few people ever have apparmor RPMs installed
%define with_apparmor 0%{!?_without_apparmor:0}
# A few optional bits off by default, we enable later
%define with_polkit 0%{!?_without_polkit:0}
%define with_capng 0%{!?_without_capng:0}
@ -472,6 +475,9 @@ BuildRequires: avahi-devel
%if %{with_selinux}
BuildRequires: libselinux-devel
%endif
%if %{with_apparmor}
BuildRequires: libapparmor-devel
%endif
%if %{with_network}
BuildRequires: dnsmasq >= 2.41
BuildRequires: iptables
@ -1268,6 +1274,10 @@ of recent versions of Linux (and other OSes).
%define _without_selinux --without-selinux
%endif
%if ! %{with_apparmor}
%define _without_apparmor --without-apparmor
%endif
%if ! %{with_hal}
%define _without_hal --without-hal
%endif
@ -1367,6 +1377,7 @@ of recent versions of Linux (and other OSes).
%{?_without_netcf} \
%{?_without_selinux} \
%{?_with_selinux_mount} \
%{?_without_apparmor} \
%{?_without_hal} \
%{?_without_udev} \
%{?_without_yajl} \
@ -1835,6 +1846,11 @@ fi
%endif
%attr(0755, root, root) %{_libexecdir}/libvirt_iohelper
%if %{with_apparmor}
%attr(0755, root, root) %{_libexecdir}/virt-aa-helper
%endif
%attr(0755, root, root) %{_sbindir}/libvirtd
%attr(0755, root, root) %{_sbindir}/virtlockd