[meta-selinux][PATCH 07/12] classes: drop redundant classes


Yi Zhao
 

There are some redundant classes: enable-selinux.bbclass,
with-selinux.bbclass, meson-enable-selinux.bbclass,
meson-selinux.bbclass, enable-audit.bbclass, with-audit.bbclass.
These classes only add PACKAGEOCNFIG[selinux]/[audit] to recipes. But
currently most recipes have added PACKAGECONFIG[selinux]/[audit] in
their bb files. We don't need these anymore. Only keep
enable-selinux.class and enable-audit.class to append
PACKAGECONFIG[selinux]/[audit] for recipes.

Signed-off-by: Yi Zhao <yi.zhao@...>
---
classes/enable-selinux.bbclass | 3 +--
classes/meson-enable-selinux.bbclass | 4 ----
classes/meson-selinux.bbclass | 4 ----
classes/with-audit.bbclass | 5 -----
classes/with-selinux.bbclass | 4 ----
recipes-connectivity/iproute2/iproute2_%.bbappend | 3 ++-
recipes-connectivity/openssh/openssh_selinux.inc | 9 +++------
recipes-core/coreutils/coreutils_%.bbappend | 4 ++--
recipes-core/dbus/dbus_%.bbappend | 2 +-
recipes-core/eudev/eudev_selinux.inc | 1 +
recipes-core/glib-2.0/glib-2.0_%.bbappend | 2 +-
recipes-core/systemd/systemd_selinux.inc | 2 +-
recipes-core/util-linux/util-linux_%.bbappend | 3 ++-
recipes-devtools/rpm/rpm_selinux.inc | 4 ++--
recipes-extended/at/at_%.bbappend | 2 +-
recipes-extended/cronie/cronie_%.bbappend | 4 ++--
recipes-extended/findutils/findutils_%.bbappend | 3 ++-
recipes-extended/pam/libpam_selinux.inc | 1 +
recipes-extended/psmisc/psmisc_%.bbappend | 1 +
recipes-extended/sed/sed_4.%.bbappend | 2 +-
recipes-extended/shadow/shadow_selinux.inc | 5 +----
recipes-extended/sudo/sudo_%.bbappend | 5 ++++-
recipes-extended/tar/tar_selinux.inc | 4 ++--
recipes-graphics/mesa/mesa_%.bbappend | 4 ++--
recipes-graphics/xcb/libxcb_selinux.inc | 6 ------
recipes-graphics/{xcb => xorg-lib}/libxcb_%.bbappend | 0
recipes-graphics/xorg-lib/libxcb_selinux.inc | 5 +++++
recipes-kernel/perf/perf_selinux.inc | 2 +-
recipes-support/attr/attr_selinux.inc | 2 --
recipes-support/gnupg/gnupg_selinux.inc | 3 +--
30 files changed, 40 insertions(+), 59 deletions(-)
delete mode 100644 classes/meson-enable-selinux.bbclass
delete mode 100644 classes/meson-selinux.bbclass
delete mode 100644 classes/with-audit.bbclass
delete mode 100644 classes/with-selinux.bbclass
delete mode 100644 recipes-graphics/xcb/libxcb_selinux.inc
rename recipes-graphics/{xcb => xorg-lib}/libxcb_%.bbappend (100%)
create mode 100644 recipes-graphics/xorg-lib/libxcb_selinux.inc

diff --git a/classes/enable-selinux.bbclass b/classes/enable-selinux.bbclass
index c8af97e..3dc61d6 100644
--- a/classes/enable-selinux.bbclass
+++ b/classes/enable-selinux.bbclass
@@ -1,4 +1,3 @@
inherit selinux

