public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 1/1] linux-kernel: add cleandirs flag for tasks
@ 2026-05-07 12:05 'Christoph Steiger' via isar-users
  0 siblings, 0 replies; only message in thread
From: 'Christoph Steiger' via isar-users @ 2026-05-07 12:05 UTC (permalink / raw)
  To: isar-users
  Cc: felix.moessbauer, quirin.gylstorff, clara.kowalsky, Christoph Steiger

Provide a cleandirs flag for directories that are used and expected to
be empty during do_dpkg_source and do_prepare_build. This is the proper
way to make sure directories exist and are empty.

This also allows users to extend e.g. the do_dpkg_source functionality
since that otherwise depends on the prepend order.

Signed-off-by: Christoph Steiger <christoph.steiger@siemens.com>
---
 meta/classes-recipe/linux-kernel.bbclass | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
index e3deac2d..55ea6d63 100644
--- a/meta/classes-recipe/linux-kernel.bbclass
+++ b/meta/classes-recipe/linux-kernel.bbclass
@@ -240,9 +240,9 @@ def get_additional_build_profiles(d):
 KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'pkg.{}.libcdev-arch-all'.format(d.getVar('BPN')), 'all\nMulti-Arch: foreign', 'any', d) }"
 DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}"
 
+do_prepare_build[cleandirs] += "${S}/debian"
 do_prepare_build:prepend() {
 	# copy meta-data over to source tree
-	rm -rf ${S}/debian
 	cp -r ${WORKDIR}/debian ${S}/
 
 	# remove templates from the source tree
@@ -308,7 +308,6 @@ dpkg_configure_kernel() {
     KERNEL_CONFIG_TARGET="${@get_kernel_config_target(d)}"
 EOF
 
-	rm -rf ${S}/${KERNEL_BUILD_DIR} && mkdir -p ${S}/${KERNEL_BUILD_DIR}
 	if [ -n "${KERNEL_DEFCONFIG}" ]; then
 		if [ -e "${WORKDIR}/${KERNEL_DEFCONFIG}" ]; then
 			cp ${WORKDIR}/${KERNEL_DEFCONFIG} ${S}/${KERNEL_BUILD_DIR}/.config
@@ -317,7 +316,6 @@ EOF
 
 	# copy config fragments over to the kernel tree
 	src_frags="${@ " ".join(config_fragments(d)) }"
-	rm -rf ${S}/debian/fragments
 	for frag in ${src_frags}; do
 		# skip frag if it starts with ${S}, thus is part of the sources
 		if [ "${frag#${S}}" = "$frag" ]; then
@@ -337,6 +335,7 @@ get_localversion_auto() {
 	fi
 }
 
+do_dpkg_source[cleandirs] += "${S}/${KERNEL_BUILD_DIR} ${S}/debian/fragments"
 do_dpkg_source:prepend() {
 	dpkg_configure_kernel
 	get_localversion_auto
-- 
2.47.3

-- 
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/20260507120513.297817-1-christoph.steiger%40siemens.com.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-07 12:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-07 12:05 [PATCH 1/1] linux-kernel: add cleandirs flag for tasks 'Christoph Steiger' via isar-users

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox