coding style: hardcoding package names instead of using PN/BPN/etc
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?
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?
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 7 lines · Robert P. J. Day
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?
yes however if you have mutating recipes into native and nativesdk and you only want this to be effective for target recipe only then above would be ok
is there a coding style preference that users
Quoted 3 lines
should be *encouraged* to use? is there a general coding style guide anywhere?
Quoted 4 lines · 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.
Quoted 13 lines
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"
Quoted 4 lines
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
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre