Can not use wildcard in SRC_URI to apply patches #yocto


Hao Qian
 

Hi,

I'm trying to apply patches to source code of linux kernel.

With devtool (modify and finish commands), I could apply patches
sucessfully by specified each single patch with its file name, like:
===========================================
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI += "\
file://0001-xxx-xxx-xxx.patch \
file://0002-xxx-xxx-xxx.patch \
"
===========================================

However, if I change files' name into wildcard in SRC_URI like:
===========================================
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://*"
===========================================
or
===========================================
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://*.patch"
===========================================
or even create a "patches" folder under ${PN} and modify bb file like
===========================================
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://patches"
===========================================
patch files will not be applied either do_patch task or "devtool
modify" command.

I tried in the latest version (zeus) and earlier version (sumo), and
got the same proble,

Could anyone tell me how to apply patches by wildcard?

Thank you

Qian


Richard Purdie
 

On Sat, 2020-04-25 at 17:30 +0900, Hao Qian wrote:
However, if I change files' name into wildcard in SRC_URI like:
===========================================
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://*"
===========================================
[...]
Could anyone tell me how to apply patches by wildcard?
That isn't supported. Its hard to get determinism correct and the patch
ordering could also be problematic.

Cheers,

Richard


Hao Qian
 

Hi, Richard

Thanks for replying.

Yes, it makes sense why patches not be applied by using wildcard.

Just for confirmation, it looks like more than one person made it to
use wildcard for patching as below:
https://stackoverflow.com/questions/41266742/adding-multiple-patches-to-src-uri-in-a-recipe-yocto

As you said, wildcard is not supported for patches in SRC_URI.
So, do you mean the answers and replies in above issue of
stackoverflow are wrong?
Or did I miss something?

Regards,

Qian

On Sat, Apr 25, 2020 at 11:54 PM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:

On Sat, 2020-04-25 at 17:30 +0900, Hao Qian wrote:
However, if I change files' name into wildcard in SRC_URI like:
===========================================
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://*"
===========================================
[...]
Could anyone tell me how to apply patches by wildcard?
That isn't supported. Its hard to get determinism correct and the patch
ordering could also be problematic.

Cheers,

Richard


Richard Purdie
 

On Sun, 2020-04-26 at 08:24 +0900, Hao Qian wrote:
Hi, Richard

Thanks for replying.

Yes, it makes sense why patches not be applied by using wildcard.

Just for confirmation, it looks like more than one person made it to
use wildcard for patching as below:
https://stackoverflow.com/questions/41266742/adding-multiple-patches-to-src-uri-in-a-recipe-yocto

As you said, wildcard is not supported for patches in SRC_URI.
So, do you mean the answers and replies in above issue of
stackoverflow are wrong?
Or did I miss something?
The patch linked to from there:

https://patchwork.openembedded.org/patch/8443/

gives some clues about when it might happen to work:

"Wildcards in SRC_URI are not supported by oe-core and work only
when last (or first?) FILESPATH element points to the containing
directory"

So it sounds like it can work in some cases but isn't something we
really support or encourage. I'd also note that information is 9 years
old.

Cheers,

Richard


Hao Qian
 

On 2020/04/26 18:44, Richard Purdie wrote:
The patch linked to from there:

https://patchwork.openembedded.org/patch/8443/

gives some clues about when it might happen to work:

"Wildcards in SRC_URI are not supported by oe-core and work only
when last (or first?) FILESPATH element points to the containing
directory"

So it sounds like it can work in some cases but isn't something we
really support or encourage. I'd also note that information is 9 years
old.
Hi, Richard


OK, I understand that it was a special exception which worked with wildcard, and wildcard in SRC_URI is not supported officially.

Thank you for your answer, and it fixed my confusion.

Appreciate it.


Thanks and have a good day.


Qian