All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch a package with condition
@ 2019-09-13  5:55 PRASANTH R
  2019-09-13 15:37 ` Ross Burton
  2019-09-13 16:38 ` [EXTERNAL] " Smith, Virgil (US)
  0 siblings, 2 replies; 4+ messages in thread
From: PRASANTH R @ 2019-09-13  5:55 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 651 bytes --]

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,

[-- Attachment #2: Type: text/html, Size: 4043 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch a package with condition
  2019-09-13  5:55 Patch a package with condition PRASANTH R
@ 2019-09-13 15:37 ` Ross Burton
  2019-09-13 16:38 ` [EXTERNAL] " Smith, Virgil (US)
  1 sibling, 0 replies; 4+ messages in thread
From: Ross Burton @ 2019-09-13 15:37 UTC (permalink / raw)
  To: yocto

On 13/09/2019 06:55, PRASANTH R wrote:
> 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?

You can't patch a recipe depending on whether another recipe is going to 
be built, because the process is that recipes produce packages, and 
packages built images.

So you're building two images, one of which contains Package-A and the 
other contains Package-A and Package-B.  Bitbake will only build those 
recipes once.

Ross


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [EXTERNAL] Patch a package with condition
  2019-09-13  5:55 Patch a package with condition PRASANTH R
  2019-09-13 15:37 ` Ross Burton
@ 2019-09-13 16:38 ` Smith, Virgil (US)
  2019-09-13 16:45   ` Ross Burton
  1 sibling, 1 reply; 4+ messages in thread
From: Smith, Virgil (US) @ 2019-09-13 16:38 UTC (permalink / raw)
  To: PRASANTH R, yocto

[-- Attachment #1: Type: text/plain, Size: 2520 bytes --]

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-bounces@yoctoproject.org <yocto-bounces@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.

[-- Attachment #2: Type: text/html, Size: 10166 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [EXTERNAL] Patch a package with condition
  2019-09-13 16:38 ` [EXTERNAL] " Smith, Virgil (US)
@ 2019-09-13 16:45   ` Ross Burton
  0 siblings, 0 replies; 4+ messages in thread
From: Ross Burton @ 2019-09-13 16:45 UTC (permalink / raw)
  To: yocto

On 13/09/2019 17:38, Smith, Virgil (US) wrote:
> 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)}"

The huge caveat here is that typically it's images that set 
IMAGE_FEATURES, so this won't work in the general case.

Ross


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-13 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13  5:55 Patch a package with condition PRASANTH R
2019-09-13 15:37 ` Ross Burton
2019-09-13 16:38 ` [EXTERNAL] " Smith, Virgil (US)
2019-09-13 16:45   ` Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.