Best convention for FILES variable
Hello,
I am relatively new to yocto, and I am working on several recipes at the moment and I'm wondering about using wildcards in my FILES_{PN} list. None of the packages have more than 5 or 6 files to package. They could easily be covered with two wildcard entries, but I wonder if there is benefit to listing each file explicitly. Thanks for the help. Example below:FILES_fooz = "\
*/fooz* \
*/*/fooz* \
" vsFILES_fooz = "\
/lib/foozlib.so \
/usr/lib/foozlib-2.so \
/usr/bin/fooz \
/bin/fooz \
/usr/share/fooz \
" Thanks
Quoted 14 lines · On Fri, Nov 20, 2020 at 6:49 PM <[email protected]> wrote:
Hello,
I am relatively new to yocto, and I am working on several recipes at the moment and I'm wondering about using wildcards in my FILES_{PN} list. None of the packages have more than 5 or 6 files to package. They could easily be covered with two wildcard entries, but I wonder if there is benefit to listing each file explicitly. Thanks for the help. Example below:FILES_fooz = "\ */fooz* \ */*/fooz* \"
vs
Quoted 9 lines
FILES_fooz = "\ /lib/foozlib.so \ /usr/lib/foozlib-2.so \ /usr/bin/fooz \ /bin/fooz \ /usr/share/fooz \"
Both will work, although you do run the risk of accidentally globbing files that you do not mean to include, but perhaps you know your recipes well enough that that is not a factor.
Personally, I find that being explicit makes a lot more sense for a few reasons:
- Stuff changes, and I _want_ a build error or warning to let me when it changes and someone forgot to update the recipe.
- The grep command is your friend. If you glob, you lose a lot of fidelity there.
- If you want to refactor a recipe into separate packages later, you probably need to do a lot of head scratching to pin down all of the files generated in the build.
And finally, I have adjusted to using the following pattern, and found that it has improved maintainability a great deal. It applies to DEPENDS and RDEPENDS as well. Yes, it is a bit tedious, but the benefits far outweigh the cost (IMHO).
FILES_fooz += " lib/foozlib.so"FILES_fooz += " /usr/lib/foozlib-2.so"FILES_fooz += " /usr/bin/fooz"FILES_fooz += " /bin/fooz"FILES_fooz += " /usr/share/fooz"
This pattern is invaluable when you start accumulating a lot of recipes. A recursive grep (grep -r) across a directory tree, will immediately tell you that (for example), /bin/fooz is file in the fooz package and it is referenced in the fooz_1.3.2.bb recipe.
..Ch:W..
Signature · 2 lines
*"Perfection must be reached by degrees; she requires the slow hand of time." - Voltaire*
On Sat, Nov 21, 2020 at 12:21 AM Chuck Wolber <[email protected]> wrote:
%< SNIP %<
Quoted 11 lines
And finally, I have adjusted to using the following pattern, and found that it has improved maintainability a great deal. It applies to DEPENDS and RDEPENDS as well. Yes, it is a bit tedious, but the benefits far outweigh the cost (IMHO).
FILES_fooz+= "lib/foozlib.so"FILES_fooz+= "/usr/lib/foozlib-2.so"FILES_fooz+= "/usr/bin/fooz"FILES_fooz+= "/bin/fooz"FILES_fooz+= "/usr/share/fooz"
Quoted 5 lines
This pattern is invaluable when you start accumulating a lot of recipes. A recursive grep (grep -r) across a directory tree, will immediately tell you that (for example),
/bin/foozis file in the fooz package and it is referenced in the fooz_1.3.2.bb recipe.
I forgot one other benefit. When a change is made to a recipe that uses that pattern, the (Git) commit diff is a lot clearer and easier to understand.
Think of it this way... Use your pattern, but imagine there are a lot more entries in your list. A change to the middle of that list is going to result in a diff that is hard to determine if it is a FILE_fooz entry or a DEPENDS_${PN} entry. Prefixing with the directive keeps your Git history a lot clearer.
..Ch:W..
Signature · 2 lines
*"Perfection must be reached by degrees; she requires the slow hand of time." - Voltaire*
Quoted 11 lines · Chuck Wolber
On Sat, Nov 21, 2020 at 12:21 AM Chuck Wolber <[email protected]> wrote:
%< SNIP %<
And finally, I have adjusted to using the following pattern, and found that it has improved maintainability a great deal. It applies to DEPENDS and RDEPENDS as well. Yes, it is a bit tedious, but the benefits far outweigh the cost (IMHO).
Quoted 5 lines
FILES_fooz+= "lib/foozlib.so"FILES_fooz+= "/usr/lib/foozlib-2.so"FILES_fooz+= "/usr/bin/fooz"FILES_fooz+= "/bin/fooz"FILES_fooz+= "/usr/share/fooz"
pedantically speaking, since you're using "+=", you don't need those
leading spaces.
rday
On Sat, Nov 21, 2020 at 7:48 AM Robert P. J. Day <[email protected]> wrote:
%< SNIP %<
Quoted 3 lines
pedantically speaking, since you're using "+=", you don't need those
leading spaces.
Indeed you are correct. I believe I mistakenly conflated that particular aspect of "_append" with "+=".
Thank you for pointing this out.
..Ch:W..
Signature · 2 lines
*"Perfection must be reached by degrees; she requires the slow hand of time." - Voltaire*