diff mbox series

[v3] features_check: improve error message for missing required DISTRO_FEATURES

Message ID 20251106-v3-features_check-improve-error-v3-1-a81ca99e55d6@schnwalter.eu
State New
Headers show
Series [v3] features_check: improve error message for missing required DISTRO_FEATURES | expand

Commit Message

Walter Werner SCHNEIDER Nov. 6, 2025, 12:01 p.m. UTC
The original message for REQUIRED_DISTRO_FEATURES entries that were
missing from DISTRO_FEATURES was:

ERROR: Nothing PROVIDES 'core-image-weston'
core-image-weston was skipped: missing required distro feature 'wayland'
(not in DISTRO_FEATURES)

For newcomers, this is error message doesn't provide enough information to
identify the root cause, which could be: using the wrong DISTRO. This patch
changes the error message to include the distro name:

ERROR: Nothing PROVIDES 'core-image-weston'
core-image-weston was skipped: using DISTRO 'nodistro', which is missing
required DISTRO_FEATURES: 'wayland'

Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
---
v2 -> v3: Change only the error for DISTRO and update commit description.
v1 -> v2: Changed the error message.

Link to v2: https://lore.kernel.org/openembedded-core/20251029135419.12883-1-contact@schnwalter.eu/
---
 meta/classes-recipe/features_check.bbclass | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


---
base-commit: 8ce0359c4eade11b445bc227c42f7f1212a2d9c3
change-id: 20251106-v3-features_check-improve-error-5038a8540a94

Best regards,
diff mbox series

Patch

diff --git a/meta/classes-recipe/features_check.bbclass b/meta/classes-recipe/features_check.bbclass
index 1e0eaa4eedb50fbfb09f8a1c56631db3782db6c2..46d8243cb6b34f44a03345f7e34948444a3ca7c2 100644
--- a/meta/classes-recipe/features_check.bbclass
+++ b/meta/classes-recipe/features_check.bbclass
@@ -42,8 +42,12 @@  python () {
         if required_features:
             missing = set.difference(required_features, features)
             if missing:
-                raise bb.parse.SkipRecipe("missing required %s feature%s '%s' (not in %s_FEATURES)"
-                    % (kind.lower(), 's' if len(missing) > 1 else '', ' '.join(missing), kind))
+                if kind == 'DISTRO':
+                    raise bb.parse.SkipRecipe("using %s '%s', which is missing required %s_FEATURES: '%s'"
+                        % (kind, d.getVar(kind), kind, ' '.join(missing)))
+                else:
+                    raise bb.parse.SkipRecipe("missing required %s feature%s '%s' (not in %s_FEATURES)"
+                        % (kind.lower(), 's' if len(missing) > 1 else '', ' '.join(missing), kind))
 
         conflict_features = set((d.getVar('CONFLICT_' + kind + '_FEATURES') or '').split())
         if conflict_features: