Skip to contentSkip to conversation

enable-selinux.bbclass: enable SELinux support in native packages

PATCH New Hiago De Franco 1 participant 1 message Mar 17

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 enable-selinux.bbclass: enable SELinux support in native packages

With SELinux enabled for the target it makes sense to have SELinux support enabled for the native tools, too.

Note that for native packages DISTRO_FEATURES is filtered, thus up to now it never contained "selinux". Replace the target_selinux() with bb.utils.filter(), allowing native packages to pick up "selinux" when DISTRO_FEATURES_FILTER_NATIVE is configured.

Document in README how to enable SELinux support for native tools by appending "selinux" to DISTRO_FEATURES_FILTER_NATIVE.

---
Hello,

This is the v2 patch following the patch sent by Uwe [0].

v1 -> v2:
- Dropped local.conf changes.
- Added a new section to README, as asked by the v1 review.
- Commit description and title updated.

[0] https://lore.kernel.org/yocto-patches/[email protected]/

Regards,
Hiago.

---
 README                         | 8 ++++++++
 classes/enable-selinux.bbclass | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
README +8 -0
index ae011f3..3e343fc 100644
@@ -63,6 +63,14 @@ labeling on first boot. Set FIRST_BOOT_RELABEL to 1 in local.conf:
 
 FIRST_BOOT_RELABEL = "1"
 
+Enable SELinux support on native tools
+--------------------------------------
+By default, native tools are not built with SELinux support. With target
+support for SELinux it is very helpful during debug when the native tools
+support SELinux, too. This can be achieved, for example, by adding to
+local.conf:
+
+DISTRO_FEATURES_FILTER_NATIVE:append = " selinux"
 
 Starting up the system
 ----------------------
classes/enable-selinux.bbclass +1 -1
index 3dc61d6..0c9f52e 100644
@@ -1,3 +1,3 @@
 inherit selinux
 
-PACKAGECONFIG:append = " ${@target_selinux(d, 'selinux')}"
+PACKAGECONFIG:append = " ${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"
Signature · 1 line
2.47.3