From patchwork Fri Mar 28 20:25:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "chris.larson" X-Patchwork-Id: 4130 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Fri, 28 Mar 2025 21:25:49 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-lf1-f57.google.com (mail-lf1-f57.google.com [209.85.167.57]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 52SKPmfg011436 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 28 Mar 2025 21:25:48 +0100 Received: by mail-lf1-f57.google.com with SMTP id 2adb3069b0e04-549adfc38d8sf1091464e87.1 for ; Fri, 28 Mar 2025 13:25:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1743193543; cv=pass; d=google.com; s=arc-20240605; b=F/KXRRD1mK6E8w0glJjjZmdrfw09Ukyu+zTkYAs6HjVzjAtKhgxwBIF88n5pJjwDUl spoYoqpo/Iw1oYX20MK91i/HshgW6EqmFpN7NtLLkKKWygZA5OMrZE3o50rL2/C8qUVf ojdJe3YESXxEhwsDFDzXWQUPiqsU2rcfkU+tW4xaAZqjB8QOVJWQwhe9dZvUo/jy1qvV 17TBF5dgo3/cnII6+uLjzszjlP7oOl/H/dhi5UbbOjB4WmC36VdBpPvbi32J3KGZBqOV +qMUy7MBUfWNIwjh1whEX6Iz/EDV1lKuvkEchmcrKqb6YZyk1lgM4AvsB1Q1TUeV/VaQ qyZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:feedback-id:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=BGGIGEe1I8abyy2GIK8iFv9tgI1afL4YiKhZr7BVqRc=; fh=TkYxlNH6I01kpheshS4gbgxepEUxLMT4/0ipDqF4CZc=; b=dewbyed0A1r8N8p340qx42bnoRU5JnmXwYb0qlhHzOSND2zu65HOEOfqbMkrrLBEjj aiXgLTZLMc2T2kfhQmhu3Cp1woy4VOHWEindawoLaUJMDx8tsRDqVALNQarradMevku3 0au+STqiJJ45k3AJtaD7SMMO3UbnStR2ToXFZhsjEzl5YKVCebmG9HJ/ht4jO7ZJyz38 Q5bHK56KRkbJjESAjaCtU7fe8IVmrjIAxsEZHDk1QlqUTRBJ/IIvOEqIWl+3zNbZdUq6 DA9pc6j3HdCl/c0ujvRvC3tdHj2KpcjxYohUFqiR/nRytzjx3ABOOYr1DbdWH9M1uv5q EQ6g==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=Xq1ILTke; spf=pass (google.com: domain of fm-1325773-202503282025375d82775819bef8fe17-cmumpf@rts-flowmailer.siemens.com designates 185.136.65.227 as permitted sender) smtp.mailfrom=fm-1325773-202503282025375d82775819bef8fe17-CmumPF@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1743193543; x=1743798343; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=BGGIGEe1I8abyy2GIK8iFv9tgI1afL4YiKhZr7BVqRc=; b=jFj55PRERMpXUA+bpHKePN+z48of5h3GLlvlOnebAP+ca/7bLoriFW+zvpqk1DYFXq 558Ejr9HR3VgW5n/rTzSEhlNlz51kspyAnHE3xXTVTEsCMwfglkU6WC/cZ+IFGrMdA4h pudm3rJUG1vzkAuZbdtjDTOiSXgj90O0Epby3peZPluP5NhRBOUz5WHRXZo0GNsngI8Y zFd+zOdzE2xarvlxa0pd/ZJSYWM1NJbmAX6MY9L+Jn0i8Iqw3F3hnahdm9+ND4bn2qxH xwRDQVJFrFvvIuegtWw8V7+lAuon5wTAuBOvgPrJ0Ht5VYOv3RDmBA6SFkqOeARbwwlC e4og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743193543; x=1743798343; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:message-id:date:subject:cc:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BGGIGEe1I8abyy2GIK8iFv9tgI1afL4YiKhZr7BVqRc=; b=jE0gYc78MGRayJk9ejfHxY5pa7TgiK1LOM0eUgBD/kcL3dN1AwpYAFQgd0IClVjQ6D YBAJEmn1WW2hmtqbW25PCEd9Z09vUq7mYIPl3IZ/BiwtwsAvET0gk0WVVV6BlEzW8c3p DsqBLzKDg5aKEZybki2vxNc+uwh1ldb5pgxJ+cHW/oRkMqF6yEZFYt0T0Lve7g2rI4QQ 5gp33R75bQP2mbaw4UOoxHFdtcHfD6wX6sK8ov++PH7xHI1PrZB+BfrG50IoaHZn2d+v Y5qjD4IG9JdJ7Ebl9ZyenQpn0hRZNhdk0Iqle3gCTYlDjdynWCq+8R2O2It0NaTm6Mpk cPXw== X-Forwarded-Encrypted: i=2; AJvYcCV77GQiXH9uH4L9wpoTeeiMm9nQwbOrOFoyvueLs+YFsPCpsBfwmJkg7xYRA2GL3xhHrToEzpY=@isar-build.org X-Gm-Message-State: AOJu0Yz9WTZCdP5KRoU0ycttXF8Jw8zYK0soIID1GZP4gbkvQt4DdZc1 leYLx7hORElsUSG317oqs8VJ5DNhBGSOsd+chi+CY/o9/DlkbBlL X-Google-Smtp-Source: AGHT+IH0FSGjZz5d/rm50zZ10l2AdEtgHH0aSqX5BaeAvD7Zuw3MU8lXOiu3Q4PA1Wyyhv7IhVphhg== X-Received: by 2002:a05:6512:ad0:b0:549:8db6:b2da with SMTP id 2adb3069b0e04-54b10ecde23mr255598e87.30.1743193542336; Fri, 28 Mar 2025 13:25:42 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com; h=ARLLPALFayOh5sdy9qpAQ38/J4KMvLWzjqgE1Or5S4vR1oRHJg== Received: by 2002:a19:8c5b:0:b0:549:9a7f:c5c9 with SMTP id 2adb3069b0e04-54b01359141ls553384e87.0.-pod-prod-01-eu; Fri, 28 Mar 2025 13:25:39 -0700 (PDT) X-Received: by 2002:a05:651c:222c:b0:30d:c534:692 with SMTP id 38308e7fff4ca-30de02fe933mr2448671fa.29.1743193538765; Fri, 28 Mar 2025 13:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1743193538; cv=none; d=google.com; s=arc-20240605; b=hAXfJGa3jeD60dZoC1j3bJ0xS7dzF4+D5EBuQiQE/+nwwa4GGy0towyAhjIyG+cUiO P4GSurSDZ4PtBJymODA5MtVExohP70TCS2jdCj9g8tdtvVIPZMfWz17T/m+k0X84NvU2 oMGAVq4JMj1LMKoQWNQHkkn+fXiUynwbAe4PfLWJCv2gosixU6w42yguWu0e+pNy7J6z ma2qMqPnS5EHHQSd1yodJ1UoUPTvkS5tan0zdrU3hTDjpq7CGKq/FPrCaYUJgPJW+wqQ acO6JnxsxHEwsVtJUrfgPzl3/Gz2sC2X430/ZLZziiALYm46U3TIN0OlDgjhdfxTNLmZ am5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=feedback-id:content-transfer-encoding:mime-version:message-id:date :subject:cc:to:from:dkim-signature; bh=v1wOKl9+SzM5lxmd/O4I52ku5dZIGBIlsIQqGlZ3eC4=; fh=bxwHoRtzgcBE20fsluyIAvpVkk49eQhu61r0Hn3s3Yc=; b=BMM5BDqxhXgzZh52/80RuW5kcATD9uKhXX+/h4XBGnSzFJVdPq0uquw6pM+YsHPIOH rMGpdtl4w25cLAzO9gaVT6KNzA+bIAjZkyvpK8PJZn7+EygFhq3VNNYXyEYgP7uO+pbv ZYFaVlyPW1nXfybCEn8KuXtVBkXYT8dfrhrAalYVdIWgxZXMBii//+XG44aHNgGzVpVO v+4+G4xdOCcohUa0+fDA8xKf0EpPFwQ9+8aklBHsmGKr2guyN4UDczPPx6OQNBLOttkS JVLpMZkgJEke7VC5aMDgAEUpTSHsozJjKOYCTg5naWPVrQAJDhGJ5qqdD1SwdUnY/wo1 pB1A==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=Xq1ILTke; spf=pass (google.com: domain of fm-1325773-202503282025375d82775819bef8fe17-cmumpf@rts-flowmailer.siemens.com designates 185.136.65.227 as permitted sender) smtp.mailfrom=fm-1325773-202503282025375d82775819bef8fe17-CmumPF@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-65-227.siemens.flowmailer.net (mta-65-227.siemens.flowmailer.net. [185.136.65.227]) by gmr-mx.google.com with ESMTPS id 38308e7fff4ca-30dd2b48170si577071fa.8.2025.03.28.13.25.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Mar 2025 13:25:38 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-1325773-202503282025375d82775819bef8fe17-cmumpf@rts-flowmailer.siemens.com designates 185.136.65.227 as permitted sender) client-ip=185.136.65.227; Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 202503282025375d82775819bef8fe17 for ; Fri, 28 Mar 2025 21:25:38 +0100 X-Patchwork-Original-From: "chris.larson via isar-users" From: "chris.larson" To: isar-users@googlegroups.com Cc: Cedric Hombourger , Christopher Larson Subject: [PATCH] features_check: add bbclass from oe-core 1a2afcd0 Date: Fri, 28 Mar 2025 13:25:32 -0700 Message-ID: <20250328202532.15607-1-chris.larson@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1325773:519-21489:flowmailer X-Original-Sender: chris.larson@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=Xq1ILTke; spf=pass (google.com: domain of fm-1325773-202503282025375d82775819bef8fe17-cmumpf@rts-flowmailer.siemens.com designates 185.136.65.227 as permitted sender) smtp.mailfrom=fm-1325773-202503282025375d82775819bef8fe17-CmumPF@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: chris.larson@siemens.com Reply-To: chris.larson@siemens.com Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED, RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: Christopher Larson Allow checking of required and conflicting features. xxx = [DISTRO,MACHINE,COMBINED,IMAGE,BSP,ROOTFS] ANY_OF_xxx_FEATURES: ensure at least one item on this list is included in xxx_FEATURES. REQUIRED_xxx_FEATURES: ensure every item on this list is included in xxx_FEATURES. CONFLICT_xxx_FEATURES: ensure no item in this list is included in xxx_FEATURES. This allows one to easily specify that a given feature is required for a recipe. By using this with the new features variables, we can ensure that features are set correctly for a given recipe. We can use simple checks like this: REQUIRED_BSP_FEATURES += "some-bsp-feature" In combination with inline python, we can implement behaviors and checks like this: # Enable the 'wayland' image feature if the machine feature is enabled. IMAGE_FEATURES:append = " ${@bb.utils.filter('MACHINE_FEATURES', 'wayland', d)}" # Require the 'wayland' machine feature when the image feature is enabled. REQUIRED_MACHINE_FEATURES += "${@bb.utils.filter('IMAGE_FEATURES', 'wayland', d)}" Signed-off-by: Christopher Larson --- meta/classes/features_check.bbclass | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 meta/classes/features_check.bbclass diff --git a/meta/classes/features_check.bbclass b/meta/classes/features_check.bbclass new file mode 100644 index 00000000..304501b0 --- /dev/null +++ b/meta/classes/features_check.bbclass @@ -0,0 +1,57 @@ +# Allow checking of required and conflicting features +# +# xxx = [DISTRO,MACHINE,COMBINED,IMAGE,BSP,ROOTFS] +# +# ANY_OF_xxx_FEATURES: ensure at least one item on this list is included +# in xxx_FEATURES. +# REQUIRED_xxx_FEATURES: ensure every item on this list is included +# in xxx_FEATURES. +# CONFLICT_xxx_FEATURES: ensure no item in this list is included in +# xxx_FEATURES. +# +# Copyright 2019 (C) Texas Instruments Inc. +# Copyright 2013 (C) O.S. Systems Software LTDA. +# +# SPDX-License-Identifier: MIT + + +python () { + if bb.utils.to_boolean(d.getVar('PARSE_ALL_RECIPES', False)): + return + + unused = True + + for kind in ['DISTRO', 'MACHINE', 'COMBINED', 'IMAGE', 'BSP', 'ROOTFS']: + if d.getVar('ANY_OF_' + kind + '_FEATURES') is None and not d.hasOverrides('ANY_OF_' + kind + '_FEATURES') and \ + d.getVar('REQUIRED_' + kind + '_FEATURES') is None and not d.hasOverrides('REQUIRED_' + kind + '_FEATURES') and \ + d.getVar('CONFLICT_' + kind + '_FEATURES') is None and not d.hasOverrides('CONFLICT_' + kind + '_FEATURES'): + continue + + unused = False + + # Assume at least one var is set. + features = set((d.getVar(kind + '_FEATURES') or '').split()) + + any_of_features = set((d.getVar('ANY_OF_' + kind + '_FEATURES') or '').split()) + if any_of_features: + if set.isdisjoint(any_of_features, features): + raise bb.parse.SkipRecipe("one of '%s' needs to be in %s_FEATURES" + % (' '.join(any_of_features), kind)) + + required_features = set((d.getVar('REQUIRED_' + kind + '_FEATURES') or '').split()) + 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)) + + conflict_features = set((d.getVar('CONFLICT_' + kind + '_FEATURES') or '').split()) + if conflict_features: + conflicts = set.intersection(conflict_features, features) + if conflicts: + raise bb.parse.SkipRecipe("conflicting %s feature%s '%s' (in %s_FEATURES)" + % (kind.lower(), 's' if len(conflicts) > 1 else '', ' '.join(conflicts), kind)) + + if unused: + bb.warn("Recipe inherits features_check but doesn't use it") +}