[OE-core] confusion between += and =+ and _append and _prepend ...

Robert P. J. Day rpjday at crashcourse.ca
Sat Mar 24 08:34:40 UTC 2012


  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.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================




More information about the Openembedded-core mailing list