I recently started to work with Yocto and now trying to understand how exactly "global" variables of some recipe work. Till now I had a recipe as follows:
# my-recipe.bb
FILES_${PN} += "/lib/mypackage1/package1-shared-object.so"
do_install() {
install -d ${D}/lib/mypackage1/
install ${S}/mypackage1/* ${D}/lib/mypackage1/
}
RPROVIDES_${PN} += "package1-shared-object.so"
This works fine - i.e. - the package1-shared-object.so file was installed correctly within the /lib/mypackage1/package1-shared-object.so path of my image.
Now I need to install under the /lib folder some two more shared-objects of two additional packages, so eventually I will have:
/lib/mypackage1/package1-shared-object.so
/lib/mypackage2/package2-shared-object.so
/lib/mypackage3/package3-shared-object.so
The list of mypackages is given to my recipe via the variable MY_RECIPE_PACKAGES_LIST, i.e. - it is: MY_RECIPE_PACKAGES_LIST = "mypackage1 mypackage2 mypackage3"
So now my updated do_install task in my recipe is as follows:
# my-recipe.bb
do_install() {
// iterate over the list of packages and for each install the respective shared object in the desired location:
for package_name in ${MY_RECIPE_PACKAGES_LIST}; do
install -d ${D}/lib/${package_name}
# the shared-objectX is the only file under: ${S}/package_name/
cp ${S}/${package_name}/* ${D}/lib/${package_name}
done
}
The do_install task works fine (I look into the image folder of my-recipe and I see all 3 shared-object's in their desired location).
HOWEVER, when I run the recipe, I get the following error as part of the do_package task.
ERROR: my-recipe do_package: QA Issue: my-recipe: Files/directories were installed but not shipped in any package: /lib/mypackage1/package1-shared-object.so /lib/mypackage2/package2-shared-object.so /lib/mypackage3/package3-shared-object.so Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install. my-recipe: 3 installed and not shipped files. [installed-vs-shipped] ERROR: my-recipe do_package: Fatal QA errors found, failing task.
I looked at the this Q&A: How does the variable scope in BitBake works
and added the python myprefunc to my-recipe so it is now:
# my-recipe.bb
do_install() {
// iterate over the list of packages and for each install the respective shared object in the desired location:
for package_name in ${MY_RECIPE_PACKAGES_LIST}; do
install -d ${D}/lib/${package_name}
# the shared-objectX is the only file under: ${S}/${package_name}
install -d ${S}/${package_name}/* ${D}/lib/${package_name}
done
}
python myprefunc() {
# for I did it "manually, offcourse iterating here is a better approach.
files_pn = "/lib/mypackage1/package1-shared-object.so /lib/mypackage2/package2-shared-object.so /lib/mypackage3/package3-shared-object.so"
d.appendVar("FILES_${PN}", files_pn)
}
do_package[prefuncs] += "myprefunc"
BUT still I get the same error for the do_package task.
The questions are:
- How can I overcome it ("pass"/ complete successfully the
do_packagetask and the entire recipe)? - How do I define the
FILES_${PN}in my recipe (if at all) "outside" of any task? - What about the
RPROVIDES_${PN}- how it should be set and when (in which task)?