-PACKAGECONFIG:append = " ${@target_selinux(d)}"
-PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,"
+PACKAGECONFIG:append = " ${@target_selinux(d, 'selinux')}"
diff --git a/classes/meson-enable-selinux.bbclass b/classes/meson-enable-selinux.bbclass
deleted file mode 100644
index b5b8cb7..0000000
--- a/classes/meson-enable-selinux.bbclass
+++ /dev/null
@@ -1,4 +0,0 @@
-inherit selinux
-
-PACKAGECONFIG:append = " ${@target_selinux(d)}"
-PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux,"
diff --git a/classes/meson-selinux.bbclass b/classes/meson-selinux.bbclass
deleted file mode 100644
index 337ffca..0000000
--- a/classes/meson-selinux.bbclass
+++ /dev/null
@@ -1,4 +0,0 @@
-inherit selinux
-
-PACKAGECONFIG:append = " ${@target_selinux(d)}"
-PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,"
diff --git a/classes/with-audit.bbclass b/classes/with-audit.bbclass
deleted file mode 100644
index a99bf71..0000000
--- a/classes/with-audit.bbclass
+++ /dev/null
@@ -1,5 +0,0 @@
-# There is still no audit DISTRO_FEATURE, so enable audit when selinux feature enabled.
-inherit selinux
-
-PACKAGECONFIG:append = " ${@target_selinux(d, 'audit')}"
-PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit,"
diff --git a/classes/with-selinux.bbclass b/classes/with-selinux.bbclass
deleted file mode 100644
index 37b9e13..0000000
--- a/classes/with-selinux.bbclass
+++ /dev/null
@@ -1,4 +0,0 @@
-inherit selinux
-
-PACKAGECONFIG:append = " ${@target_selinux(d)}"
-PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux,"
diff --git a/recipes-connectivity/iproute2/iproute2_%.bbappend b/recipes-connectivity/iproute2/iproute2_%.bbappend
index b01ad25..8cb2a5b 100644
--- a/recipes-connectivity/iproute2/iproute2_%.bbappend
+++ b/recipes-connectivity/iproute2/iproute2_%.bbappend
@@ -1 +1,2 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
+PACKAGECONFIG[selinux] = ",,libselinux"
diff --git a/recipes-connectivity/openssh/openssh_selinux.inc b/recipes-connectivity/openssh/openssh_selinux.inc
index 20937c2..07c25c5 100644
--- a/recipes-connectivity/openssh/openssh_selinux.inc
+++ b/recipes-connectivity/openssh/openssh_selinux.inc
@@ -1,9 +1,6 @@
-inherit with-selinux
+inherit enable-selinux enable-audit

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

-# There is no distro feature just for audit.
-PACKAGECONFIG:append = " audit"
-
-PACKAGECONFIG[audit] = "--with-audit=linux,--without-audit,audit,"
-
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
+PACKAGECONFIG[audit] = "--with-audit=linux,--without-audit,audit"
diff --git a/recipes-core/coreutils/coreutils_%.bbappend b/recipes-core/coreutils/coreutils_%.bbappend
index 7b9a2dc..138c23a 100644
--- a/recipes-core/coreutils/coreutils_%.bbappend
+++ b/recipes-core/coreutils/coreutils_%.bbappend
@@ -1,2 +1,2 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
-
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
diff --git a/recipes-core/dbus/dbus_%.bbappend b/recipes-core/dbus/dbus_%.bbappend
index ee221e2..fe51e54 100644
--- a/recipes-core/dbus/dbus_%.bbappend
+++ b/recipes-core/dbus/dbus_%.bbappend
@@ -1,2 +1,2 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux enable-audit', '', d)}

diff --git a/recipes-core/eudev/eudev_selinux.inc b/recipes-core/eudev/eudev_selinux.inc
index 94950f5..976cb23 100644
--- a/recipes-core/eudev/eudev_selinux.inc
+++ b/recipes-core/eudev/eudev_selinux.inc
@@ -1,3 +1,4 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

inherit enable-selinux
+PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
diff --git a/recipes-core/glib-2.0/glib-2.0_%.bbappend b/recipes-core/glib-2.0/glib-2.0_%.bbappend
index 39a0a3a..74e22b3 100644
--- a/recipes-core/glib-2.0/glib-2.0_%.bbappend
+++ b/recipes-core/glib-2.0/glib-2.0_%.bbappend
@@ -1 +1 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'meson-enable-selinux', '', d)}
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
diff --git a/recipes-core/systemd/systemd_selinux.inc b/recipes-core/systemd/systemd_selinux.inc
index 8136ea8..7d466ee 100644
--- a/recipes-core/systemd/systemd_selinux.inc
+++ b/recipes-core/systemd/systemd_selinux.inc
@@ -1,4 +1,4 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-audit', '', d)}
+inherit enable-selinux enable-audit

