From e55421a7bd0c694f37e58ff8c752316ca560e4af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eil=C3=ADs=20N=C3=AD=20Fhlannag=C3=A1in?= <pidge@pidge.org>
Date: Tue, 12 Apr 2022 11:50:21 +0100
Subject: [PATCH] oniro-linux.conf: Rethink how DISTRO_FEATURES/IMAGE_FEATURES
 are defined
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Right now, we do a remove in DISTRO_FEATURES, that, while we don't
neccessarily support them, due to the finality of :remove we force our
end users to not use them either.

By moving DISTRO_FEATURES:remove to DEFAULT_DISTRO_FEATURES:remove, we
allow end users to still use oniro.conf but add in those removed
features.

We also move IMAGE_FEATURES from a distro level var to the image.
IMAGE_FEATURES should generally be put in image recipes. This also gives
end users a way to use Oniro and work around our :remove defaults.

Signed-off-by: Eilís Ní Fhlannagáin <pidge@pidge.org>
---
 meta-oniro-core/conf/distro/oniro-linux.conf           | 10 ++++------
 .../recipes-core/images/oniro-image-common.inc         |  4 ++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/meta-oniro-core/conf/distro/oniro-linux.conf b/meta-oniro-core/conf/distro/oniro-linux.conf
index 19e37821..e46e3a16 100644
--- a/meta-oniro-core/conf/distro/oniro-linux.conf
+++ b/meta-oniro-core/conf/distro/oniro-linux.conf
@@ -23,6 +23,10 @@ ONIRO_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch pam rauc secur
 ONIRO_DEFAULT_EXTRA_RDEPENDS = "packagegroup-core-boot"
 ONIRO_DEFAULT_EXTRA_RRECOMMENDS = "kernel-module-af-packet"
 
+# Remove some of the default Poky DISTRO_FEATURES_DEFAULT we inherited, but do not use.
+# Removing this here allows us to readd them, if the end user requires them.
+DISTRO_FEATURES_DEFAULT:remove = " nfs nfc 3g pcmcia x11"
+
 DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${ONIRO_DEFAULT_DISTRO_FEATURES}"
 
 SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}"
@@ -63,12 +67,6 @@ TCLIBC = "musl"
 
 INIT_MANAGER = "systemd"
 
-# Remove some of the default Poky DISTRO_FEATURES we inherited, but do not use.
-DISTRO_FEATURES:remove = " nfs nfc 3g pcmcia x11"
-
-# Remove some of the default Poky IMAGE_FEATURES we inherited, but do not need.
-IMAGE_FEATURES:remove = " nfs-server nfs-client nfs-utils"
-
 PREFERRED_VERSION_linux-yocto = "5.10%"
 PREFERRED_PROVIDER_virtual/kernel:qemuarm = "linux-oniro"
 PREFERRED_PROVIDER_virtual/kernel:qemuarm64 = "linux-oniro"
diff --git a/meta-oniro-core/recipes-core/images/oniro-image-common.inc b/meta-oniro-core/recipes-core/images/oniro-image-common.inc
index c22c16d3..0ac0ab13 100644
--- a/meta-oniro-core/recipes-core/images/oniro-image-common.inc
+++ b/meta-oniro-core/recipes-core/images/oniro-image-common.inc
@@ -6,6 +6,10 @@
 
 inherit oniro-image
 
+# Remove some of the default Poky IMAGE_FEATURES we inherited, but do not need.
+# Best practices here are IMAGE_FEATURES should be used within image recipes.
+IMAGE_FEATURES:remove = " nfs-server nfs-client nfs-utils"
+
 IMAGE_INSTALL:append = "\
 			packagegroup-oniro-core \
 			packagegroup-net-essentials \
-- 
GitLab