From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: BitBake developer list <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] Documentation: Add examples to User Manual, Metadata chapter
Date: Wed, 9 Jul 2014 08:03:58 -0400 (EDT) [thread overview]
Message-ID: <alpine.LFD.2.11.1407090802320.5937@localhost> (raw)
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
---
as long as i've understood everything correctly, this is just
throwing in some physical examples of a couple concepts.
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml b/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
index a9f5072..423d9a4 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
@@ -285,6 +285,16 @@
The flags are immediately set to "abc" and "123", respectively.
The <filename>a</filename> flag becomes "abc456".
</para>
+
+ <para>
+ Note that there is no need to pre-define variable flags; you
+ can simply start using them. One extremely common application
+ is to attach some brief documentation to a BitBake variable as
+ follows:
+ <literallayout class='monospaced'>
+ CACHE[doc] = "The directory holding the cache of the metadata."
+ </literallayout>
+ </para>
</section>
<section id='inline-python-variable-expansion'>
@@ -298,7 +308,19 @@
DATE = "${@time.strftime('%Y%m%d',time.gmtime())}"
</literallayout>
This example results in the <filename>DATE</filename>
- variable becoming the current date.
+ variable being set to the current date.
+ </para>
+
+ <para>
+ Probably the most common use of this feature is to extract
+ the value of variables from BitBake's internal data dictionary,
+ <filename>d</filename>. The following lines
+ select the values of, respectively, a package name and its
+ version number:
+ <literallayout class='monospaced'>
+ PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE'),d)[0] or 'defaultpkgname'}"
+ PV = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE'),d)[1] or '1.0'}"
+ </literallayout>
</para>
</section>
--
========================================================================
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:[~2014-07-09 12:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-09 12:03 Robert P. J. Day [this message]
2014-07-10 7:46 ` [PATCH] Documentation: Add examples to User Manual, Metadata chapter Rifenbark, Scott M
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.LFD.2.11.1407090802320.5937@localhost \
--to=rpjday@crashcourse.ca \
--cc=bitbake-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.