bitbake: user-manual-metadata.xml: Rewrite "Accessing Datastore Variables Using Python"

Rewrote this section.  Used a table instead of the funky list
that was there.  I still need to format it some.

Also fixed up the term "datastore".  It should not be "data store"

(Bitbake rev: ee23839596102ccd58e028c10471438f2eb37feb)

Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Scott Rifenbark
2014-02-10 20:25:53 -06:00
committed by Richard Purdie
parent 666a7b0924
commit 1d9c02e878

View File

@@ -369,7 +369,7 @@
<title>Key Expansion</title>
<para>
Key expansion happens when the BitBake data store is finalized
Key expansion happens when the BitBake datastore is finalized
just before BitBake expands overrides.
To better understand this, consider the following example:
<literallayout class='monospaced'>
@@ -1640,72 +1640,94 @@
</section>
</section>
<section id='accessing-variables-and-the-data-store-from-python'>
<title>Accessing Variables and the Data Store from Python</title>
<section id='accessing-datastore-variables-using-python'>
<title>Accessing Datastore Variables Using Python</title>
<para>
It is often necessary to manipulate variables within python functions
and the Bitbake data store has an API which allows this.
The operations available are:
<literallayout class='monospaced'>
d.getVar("X", expand=False)
</literallayout>
returns the value of variable "X", expanding the value
if specified.
<literallayout class='monospaced'>
d.setVar("X", value)
</literallayout>
sets the value of "X" to "value".
<literallayout class='monospaced'>
d.appendVar("X", value)
</literallayout>
adds "value" to the end of variable X.
<literallayout class='monospaced'>
d.prependVar("X", value)
</literallayout>
adds "value" to the start of variable X.
<literallayout class='monospaced'>
d.delVar("X")
</literallayout>
deletes the variable X from the data store.
<literallayout class='monospaced'>
d.renameVar("X", "Y")
</literallayout>
renames variable X to Y.
<literallayout class='monospaced'>
d.getVarFlag("X", flag, expand=False)
</literallayout>
gets given flag from variable X but does not expand it.
<literallayout class='monospaced'>
d.setVarFlag("X", flag, value)
</literallayout>
sets given flag for variable X to value.
<filename>setVarFlags</filename> will not clear previous flags.
Think of this method as <filename>addVarFlags</filename>.
<literallayout class='monospaced'>
d.appendVarFlag("X", flag, value)
</literallayout>
Need description.
<literallayout class='monospaced'>
d.prependVarFlag("X", flag, value)
</literallayout>
Need description.
<literallayout class='monospaced'>
d.delVarFlag("X", flag)
</literallayout>
Need description.
<literallayout class='monospaced'>
d.setVarFlags("X", flagsdict)
</literallayout>
sets the flags specified in the <filename>dict()</filename> parameter.
<literallayout class='monospaced'>
d.getVarFlags("X")
</literallayout>
returns a <filename>dict</filename> of the flags for X.
<literallayout class='monospaced'>
d.delVarFlags
</literallayout>
deletes all the flags for a variable.
It is often necessary to access variables in the
BitBake datastore using Python functions.
The Bitbake datastore has an API that allows you this
access.
Here is a list of available operations:
</para>
<para>
<informaltable frame='none'>
<tgroup cols='2' align='left' colsep='1' rowsep='1'>
<colspec colname='c1' colwidth='1*'/>
<colspec colname='c2' colwidth='1*'/>
<thead>
<row>
<entry align="left"><emphasis>Operation</emphasis></entry>
<entry align="left"><emphasis>Description</emphasis></entry>
</row>
</thead>
<tbody>
<row>
<entry align="left"><filename>d.getVar("X", expand=False)</filename></entry>
<entry align="left">Returns the value of variable "X".
Using "expand=True" expands the value.</entry>
</row>
<row>
<entry align="left"><filename>d.setVar("X", value)</filename></entry>
<entry align="left">Sets the variable "X" to "value".</entry>
</row>
<row>
<entry align="left"><filename>d.appendVar("X", value)</filename></entry>
<entry align="left">Adds "value" to the end of the variable "X".</entry>
</row>
<row>
<entry align="left"><filename>d.prependVar("X", value)</filename></entry>
<entry align="left">Adds "value" to the start of the variable "X".</entry>
</row>
<row>
<entry align="left"><filename>d.delVar("X")</filename></entry>
<entry align="left">Deletes the variable "X" from the datastore.</entry>
</row>
<row>
<entry align="left"><filename>d.renameVar("X", "Y")</filename></entry>
<entry align="left">Renames the variable "X" to "Y".</entry>
</row>
<row>
<entry align="left"><filename>d.getVarFlag("X", flag, expand=False)</filename></entry>
<entry align="left">Gets "flag" from the variable "X".
Using "expand=True" expands the flag.</entry>
</row>
<row>
<entry align="left"><filename>d.setVarFlag("X", flag, value)</filename></entry>
<entry align="left">Sets "flag" for variable "X" to "value".
<filename>setVarFlags</filename> does not clear previous flags.
Think of this operation as <filename>addVarFlags</filename>.</entry>
</row>
<row>
<entry align="left"><filename>d.appendVarFlag("X", flag, value)</filename></entry>
<entry align="left">Need description.</entry>
</row>
<row>
<entry align="left"><filename>d.prependVarFlag("X", flag, value)</filename></entry>
<entry align="left">Need description.</entry>
</row>
<row>
<entry align="left"><filename>d.delVarFlag("X", flag)</filename></entry>
<entry align="left">Need description.</entry>
</row>
<row>
<entry align="left"><filename>d.setVarFlags("X", flagsdict)</filename></entry>
<entry align="left">Sets the flags specified in
the <filename>dict()</filename> parameter.</entry>
</row>
<row>
<entry align="left"><filename>d.getVarFlags("X")</filename></entry>
<entry align="left">Returns a <filename>dict</filename> of the flags for
the variable "X".</entry>
</row>
<row>
<entry align="left"><filename>d.delVarFlags</filename></entry>
<entry align="left">Deletes all the flags for a variable.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</section>