An example of using FILES_${PN}

Yahia Farghaly picture Yahia Farghaly · Sep 6, 2017 · Viewed 19.7k times · Source

I have a trouble of understanding the FILES_${PN} even after I have read the manual. For example, I was working on this example of making startup script. After I wrote something similar to, I got these error messages.

ERROR: initscriptd-1.0-r0 do_package: QA Issue: initscriptd: Files/directories were installed but not shipped in any package:
  /usr
  /usr/sbin
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
initscriptd: 2 installed and not shipped files. [installed-vs-shipped]
ERROR: initscriptd-1.0-r0 do_package: Fatal QA errors found, failing task.
ERROR: initscriptd-1.0-r0 do_package: Function failed: do_package
ERROR: Logfile of failure stored in: /home/yahia/Desktop/elinux_dev/bake_factory/poky-pyro-17.0.1/build/tmp/work/core2-64-poky-linux/initscriptd/1.0-r0/temp/log.do_package.5252
ERROR: Task (/home/yahia/Desktop/elinux_dev/bake_factory/poky-pyro-17.0.1/meta-mylayer/recipes-core/mylayer-initscript/initscriptd.bb:do_package) failed with exit code '1'

And as I understood, that the files I provided with recipe to be installed on the Image is not packaged within a certain package so Yocto cannot know where to unpack them, am I correct?

So, I have added FILES_${PN} += " with all directory paths " which I install recipe files, then it worked fine.

So, could you explain to me why I need to do this? and when? a coherent example will be helpful if it is provided.

Answer

Jussi Kukkonen picture Jussi Kukkonen · Sep 6, 2017

A recipe can (and usually does) produce more than one package. The system isn't completely stupid so for example all the headers will automatically go into -dev package and all documentation goes into -doc, but often the recipe writer needs to make a decision on which package a specific file belongs to. This is done with the FILES_<packagename> += "/path/to/file" format.

The default values for FILES_* can be found in meta/conf/bitbake.conf but note that classes your recipe inherits may also modify the values: check the final values with bitbake -e <recipe>|grep ^FILES_

In your case it looks like your project build system created some directories but didn't put anything in them? if that is the case you could alternatively modify your build system to not do that or add a do_install_append() function that removes the empty directories after installing.