Re: Possible to ignore a missing file in recipe without error?


Josef Holzmayr
 

Howdy!

On 11. Feb 2022, at 20:03, Howard <howard.egan@...> wrote:

Hi:

I have a simple recipe that installs a few miscellaneous files, one of the files may or may not be present and in reality that's ok for the moment, but I don't see a way to do things in a recipe based on the presence or absence of a file. 

The real question is: what is the condition? It must be something that is constant across all of the build. And if can only come from either a .conf file or the environment, otherwise it would not be visible in the recipe.


For example:

LICENSE="CLOSED"

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

# always present file
SRC_URI += "file://myconfig.config"

# sometimes present file - is there a way to conditionally do this statement
SRC_URI += "file://myOtherConfig.config"

A possible approach would be only appending depending on a specific DISTRO_FLAG, via bb.utils.contains. I have done something similar at https://github.com/TheYoctoJester/meta-zinc/blob/5c566c2f7d29d9db15db0c70cd3dd79fa755c351/recipes-zinc/libanswer/libanswer_git.bb#L26

But again, it depends on the exact use case.

Greetz


do_install() {
    install -d ${D}${sysconfdir}
    install -m 0755 ${WORKDIR}/myconfig.config ${D}${sysconfdir}
    #same here
    install -m 0755 ${WORKDIR}/myOtherConfig.config ${D}${sysconfdir}

}

FILES_${PN} += " ${sysconfdir}/myconfig.config "
#same here
FILES_${PN} += " ${sysconfdir}/myOtherConfig.config "


Many thanks
Howard




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