[yocto] coding style: hardcoding package names instead of using PN/BPN/etc
Paul Eggleton
paul.eggleton at linux.intel.com
Mon Nov 4 03:29:27 PST 2013
On Saturday 02 November 2013 05:14:10 Robert P. J. Day wrote:
> i figure the answer is obvious but i'll ask it anyway -- is it
> reasonable to encourage new developers to use the general packagename
> variables such as PN and BPN rather than hardcoding packagenames in
> their recipe files?
Generally yes, but see below.
> typically, you see things like this in recipe files:
>
> ALLOW_EMPTY_${PN} = "1"
> ALLOW_EMPTY_${PN}-staticdev = "1"
>
> and so on. but, occasionally, someone decides to (unnecessarily?)
> hardcode the package name, as in:
>
> gst-va-intel.bb:ALLOW_EMPTY_gst-va-intel = "1"
> gst-va-intel.bb:ALLOW_EMPTY_gst-va-intel-general = "1"
> gst-va-intel.bb:ALLOW_EMPTY_gst-va-intel-video = "1"
> gst-va-intel.bb:ALLOW_EMPTY_gst-va-intel-vaapi = "1"
>
> i'm *assuming* the above could have been written more concisely by
> using ${PN}, correct? is there a coding style preference that users
> should be *encouraged* to use? is there a general coding style guide
> anywhere?
Whatever you put here it really needs to match up with what goes into PACKAGES
- i.e. if you're putting explicit names in PACKAGES then use those here, if
using ${PN} then use that here. If they don't match up, you'll get odd things
happening if the recipe is renamed or when you use multilib / BBCLASSEXTEND.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
More information about the yocto
mailing list