[09/27] kselftest: Migrate to a bbclass

Message ID 0195be303a81d5840a588dedc7bf5a74bf94ac07.1762170735.git.jan.kiszka@siemens.com
State Under Review
Headers show
Series [01/27] linux-custom: Drop redundant template inheritance | expand

Commit Message

Jan Kiszka Nov. 3, 2025, 11:51 a.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

"inherit kselftest" is shorter and a more common pattern compared to
OE/yocto. Keep the original .inc file as transitional helper, issuing a
warning when it's used with a migration suggestion.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../kselftest.bbclass}                        |  5 +-
 meta/recipes-kernel/kselftest/kselftest.inc   | 52 +++----------------
 2 files changed, 9 insertions(+), 48 deletions(-)
 copy meta/{recipes-kernel/kselftest/kselftest.inc => classes-recipe/kselftest.bbclass} (93%)

Patch

diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/classes-recipe/kselftest.bbclass
similarity index 93%
copy from meta/recipes-kernel/kselftest/kselftest.inc
copy to meta/classes-recipe/kselftest.bbclass
index 95dece10..ec2d267e 100644
--- a/meta/recipes-kernel/kselftest/kselftest.inc
+++ b/meta/classes-recipe/kselftest.bbclass
@@ -2,13 +2,12 @@ 
 #
 # This software is a part of ISAR.
 # Copyright (c) Mentor Graphics, a Siemens Business, 2020
+# Copyright (c) Siemens, 2025
 #
 # SPDX-License-Identifier: MIT
 
 inherit dpkg
 
-FILESPATH:append := ":${THISDIR}/files"
-
 # Some test-cases like memfd compilation failed in cross-compilation.
 # Force native compilation for now to have consistent output across
 # ISAR native/cross compilation setups.
@@ -33,7 +32,9 @@  DEBIAN_BUILD_DEPENDS ?= " \
     llvm:native, \
 "
 
+FILESPATH:append = ":${LAYERDIR_core}/recipes-kernel/kselftest/files"
 SRC_URI += "file://rules.tmpl"
+
 S = "${WORKDIR}/linux-${PV}"
 
 TEMPLATE_FILES = "rules.tmpl"
diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc
index 95dece10..a81e2550 100644
--- a/meta/recipes-kernel/kselftest/kselftest.inc
+++ b/meta/recipes-kernel/kselftest/kselftest.inc
@@ -1,53 +1,13 @@ 
-# Kselftest package for Linux
+# Transitional include for kselftest.bbclass
 #
 # This software is a part of ISAR.
-# Copyright (c) Mentor Graphics, a Siemens Business, 2020
+# Copyright (c) Siemens AG, 2025
 #
 # SPDX-License-Identifier: MIT
 
-inherit dpkg
+inherit kselftest
 
-FILESPATH:append := ":${THISDIR}/files"
-
-# Some test-cases like memfd compilation failed in cross-compilation.
-# Force native compilation for now to have consistent output across
-# ISAR native/cross compilation setups.
-ISAR_CROSS_COMPILE = "0"
-
-DESCRIPTION ?= "Kernel selftests from Linux kernel ${PV}"
-
-DEBIAN_BUILD_DEPENDS ?= " \
-    rsync, \
-    flex,  \
-    bison, \
-    ${@ 'fuse' if d.getVar('BASE_DISTRO_CODENAME') in ['bullseye', 'buster'] else 'fuse3'}, \
-    libelf-dev:native, \
-    libcap-ng-dev:native, \
-    libpopt-dev:native, \
-    libcap-dev:native, \
-    libmount-dev:native, \
-    libfuse-dev:native, \
-    libmnl-dev:native, \
-    pkg-config, \
-    clang:native, \
-    llvm:native, \
-"
-
-SRC_URI += "file://rules.tmpl"
-S = "${WORKDIR}/linux-${PV}"
-
-TEMPLATE_FILES = "rules.tmpl"
-TEMPLATE_VARS += "KSELFTEST_ARGS"
-
-KSELFTEST_TARGETS ?= ""
-KSELFTEST_SKIP_TARGETS ?= ""
-KSELFTEST_FORCE_TARGETS ?= "0"
-
-KSELFTEST_ARGS = "${@ "TARGETS=\"${KSELFTEST_TARGETS}\"" if d.getVar('KSELFTEST_TARGETS') else ''}"
-KSELFTEST_ARGS .= "${@ " FORCE_TARGETS=1" if bb.utils.to_boolean(d.getVar('KSELFTEST_FORCE_TARGETS')) else ''}"
-KSELFTEST_ARGS .= "${@ " SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" if d.getVar('KSELFTEST_SKIP_TARGETS') else ''}"
-
-do_prepare_build[cleandirs] += "${S}/debian"
-do_prepare_build() {
-    deb_debianize
+do_warn_custom_inc() {
+    bbwarn "Please migrate from \"require recipes-kernel/kselftest/kselftest.inc\" to \"inherit kselftest\""
 }
+addtask warn_custom_inc before do_unpack