diff options
Diffstat (limited to 'bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml')
-rw-r--r-- | bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml | 25 |
1 files changed, 24 insertions, 1 deletions
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 @@ | |||
293 | The flags are immediately set to "abc" and "123", respectively. | 293 | The flags are immediately set to "abc" and "123", respectively. |
294 | The <filename>a</filename> flag becomes "abc456". | 294 | The <filename>a</filename> flag becomes "abc456". |
295 | </para> | 295 | </para> |
296 | |||
297 | <para> | ||
298 | No need exists to pre-define variable flags. | ||
299 | You can simply start using them. | ||
300 | One extremely common application | ||
301 | is to attach some brief documentation to a BitBake variable as | ||
302 | follows: | ||
303 | <literallayout class='monospaced'> | ||
304 | CACHE[doc] = "The directory holding the cache of the metadata." | ||
305 | </literallayout> | ||
306 | </para> | ||
296 | </section> | 307 | </section> |
297 | 308 | ||
298 | <section id='inline-python-variable-expansion'> | 309 | <section id='inline-python-variable-expansion'> |
@@ -306,7 +317,19 @@ | |||
306 | DATE = "${@time.strftime('%Y%m%d',time.gmtime())}" | 317 | DATE = "${@time.strftime('%Y%m%d',time.gmtime())}" |
307 | </literallayout> | 318 | </literallayout> |
308 | This example results in the <filename>DATE</filename> | 319 | This example results in the <filename>DATE</filename> |
309 | variable becoming the current date. | 320 | variable being set to the current date. |
321 | </para> | ||
322 | |||
323 | <para> | ||
324 | Probably the most common use of this feature is to extract | ||
325 | the value of variables from BitBake's internal data dictionary, | ||
326 | <filename>d</filename>. | ||
327 | The following lines select the values of a package name | ||
328 | and its version number, respectively: | ||
329 | <literallayout class='monospaced'> | ||
330 | PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE'),d)[0] or 'defaultpkgname'}" | ||
331 | PV = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE'),d)[1] or '1.0'}" | ||
332 | </literallayout> | ||
310 | </para> | 333 | </para> |
311 | </section> | 334 | </section> |
312 | 335 | ||