From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: OE Core mailing list <openembedded-core@lists.openembedded.org>
Subject: some simple questions about assignment and appending
Date: Tue, 19 Jun 2012 12:28:22 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.2.02.1206191218210.929@oneiric> (raw)
i want to make absolutely sure i understand the mechanics of the
different types of assignment so i'm looking at this snippet from
core-image.bbclass:
... snip ...
PACKAGE_GROUP_qt4-pkgs = "task-core-qt-demos"
CORE_IMAGE_BASE_INSTALL = '\
task-core-boot \
task-base-extended \
\
${CORE_IMAGE_EXTRA_INSTALL} \
'
CORE_IMAGE_EXTRA_INSTALL ?= ""
IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
... snip ...
first, if you're assigning a fixed string (as in the first line
shown in the snippet above), i assume there is no functional
difference in using "=" versus ":=", correct?
next, is there any value in that null line in the assignment to
CORE_IMAGE_BASE_INSTALL?
next, is it technically necessary to conditionally do this?
CORE_IMAGE_EXTRA_INSTALL ?= ""
if that variable wasn't set, does it really need to be set to the
empty string?
finally, what are the evaluation mechanics of the "?=" operator? in
this line,
IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
is the right-hand side evaluated first? i ask since i find the
snippet above a bit confusing in that you need to follow backwards to
deduce what IMAGE_INSTALL is eventually set to. i would think this
would be easier to read:
CORE_IMAGE_BASE_INSTALL = '\
task-core-boot \
task-base-extended
IMAGE_INSTALL = "${CORE_IMAGE_BASE_INSTALL} ${CORE_IMAGE_EXTRA_INSTALL}"
in this rewriting, i can *immediately* see what values are used to
construct IMAGE_INSTALL. in the current code, it's nowhere near as
clear, and you have to backtrack to see how CORE_IMAGE_BASE_INSTALL is
assigned. or would that not be equivalent based on a misunderstanding
of how assignment works?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
next reply other threads:[~2012-06-19 16:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 16:28 Robert P. J. Day [this message]
2012-06-19 17:32 ` some simple questions about assignment and appending Paul Eggleton
2012-06-19 20:49 ` Robert P. J. Day
2012-06-22 1:21 ` Christopher Larson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1206191218210.929@oneiric \
--to=rpjday@crashcourse.ca \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox