Re: Best convention for FILES variable


Chuck Wolber
 

On Fri, Nov 20, 2020 at 6:49 PM <rustyhowell@...> 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
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..

--
"Perfection must be reached by degrees; she requires the slow hand of time." - Voltaire

Join yocto@lists.yoctoproject.org to automatically receive all group messages.