[libvirt PATCH 19/26] meson: Rewrite apparmor_profiles check

Andrea Bolognani abologna at redhat.com
Tue Jun 1 08:37:50 UTC 2021


Attempting to enable apparmor_profiles when apparmor support
is not enabled should result in an error.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 meson.build | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index a9f87473db..55bb724a52 100644
--- a/meson.build
+++ b/meson.build
@@ -852,14 +852,18 @@ endif
 
 apparmor_dep = dependency('libapparmor', required: get_option('apparmor'))
 if apparmor_dep.found()
-  if get_option('apparmor_profiles')
-    conf.set('WITH_APPARMOR_PROFILES', 1)
-  endif
   conf.set('WITH_APPARMOR', 1)
   conf.set_quoted('APPARMOR_DIR', sysconfdir / 'apparmor.d')
   conf.set_quoted('APPARMOR_PROFILES_PATH', '/sys/kernel/security/apparmor/profiles')
 endif
 
+if get_option('apparmor_profiles')
+  if not conf.has('WITH_APPARMOR')
+    error('Cannot enable apparmor_profiles without apparmor')
+  endif
+  conf.set('WITH_APPARMOR_PROFILES', 1)
+endif
+
 # FIXME rewrite to use dependency() once we can use 2.4.48
 attr_dep = cc.find_library('attr', required: get_option('attr'))
 if attr_dep.found()
-- 
2.31.1




More information about the libvir-list mailing list