From mboxrd@z Thu Jan 1 00:00:00 1970 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-f58.google.com (mail-lf1-f58.google.com [209.85.167.58]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 52SKPmQ4011442 (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-f58.google.com with SMTP id 2adb3069b0e04-549adfc38d8sf1091465e87.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=bi4qvZo20tw2FXPE84umS670IsfSiGJqy/hWBnG68aRmq0XBj+JlN5tBEE4ERwEKLu A7kYny7wACF/HdgsKSdvaBpckmSI8UOsAsXsZAxBbBZfg+gS1ZxAu0Q29aCw7Rqq+xAl A9GnumkvYcl2y9/TSWvJeo7qh5t7Zz5T/hXUta9vJhsa9iNl2GOZjGZ9oaMGLzgDqziw exXxFEO3xPDB5sJOSvyP4hthodC/V6SY0EaAs6rDoYeAbti81xPCdoEtzv3QERm3D5C4 NUXx+jiU4fr7H7ptYlLE7u27i28ls5eHdMutHnD4jokty70oavs3RemvcCsGk14ylTuz eDdA== 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=ahsgUcZrtYZSJEAu1j/D6Vl3FXqzdcKgF9aXiP4xZkU=; b=U/5Wy1m+CB4LgkW2rQR6AycWZyz3EOO1J3lFTYsomLwcZ36bFa/oeDW9KtioB3sQnj f5fMACH9gFgb5L4B0bwmOUIt/fkar6ULKdtMJNbRLnWSlR6cgp2XDOXajf3hRiX0ShVN 9g2SJnd6q0+jPRGcd+yPyDTD0nsI44FdgKkMbeqAG9bUBFvfTQSXRXE8rZOnDXqqnot1 XOCT/0XWrxpr1i2l8M62APKYvEZjCfdpvULb+yUmu/Xe1Vpdi9YQcP7yKKdRqkg6Y50E Itr2u0mWEGq7CLz9Of9kh/+IpZ23x7TKZMv14Sn1H8DqwrEEJwgpHkSkjGYKcjfSkYbg pPDg==; darn=ilbers.de 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=ilbers.de; 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=cQjAHLU4OMqNBa8Er0JFGTjpomrIvdXx2zekGasJEEfJsI4bQaazxpNNqW3G/u6M2J O5/oGUC4svvRjPluQsgGiLPXZ0Uaip9fgfbYfhOOK2oqhgZ4z6JJTrJKZ9xDdOcJhcap FwTbJ5AqAfhYduCgAPq06dFb37Hjx9AdlN37r6h6WLY6ETejguK41h2YySxc0PE9k4Sf uaLjkttywoXiiyydjNKCqpg+iIKuCNfMCI8BokacCT/vx4Zio7R47IfLpfrdpeyrt4v7 CHbY51CGWkm8aMWH8fnWW3Ktc/Nnf5WU0tvjHH8iaJ0eQ68uIus212XeCn153DD5m9fA IyWg== 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=t8jlnnhn1GMF8Ri5C5iOaOR7EC7vRTDF1l0P99CaXQz9KurzzOYoG+m/2sLtwYLRfW 8wLFoo7UG7n8OpdIwY5DRf5amheEl/qwmFDkPHSFzsPFnHv4tvlsEyRsCwj6IASRTzxv Z0Tz04+M8vAm7FazzmVSDTQkRdvjINj921TgFGsknD4fxKEjDdx2YV6Q/1oFC2squqwZ 1L4xCehx7H/oKHqWJ3AtlJXe2Pnkz2w048UYQYKsTtYHt68SDf23x2nUn/FVddYSJqK0 zEWS54i1QBDo74ri3nmYj9PP6P2C3acgsWaLb0iP2/nB4ciPu31Us1xww8qi0ai/ufZ4 zbwA== X-Forwarded-Encrypted: i=2; AJvYcCV72EIitXG2+WNzVEV6inA+e1FqOnrvVVXAKOJkkTQUXLQxLH5s38mY8PBbsKp09bHnax8+@ilbers.de X-Gm-Message-State: AOJu0YzZcCRvNoFDWHfHf8gY8iwYfnvmgS1Fd06sLduHMCzr8rEbwQaN n3Dhi97FHdjBmqnYyj374+/X/XIYMrXJfSbdqw247fraUyuwwSpW 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 From: "chris.larson via isar-users" 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 Content-Type: text/plain; charset="UTF-8" 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-TUID: xUa/9p77nXD9 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") +} -- 2.47.2 -- You received this message because you are subscribed to the Google Groups "isar-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250328202532.15607-1-chris.larson%40siemens.com.