Openembedded Core Discussions
 help / color / mirror / Atom feed
* [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory
@ 2024-04-11  8:05 Heiko Thole
  2024-04-11  8:05 ` [PATCH] " Heiko Thole
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Heiko Thole @ 2024-04-11  8:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Heiko Thole

If the kernel folder does not exist, find will result in an error.
This can occur if the kernel has no modules but, for example, custom modules are created.

Add check before deleting.

Signed-off-by: Heiko Thole <heiko.thole@entwicklung.eq-3.de>
---
 meta/classes/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index dbd89057f3..988a489396 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -452,7 +452,7 @@ kernel_do_install() {
                rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
                rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
                # Remove empty module directories to prevent QA issues
-               find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
+               [ -d "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" ] && find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
        else
                bbnote "no modules to install"
        fi
--
2.41.0

eQ-3 Entwicklung GmbH, Maiburger Str. 36, 26789 Leer
Geschäftsführer: Prof. Heinz-G. Redeker
Registergericht: Amtsgericht Aurich, HRB 110388
eQ-3 AG, Maiburger Str. 29, 26789 Leer
Vorstand: Prof. Heinz-G. Redeker (Vorsitzender), Helga Redeker
Vorsitzende des Aufsichtsrats: Irmgard Keplin
Registergericht: Amtsgericht Aurich, HRB 200335


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] kernel.bbclass: check, if directory exists before removing empty module directory
  2024-04-11  8:05 [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory Heiko Thole
@ 2024-04-11  8:05 ` Heiko Thole
  2024-04-11  8:16 ` [OE-core] [kirkstone][PATCH] " Quentin Schulz
  2024-04-11 13:26 ` [OE-core] " Steve Sakoman
  2 siblings, 0 replies; 9+ messages in thread
From: Heiko Thole @ 2024-04-11  8:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Heiko Thole

If the kernel folder does not exist, find will result in an error.
This can occur if the kernel has no modules but, for example, custom modules are created.

Add check before deleting.

Signed-off-by: Heiko Thole <heiko.thole@entwicklung.eq-3.de>
---
 meta/classes/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index dbd89057f3..988a489396 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -452,7 +452,7 @@ kernel_do_install() {
                rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
                rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
                # Remove empty module directories to prevent QA issues
-               find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
+               [ -d "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" ] && find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
        else
                bbnote "no modules to install"
        fi
--
2.41.0

eQ-3 Entwicklung GmbH, Maiburger Str. 36, 26789 Leer
Geschäftsführer: Prof. Heinz-G. Redeker
Registergericht: Amtsgericht Aurich, HRB 110388
eQ-3 AG, Maiburger Str. 29, 26789 Leer
Vorstand: Prof. Heinz-G. Redeker (Vorsitzender), Helga Redeker
Vorsitzende des Aufsichtsrats: Irmgard Keplin
Registergericht: Amtsgericht Aurich, HRB 200335


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [OE-core] [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory
  2024-04-11  8:05 [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory Heiko Thole
  2024-04-11  8:05 ` [PATCH] " Heiko Thole
@ 2024-04-11  8:16 ` Quentin Schulz
  2024-04-11  8:32   ` Heiko
  2024-04-11 13:26 ` [OE-core] " Steve Sakoman
  2 siblings, 1 reply; 9+ messages in thread
From: Quentin Schulz @ 2024-04-11  8:16 UTC (permalink / raw)
  To: heiko.thole, openembedded-core

Hi Heiko,

On 4/11/24 10:05, Heiko via lists.openembedded.org wrote:
> [You don't often get email from heiko.thole=entwicklung.eq-3.de@lists.openembedded.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> If the kernel folder does not exist, find will result in an error.
> This can occur if the kernel has no modules but, for example, custom modules are created.
> 
> Add check before deleting.
> 
> Signed-off-by: Heiko Thole <heiko.thole@entwicklung.eq-3.de>
> ---
>   meta/classes/kernel.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index dbd89057f3..988a489396 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -452,7 +452,7 @@ kernel_do_install() {
>                  rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>                  rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>                  # Remove empty module directories to prevent QA issues
> -               find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
> +               [ -d "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" ] && find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete

What about using

rm --dir --force 
"${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel"

instead?

        -f, --force
               ignore nonexistent files and arguments, never prompt

        -d, --dir
               remove empty directories

Cheers,
Quentin


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory
  2024-04-11  8:16 ` [OE-core] [kirkstone][PATCH] " Quentin Schulz
@ 2024-04-11  8:32   ` Heiko
  0 siblings, 0 replies; 9+ messages in thread
From: Heiko @ 2024-04-11  8:32 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

Hi Quentin,

On Thu, Apr 11, 2024 at 10:16 AM, Quentin Schulz wrote:

> 
> rm --dir --force
> "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel"
> 
> instead?
> 
> -f, --force
> ignore nonexistent files and arguments, never prompt
> 
> -d, --dir
> remove empty directories
> 
> Cheers,
> Quentin

rm --dir --force does not work if the directory exists:

rm: cannot remove '/yocto/source/build-cm4/tmp/work/raspberrypi4_64-poky-linux/linux-yocto/6.6.25+git-r0/image/lib/modules/6.6.25-hcu/kernel': Directory not empty

Best regards
Heiko

[-- Attachment #2: Type: text/html, Size: 651 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory
  2024-04-11  8:05 [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory Heiko Thole
  2024-04-11  8:05 ` [PATCH] " Heiko Thole
  2024-04-11  8:16 ` [OE-core] [kirkstone][PATCH] " Quentin Schulz
@ 2024-04-11 13:26 ` Steve Sakoman
  2024-04-11 13:40   ` Heiko
  2 siblings, 1 reply; 9+ messages in thread
From: Steve Sakoman @ 2024-04-11 13:26 UTC (permalink / raw)
  To: Heiko; +Cc: openembedded-core

This patch doesn't apply for me:

Applying: kernel.bbclass: check, if directory exists before removing
empty module directory
Using index info to reconstruct a base tree...
error: patch failed: meta/classes/kernel.bbclass:452
error: meta/classes/kernel.bbclass: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Patch failed at 0001 kernel.bbclass: check, if directory exists before
removing empty module directory

Steve

On Thu, Apr 11, 2024 at 1:06 AM Heiko <heiko.thole@entwicklung.eq-3.de> wrote:
>
> If the kernel folder does not exist, find will result in an error.
> This can occur if the kernel has no modules but, for example, custom modules are created.
>
> Add check before deleting.
>
> Signed-off-by: Heiko Thole <heiko.thole@entwicklung.eq-3.de>
> ---
>  meta/classes/kernel.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index dbd89057f3..988a489396 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -452,7 +452,7 @@ kernel_do_install() {
>                 rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
>                 rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
>                 # Remove empty module directories to prevent QA issues
> -               find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
> +               [ -d "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" ] && find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
>         else
>                 bbnote "no modules to install"
>         fi
> --
> 2.41.0
>
> eQ-3 Entwicklung GmbH, Maiburger Str. 36, 26789 Leer
> Geschäftsführer: Prof. Heinz-G. Redeker
> Registergericht: Amtsgericht Aurich, HRB 110388
> eQ-3 AG, Maiburger Str. 29, 26789 Leer
> Vorstand: Prof. Heinz-G. Redeker (Vorsitzender), Helga Redeker
> Vorsitzende des Aufsichtsrats: Irmgard Keplin
> Registergericht: Amtsgericht Aurich, HRB 200335
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#198117): https://lists.openembedded.org/g/openembedded-core/message/198117
> Mute This Topic: https://lists.openembedded.org/mt/105458549/3620601
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [steve@sakoman.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory
  2024-04-11 13:26 ` [OE-core] " Steve Sakoman
@ 2024-04-11 13:40   ` Heiko
  2024-04-12  9:03     ` [OE-core] " Matthias Schiffer
  0 siblings, 1 reply; 9+ messages in thread
From: Heiko @ 2024-04-11 13:40 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

Hi Steve,

I created the patch as described here: https://docs.yoctoproject.org/4.0.17/contributor-guide/submit-changes.html#contributing-through-mailing-lists-why-not-using-web-based-workflows

Only one line has been changed. Is it possible for you to change it?

Best regards,
Heiko

[-- Attachment #2: Type: text/html, Size: 515 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory
  2024-04-11 13:40   ` Heiko
@ 2024-04-12  9:03     ` Matthias Schiffer
  2024-04-12  9:52       ` Heiko
  0 siblings, 1 reply; 9+ messages in thread
From: Matthias Schiffer @ 2024-04-12  9:03 UTC (permalink / raw)
  To: Heiko; +Cc: openembedded-core

On Thu, 2024-04-11 at 06:40 -0700, Heiko wrote:
> 
>  Hi Steve,
> 
> I created the patch as described
> here: https://docs.yoctoproject.org/4.0.17/contributor-guide/submit-changes.html#contributing-thro
> ugh-mailing-lists-why-not-using-web-based-workflows
> 
> Only one line has been changed. Is it possible for you to change it?
> 
> Best regards,
> Heiko


Thanks for sending the patch, I was about to submit a very similar one just yesterday. Note that
this should be fixed in OE-core master/scarthgap first, then backported to kirkstone.

The issue with your patch is that it uses spaces instead of tabs for indentation, which doesn't
match the original file. This may have happenen if you copied the patch content from a terminal, or
due to your mail user agent - issues like this are unfortunately common, which is why `git send-
email` is the recommended way to submit patches.

Best regards,
Matthias

-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory
  2024-04-12  9:03     ` [OE-core] " Matthias Schiffer
@ 2024-04-12  9:52       ` Heiko
  2024-04-12 12:18         ` [OE-core] " Steve Sakoman
  0 siblings, 1 reply; 9+ messages in thread
From: Heiko @ 2024-04-12  9:52 UTC (permalink / raw)
  To: openembedded-core


[-- Attachment #1.1: Type: text/plain, Size: 171 bytes --]

I used " git send- email". I don`t know, why the tabs were replaced.

I have attached the patch with tabs. (Or do I have to create a new post?)

Best regards,
Heiko

[-- Attachment #1.2: Type: text/html, Size: 295 bytes --]

[-- Attachment #2: kirkstone-kernel.bbclass-check-if-directory-exists-before-removing-empty-module-directory.diff --]
[-- Type: application/octet-stream, Size: 712 bytes --]

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index dbd89057f3..988a489396 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -452,7 +452,7 @@ kernel_do_install() {
rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
		rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
		# Remove empty module directories to prevent QA issues
-		find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
+		[ -d "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" ] && find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete
	else
		bbnote "no modules to install"
	fi

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [OE-core] [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory
  2024-04-12  9:52       ` Heiko
@ 2024-04-12 12:18         ` Steve Sakoman
  0 siblings, 0 replies; 9+ messages in thread
From: Steve Sakoman @ 2024-04-12 12:18 UTC (permalink / raw)
  To: Heiko; +Cc: openembedded-core

On Fri, Apr 12, 2024 at 2:52 AM Heiko <heiko.thole@entwicklung.eq-3.de> wrote:
>
> I used "git send-email". I don`t know, why the tabs were replaced.
>
> I have attached the patch with tabs. (Or do I have to create a new post?)

You should send a new patch targeted for the master branch since we
need to fix this there first before I can backport it to kirkstone.

Thanks!

Steve


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-12 12:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-11  8:05 [kirkstone][PATCH] kernel.bbclass: check, if directory exists before removing empty module directory Heiko Thole
2024-04-11  8:05 ` [PATCH] " Heiko Thole
2024-04-11  8:16 ` [OE-core] [kirkstone][PATCH] " Quentin Schulz
2024-04-11  8:32   ` Heiko
2024-04-11 13:26 ` [OE-core] " Steve Sakoman
2024-04-11 13:40   ` Heiko
2024-04-12  9:03     ` [OE-core] " Matthias Schiffer
2024-04-12  9:52       ` Heiko
2024-04-12 12:18         ` [OE-core] " Steve Sakoman

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