do_install:append() {
if ${@bb.utils.contains('PACKAGECONFIG', 'backlight', 'true', 'false', d)}; then
diff --git a/recipes-core/util-linux/util-linux_%.bbappend b/recipes-core/util-linux/util-linux_%.bbappend
index b01ad25..138c23a 100644
--- a/recipes-core/util-linux/util-linux_%.bbappend
+++ b/recipes-core/util-linux/util-linux_%.bbappend
@@ -1 +1,2 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
diff --git a/recipes-devtools/rpm/rpm_selinux.inc b/recipes-devtools/rpm/rpm_selinux.inc
index 983dda7..b6e0e7c 100644
--- a/recipes-devtools/rpm/rpm_selinux.inc
+++ b/recipes-devtools/rpm/rpm_selinux.inc
@@ -1,2 +1,2 @@
-inherit with-selinux
-PACKAGECONFIG[selinux] = "${WITH_SELINUX},${WITHOUT_SELINUX},libsemanage,"
+inherit enable-selinux
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
diff --git a/recipes-extended/at/at_%.bbappend b/recipes-extended/at/at_%.bbappend
index b01ad25..74e22b3 100644
--- a/recipes-extended/at/at_%.bbappend
+++ b/recipes-extended/at/at_%.bbappend
@@ -1 +1 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
diff --git a/recipes-extended/cronie/cronie_%.bbappend b/recipes-extended/cronie/cronie_%.bbappend
index cfa56ca..2da759e 100644
--- a/recipes-extended/cronie/cronie_%.bbappend
+++ b/recipes-extended/cronie/cronie_%.bbappend
@@ -1,2 +1,2 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-audit', '', d)}
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux enable-audit', '', d)}
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
diff --git a/recipes-extended/findutils/findutils_%.bbappend b/recipes-extended/findutils/findutils_%.bbappend
index b01ad25..138c23a 100644
--- a/recipes-extended/findutils/findutils_%.bbappend
+++ b/recipes-extended/findutils/findutils_%.bbappend
@@ -1 +1,2 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
diff --git a/recipes-extended/pam/libpam_selinux.inc b/recipes-extended/pam/libpam_selinux.inc
index bee1f3e..2f8b945 100644
--- a/recipes-extended/pam/libpam_selinux.inc
+++ b/recipes-extended/pam/libpam_selinux.inc
@@ -1,3 +1,4 @@
inherit enable-selinux

+PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
RDEPENDS:${PN}-runtime += "${@target_selinux(d, 'pam-plugin-selinux')}"
diff --git a/recipes-extended/psmisc/psmisc_%.bbappend b/recipes-extended/psmisc/psmisc_%.bbappend
index 74e22b3..d02ee09 100644
--- a/recipes-extended/psmisc/psmisc_%.bbappend
+++ b/recipes-extended/psmisc/psmisc_%.bbappend
@@ -1 +1,2 @@
inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
+PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
diff --git a/recipes-extended/sed/sed_4.%.bbappend b/recipes-extended/sed/sed_4.%.bbappend
index b01ad25..74e22b3 100644
--- a/recipes-extended/sed/sed_4.%.bbappend
+++ b/recipes-extended/sed/sed_4.%.bbappend
@@ -1 +1 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
diff --git a/recipes-extended/shadow/shadow_selinux.inc b/recipes-extended/shadow/shadow_selinux.inc
index 3c8daea..e719ebc 100644
--- a/recipes-extended/shadow/shadow_selinux.inc
+++ b/recipes-extended/shadow/shadow_selinux.inc
@@ -1,6 +1,3 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

-inherit with-selinux with-audit
-
-PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage,"
-
+inherit enable-selinux enable-audit
diff --git a/recipes-extended/sudo/sudo_%.bbappend b/recipes-extended/sudo/sudo_%.bbappend
index b01ad25..2e35ec5 100644
--- a/recipes-extended/sudo/sudo_%.bbappend
+++ b/recipes-extended/sudo/sudo_%.bbappend
@@ -1 +1,4 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux enable-audit', '', d)}
+
+PACKAGECONFIG[audit] = "--with-linux-audit,--without-linux-audit,audit"
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
diff --git a/recipes-extended/tar/tar_selinux.inc b/recipes-extended/tar/tar_selinux.inc
index b1fa7bf..0f64298 100644
--- a/recipes-extended/tar/tar_selinux.inc
+++ b/recipes-extended/tar/tar_selinux.inc
@@ -1,3 +1,3 @@
-inherit with-selinux
+inherit enable-selinux

-PACKAGECONFIG:append = "${@bb.utils.contains('DISTRO_FEATURES', 'acl', ' acl', '', d)}"
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
diff --git a/recipes-graphics/mesa/mesa_%.bbappend b/recipes-graphics/mesa/mesa_%.bbappend
index 02c4918..ef81ec4 100644
--- a/recipes-graphics/mesa/mesa_%.bbappend
+++ b/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,2 +1,2 @@
-inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'meson-selinux', '', d)}
-
+inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
+PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux"
diff --git a/recipes-graphics/xcb/libxcb_selinux.inc b/recipes-graphics/xcb/libxcb_selinux.inc
deleted file mode 100644
index 6924315..0000000
--- a/recipes-graphics/xcb/libxcb_selinux.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-inherit enable-selinux
-# libxcb-xselinux will not build with libselinux, so remove the depend
-PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,,"
-
-PACKAGES += "${PN}-xselinux"
-FILES:${PN}-xselinux += "${libdir}/libxcb-xselinux.so.*"
diff --git a/recipes-graphics/xcb/libxcb_%.bbappend b/recipes-graphics/xorg-lib/libxcb_%.bbappend
similarity index 100%
rename from recipes-graphics/xcb/libxcb_%.bbappend
rename to recipes-graphics/xorg-lib/libxcb_%.bbappend
diff --git a/recipes-graphics/xorg-lib/libxcb_selinux.inc b/recipes-graphics/xorg-lib/libxcb_selinux.inc
new file mode 100644
index 0000000..04c66c1
--- /dev/null
+++ b/recipes-graphics/xorg-lib/libxcb_selinux.inc
@@ -0,0 +1,5 @@
+inherit enable-selinux
+PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
+
+PACKAGES += "${PN}-xselinux"
+FILES:${PN}-xselinux += "${libdir}/libxcb-xselinux.so.*"
diff --git a/recipes-kernel/perf/perf_selinux.inc b/recipes-kernel/perf/perf_selinux.inc
index bed3cc2..f1bdaf8 100644
--- a/recipes-kernel/perf/perf_selinux.inc
+++ b/recipes-kernel/perf/perf_selinux.inc
@@ -1 +1 @@
-DEPENDS .= "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', ' audit', '', d)}"
+inherit enable-audit
diff --git a/recipes-support/attr/attr_selinux.inc b/recipes-support/attr/attr_selinux.inc
index 7b45842..efc18b2 100644
--- a/recipes-support/attr/attr_selinux.inc
+++ b/recipes-support/attr/attr_selinux.inc
@@ -1,5 +1,3 @@
-inherit selinux
-
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI += "file://fix-ptest-failures-when-selinux-enabled.patch"
diff --git a/recipes-support/gnupg/gnupg_selinux.inc b/recipes-support/gnupg/gnupg_selinux.inc
index 12571b4..eee1731 100644
--- a/recipes-support/gnupg/gnupg_selinux.inc
+++ b/recipes-support/gnupg/gnupg_selinux.inc
@@ -1,3 +1,2 @@
inherit enable-selinux
-# gnupg will not build with libselinux, so remove the depend
-PACKAGECONFIG[selinux] = "--enable-selinux-support,--disable-selinux-support,,"
+PACKAGECONFIG[selinux] = "--enable-selinux-support,--disable-selinux-support,libselinux"
--
2.25.1

Join yocto@lists.yoctoproject.org to automatically receive all group messages.