Bug 11289

Summary: search order for patches and files (FILESPATH)
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Robert Berger <pokylinux>
Component: coreAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: Medium CC: meta.mr.watcher, meta.watcher
Version: 2.2.1   
Target Milestone: 2.4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Robert Berger 2017-04-04 06:37:18 UTC
According to this [1] the FILESPATH variable contains the default set of directories the OpenEmbedded build system uses when searching for patches and files.

I was wondering what's the search order e.g. if the same .patch is present in 2 different directories.

bitbake -e busybox | grep ^FILESPATH=

To my surprise I saw (after some cleanup this):

FILESPATH="
busybox/busybox/poky:
busybox/busybox-1.24.1/poky:
busybox/busybox/poky:
busybox/files/poky:
busybox/busybox/multi-v7-ml:
busybox/busybox-1.24.1/multi-v7-ml:
busybox/busybox/multi-v7-ml:
busybox/files/multi-v7-ml:
busybox/busybox/armv7a:
busybox/busybox-1.24.1/armv7a:
busybox/busybox/armv7a:
busybox/files/armv7a:
busybox/busybox/arm:
busybox/busybox-1.24.1/arm:
busybox/busybox/arm:
busybox/files/arm:
busybox/busybox/:
busybox/busybox-1.24.1/:
busybox/busybox/:
busybox/files/
"

I assumed that the order in which the directories appear has to do with the preference, but various directories appear multiple times like busybox/busybox/poky:

busybox/busybox/poky: <--
busybox/busybox-1.24.1/poky:
busybox/busybox/poky: <--

What's the order of preference supposed to be if someone throws a patch with the same name in 2 different directories? 

[1] http://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-FILESPATHS
Comment 1 Richard Purdie 2017-04-14 09:33:23 UTC
I think the issue was with your cleanup. I tried this locally and got:

poky/meta-poky/recipes-core/busybox/busybox/poky
poky/meta/recipes-core/busybox/busybox-1.24.1/poky
poky/meta/recipes-core/busybox/busybox/poky
poky/meta/recipes-core/busybox/files/poky
poky/meta-poky/recipes-core/busybox/busybox/qemux86-64
poky/meta/recipes-core/busybox/busybox-1.24.1/qemux86-64
poky/meta/recipes-core/busybox/busybox/qemux86-64
poky/meta/recipes-core/busybox/files/qemux86-64
poky/meta-poky/recipes-core/busybox/busybox/qemuall
poky/meta/recipes-core/busybox/busybox-1.24.1/qemuall
poky/meta/recipes-core/busybox/busybox/qemuall
poky/meta/recipes-core/busybox/files/qemuall
poky/meta-poky/recipes-core/busybox/busybox/x86-64
poky/meta/recipes-core/busybox/busybox-1.24.1/x86-64
poky/meta/recipes-core/busybox/busybox/x86-64
poky/meta/recipes-core/busybox/files/x86-64
poky/meta-poky/recipes-core/busybox/busybox/
poky/meta/recipes-core/busybox/busybox-1.24.1/
poky/meta/recipes-core/busybox/busybox/
poky/meta/recipes-core/busybox/files/

where you can see one is in "meta-poky" whilst the other is in "meta". Also, this variable works like PATH, the first found wins. You can therefore put the same patch in each of these directories and it will use the first one found. Even if there were duplicates, the system would still then work.