[OE-core] confusion between += and =+ and _append and _prepend ...
Martin Jansa
martin.jansa at gmail.com
Sat Mar 24 10:36:34 UTC 2012
On Sat, Mar 24, 2012 at 04:34:40AM -0400, Robert P. J. Day wrote:
>
> when perusing the source for oe-core, it's going to be easy for a
> beginner to get confused about the right time(s) to use += versus =+
> versus _append versus _prepend because the source simply bounces
> around between them all arbitrarily.
>
> here's a single example. the file bitbake.conf defines the default
> for PACKAGES:
>
> PACKAGES = "${PN}-dbg ${PN}-staticdev ${PN} ${PN}-doc ${PN}-dev ${PN}-locale"
>
> now it would seem that, if a recipe wanted to extend that list (as
> many do), the obvious approach is to augment the list with more
> entries. and in the occasional situation where that default needs to
> be overridden, then a straight assignment can be used.
>
> but searching the source shows every possible combination of adding
> to the PACKAGES variable:
>
> ...
> meta/recipes-devtools/perl/perl_5.14.2.bb:PACKAGES_append = " perl-modules "
> meta/recipes-qt/qt4/qt-4.8.0.inc:PACKAGES_append = " ${QT_BASE_NAME}-tests-dbg ${QT_BASE_NAME}-tests"
> ...
> meta/recipes-connectivity/bind/bind_9.8.1.bb:PACKAGES_prepend = "${PN}-utils "
> meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-0.7.inc:PACKAGES_prepend = "wpa-supplicant-passphrase wpa-supplicant-cli "
> meta/recipes-extended/newt/libnewt_0.52.14.bb:PACKAGES_prepend = "whiptail "
> ...
>
> and there are, of course, many, many uses of "PACKAGES +=" and
> "PACKAGES =+". and, sure, they'll all work but the variety is
> definitely going to confuse someone trying to figure out best
> practices.
>
> and occasionally, there is a direct assignment when a simple
> appending would work fine, like with rpm:
>
> meta/recipes-devtools/rpm/rpm_5.4.0.bb:PACKAGES = "${PN}-dbg ${PN}
> ${PN}-doc ${PN}-libs ${PN}-dev ${PN}-staticdev ${PN}-common
> ${PN}-build python-rpm-dbg python-rpm-staticdev python-rpm
> perl-module-rpm perl-module-rpm-dev ${PN}-locale"
>
> i realize this is all annoyingly picky pedantry but there should be
> some sort of standard for things like this, just for consistency.
order of items in PACKAGES variable is important (FILES_foo) are picked
in PACKAGES order so it's different if foo is before bar or after (if
their FILES_ mask has some overlap).
So sometimes you have to prepend, sometimes append.
Cheers,
--
Martin 'JaMa' Jansa jabber: Martin.Jansa at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20120324/3466054a/attachment-0002.sig>
More information about the Openembedded-core
mailing list