diff mbox series

[kirkstone] create-spdx.bbclass: fix patch error for recipes that inherit dos2unix

Message ID 20250105114716.7188-1-liu.ming50@gmail.com
State Rejected
Delegated to: Steve Sakoman
Headers show
Series [kirkstone] create-spdx.bbclass: fix patch error for recipes that inherit dos2unix | expand

Commit Message

Ming Liu Jan. 5, 2025, 11:47 a.m. UTC
For the recipes inheriting dos2unix, do_patch will fail if
do_convert_crlf_to_lf not run before it.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 meta/classes/create-spdx.bbclass | 2 ++
 1 file changed, 2 insertions(+)

Comments

Richard Purdie Jan. 6, 2025, 9:53 a.m. UTC | #1
On Sun, 2025-01-05 at 12:47 +0100, Ming Liu via lists.openembedded.org wrote:
> For the recipes inheriting dos2unix, do_patch will fail if
> do_convert_crlf_to_lf not run before it.
> 
> Signed-off-by: Ming Liu <liu.ming50@gmail.com>
> ---
>  meta/classes/create-spdx.bbclass | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass
> index 349ecfe6ab..26d586744e 100644
> --- a/meta/classes/create-spdx.bbclass
> +++ b/meta/classes/create-spdx.bbclass
> @@ -810,6 +810,8 @@ def spdx_get_src(d):
>  
>          # Make sure gcc and kernel sources are patched only once
>          if not (d.getVar('SRC_URI') == "" or is_work_shared_spdx(d)):
> +            if bb.data.inherits_class('dos2unix', d):
> +                bb.build.exec_func('do_convert_crlf_to_lf', d)
>              bb.build.exec_func('do_patch', d)
>  
>          # Some userland has no source.
> 

This is not in master so shouldn't be applied to kirkstone or other branches yet.

I'm also not convinced this is the right fix. We may want to convert
do_convert_crlf_to_lf from a separate task to a postfunc for do_unpack
or a prefunc for do_patch if it is required it always run at that
point.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass
index 349ecfe6ab..26d586744e 100644
--- a/meta/classes/create-spdx.bbclass
+++ b/meta/classes/create-spdx.bbclass
@@ -810,6 +810,8 @@  def spdx_get_src(d):
 
         # Make sure gcc and kernel sources are patched only once
         if not (d.getVar('SRC_URI') == "" or is_work_shared_spdx(d)):
+            if bb.data.inherits_class('dos2unix', d):
+                bb.build.exec_func('do_convert_crlf_to_lf', d)
             bb.build.exec_func('do_patch', d)
 
         # Some userland has no source.