embedded linux - Conditional inclusion of patch file in recipe script -
i have recipe file , src_uri section looks follows:
src_uri += "file://file1.patch \ file://file2.patch \ file://file4.patch \ " i want include file5.patch under src_uri if environment variable set. there way insert if condition src_uri looks this:
src_uri += "file://file1.patch \ file://file2.patch \ file://file4.patch \ **if $environment_variable: file://file5.patch** " is there other way can achieve same thing?
well, short answer is: yes, can this, it's messy , there's better way(tm). let's answer question first. if want change behavior of recipe using environment variable, first challenge set environment variable, , let bitbake know new environment variable safe , allowable. when source oe-init-build-env script setup project or subsequently setup new shell continue working on project, sets env variable called bb_env_extrawhite. must include new env variable in list this:
$ export myenv_var=file5.patch $ export bb_env_extrawhite="$bb_env_extrawhite myenv_var" once done, bitbake won't scrub environment of new environment variable.
in recipe, use python snippet conditionally add patch follows:
src_uri += "${@os.getenv('myenv_var', '')}" as can see, it's bit messy. of course, little more complex , test value of variable in recipe, instead of putting name of patch file in environment variable, example simplest way demonstrate concept.
perhaps better way use override, , not rely on environment variables. if building bsp multiple variants, use bsp name override, this.
src_uri_append_mybsp = "file://file5.patch" this cleaner way accomplish same thing. of course, i'm speculating use case. yocto project reference manual explains overrides. 1 more suggestion, join #yocto or yocto project mailing list , have access many smart people you.
hope helps. ;)
Comments
Post a Comment