Message ID | 20250123082500.903901-1-hongxu.jia@windriver.com |
---|---|
State | New |
Headers | show |
Series | [v2] dos2unix.bbclass: Fix patch error for recipes that inherit dos2unix. | expand |
On Thu, 2025-01-23 at 16:25 +0800, hongxu via lists.openembedded.org wrote: > While SPDX_INCLUDE_SOURCES = "1", call do_patch in do_create_spdx failed > for these recipes inherit dos2unix > > Prepend function do_convert_crlf_to_lf to task do_patch to assure always > run before do_patch > > Add dos2unix-native to DEPENDS to assure the existence of command dos2unix > before do_convert_crlf_to_lf is executed in any task > > Also remove extra do_convert_crlf_to_lf in archiver.bbclass which > is not necessary any more > > Suggested-by Richard Purdie <richard.purdie@linuxfoundation.org> > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > --- > Changed in v2: > > Do not call bb.build.exec_func to run do_convert_crlf_to_lf in classes/spdx-common, > preprend it to task do_patch to assure always run before do_patch > > meta/classes-recipe/dos2unix.bbclass | 8 +++++--- > meta/classes/archiver.bbclass | 3 --- > 2 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/meta/classes-recipe/dos2unix.bbclass b/meta/classes-recipe/dos2unix.bbclass > index 18e89b1cf2..edc8c3afb4 100644 > --- a/meta/classes-recipe/dos2unix.bbclass > +++ b/meta/classes-recipe/dos2unix.bbclass > @@ -10,11 +10,13 @@ > # on Linux(LF), which can cause annoying patching errors during > # git push/checkout processes. > > -do_convert_crlf_to_lf[depends] += "dos2unix-native:do_populate_sysroot" > +DEPENDS += "dos2unix-native" That will break the class for normal do_patch unfortunately, DEPENDS is too late. Cheers, Richard
diff --git a/meta/classes-recipe/dos2unix.bbclass b/meta/classes-recipe/dos2unix.bbclass index 18e89b1cf2..edc8c3afb4 100644 --- a/meta/classes-recipe/dos2unix.bbclass +++ b/meta/classes-recipe/dos2unix.bbclass @@ -10,11 +10,13 @@ # on Linux(LF), which can cause annoying patching errors during # git push/checkout processes. -do_convert_crlf_to_lf[depends] += "dos2unix-native:do_populate_sysroot" +DEPENDS += "dos2unix-native" # Convert CRLF line terminators to LF -do_convert_crlf_to_lf () { +convert_crlf_to_lf () { find ${S} -type f -exec dos2unix {} \; } -addtask convert_crlf_to_lf after do_unpack before do_patch +python do_patch:prepend() { + bb.build.exec_func('convert_crlf_to_lf', d) +} diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index df271feddd..4404f0c032 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass @@ -507,9 +507,6 @@ python do_unpack_and_patch() { src_orig = '%s.orig' % src oe.path.copytree(src, src_orig) - if bb.data.inherits_class('dos2unix', d): - bb.build.exec_func('do_convert_crlf_to_lf', d) - # Make sure gcc and kernel sources are patched only once if not (d.getVar('SRC_URI') == "" or is_work_shared(d)): bb.build.exec_func('do_patch', d)
While SPDX_INCLUDE_SOURCES = "1", call do_patch in do_create_spdx failed for these recipes inherit dos2unix Prepend function do_convert_crlf_to_lf to task do_patch to assure always run before do_patch Add dos2unix-native to DEPENDS to assure the existence of command dos2unix before do_convert_crlf_to_lf is executed in any task Also remove extra do_convert_crlf_to_lf in archiver.bbclass which is not necessary any more Suggested-by Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- Changed in v2: Do not call bb.build.exec_func to run do_convert_crlf_to_lf in classes/spdx-common, preprend it to task do_patch to assure always run before do_patch meta/classes-recipe/dos2unix.bbclass | 8 +++++--- meta/classes/archiver.bbclass | 3 --- 2 files changed, 5 insertions(+), 6 deletions(-)