[libvirt] [PATCH] Support apparmor in RPM spec

Daniel P. Berrange berrange at redhat.com
Tue Jul 30 11:06:35 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

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 at redhat.com>
---
 libvirt.spec.in | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index a3a831f..6212b3c 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -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
 
-- 
1.8.3.1




More information about the libvir-list mailing list