While you cannot *enforce* a change for one package/in another recipe file 
based on whether another package is included in an image, you can have recipes 
(and their bbappends) respond to configuration settings.  Two such mechanisms 
are FEATURES and OVERRIDES.  In this particular case I would probably use 
EXTRA_IMAGE_FEATURES from local.conf (or maybe DISTRO_FEATURES or 
IMAGE_FEATURES directly if making a distro or an image recipe).

https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#usingpoky-extend-customimage-imagefeatures

https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-FEATURE_PACKAGES

In your example Package-B.bb do something like (needs testing, search the 
manual for similar snippets, …)
SRC_URI_append = "${@bb.utils.contains('IMAGE_FEATURES', 'myfeature', ' 
file://0001-add-new-line.patch', '', d)}"


Again this won’t ‘fix’ Package-A if someone just directly adds Package-B to 
IMAGE_INSTALL or otherwise directly or indirectly “does it the wrong way”, but 
you can create a “right way” for yourself/team.


Virgil Smith
FLIR Detection, Stillwater OK, 405.372.9535 x11158

From: yocto-boun...@yoctoproject.org <yocto-boun...@yoctoproject.org> On Behalf 
Of PRASANTH R
Sent: Friday, September 13, 2019 0:55
To: yocto@yoctoproject.org
Subject: [EXTERNAL] [yocto] Patch a package with condition

Hi,

I need to patch my custom recipe, let say "Package-A.bb" in which I need to add 
a patch to the test recipe if the yocto build has a specific package like let's 
say if "Package-B" is available patch should be applied for Package-A.bb
I am trying with below step in Package-A.bb
SRC_URI_append_Package-B = " file://0001-add-new-line.patch"

But it doesn't work, I could see this SRC_URI_append_* works only for some 
specific tokens like board name, Architecture, library or native-class as such

Have u come across the scenario to make a dependency in patching with reference 
to another package? which way I can use this?

Thanks,



________________________________

Notice to recipient: This email is meant for only the intended recipient of the 
transmission, and may be a communication privileged by law, subject to export 
control restrictions or that otherwise contains proprietary information. If you 
receive this email by mistake, please notify us immediately by replying to this 
message and then destroy it and do not review, disclose, copy or distribute it. 
Thank you in advance for your cooperation.
-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to