From 49627bbad387791053e50dde02b51a0f16fdc40e Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Thu, 10 Jul 2014 10:12:09 +0300 Subject: bitbake: bitbake-user-manual-metadata.xml: Adding some flag examples. As long as i've understood everything correctly, this is just throwing in some physical examples of a couple concepts. (Bitbake rev: a18cc69c2fef6484a6acd78ea008d1da71198e68) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- .../bitbake-user-manual-metadata.xml | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml index b8a77e1fa0..5e1a381fac 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml @@ -293,6 +293,17 @@ The flags are immediately set to "abc" and "123", respectively. The a flag becomes "abc456". + + + No need exists 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: + + CACHE[doc] = "The directory holding the cache of the metadata." + +
@@ -306,7 +317,19 @@ DATE = "${@time.strftime('%Y%m%d',time.gmtime())}" This example results in the DATE - variable becoming the current date. + variable being set to the current date. + + + + Probably the most common use of this feature is to extract + the value of variables from BitBake's internal data dictionary, + d. + The following lines select the values of a package name + and its version number, respectively: + + 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'}" +
-- cgit v1.2.3-54-g00ecf