summaryrefslogtreecommitdiffstats
path: root/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
diff options
context:
space:
mode:
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.xml212
1 files changed, 120 insertions, 92 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 d4f73ae145..dcb1f1e3cf 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml
@@ -1228,7 +1228,7 @@
1228 </literallayout> 1228 </literallayout>
1229 For methods you can use with anonymous Python functions, 1229 For methods you can use with anonymous Python functions,
1230 see the 1230 see the
1231 "<link linkend='accessing-datastore-variables-using-python'>Accessing Datastore Variables Using Python</link>" 1231 "<link linkend='functions-you-can-call-from-within-python'>Functions You Can Call From Within Python</link>"
1232 section. 1232 section.
1233 For a different method to run Python code during parsing, 1233 For a different method to run Python code during parsing,
1234 see the 1234 see the
@@ -2082,102 +2082,130 @@
2082 </section> 2082 </section>
2083 </section> 2083 </section>
2084 2084
2085 <section id='accessing-datastore-variables-using-python'> 2085 <section id='functions-you-can-call-from-within-python'>
2086 <title>Accessing Datastore Variables Using Python</title> 2086 <title>Functions You Can Call From Within Python</title>
2087 2087
2088 <para> 2088 <para>
2089 It is often necessary to access variables in the 2089 BitBake provides many functions you can call from
2090 BitBake datastore using Python functions. 2090 within Python functions.
2091 The Bitbake datastore has an API that allows you this 2091 This section lists the most commonly used functions,
2092 access. 2092 and mentions where to find others.
2093 Here is a list of available operations:
2094 </para> 2093 </para>
2095 2094
2096 <para> 2095 <section id='functions-for-accessing-datastore-variables'>
2097 <informaltable frame='none'> 2096 <title>Functions for Accessing Datastore Variables</title>
2098 <tgroup cols='2' align='left' colsep='1' rowsep='1'> 2097
2099 <colspec colname='c1' colwidth='1*'/> 2098 <para>
2100 <colspec colname='c2' colwidth='1*'/> 2099 It is often necessary to access variables in the
2101 <thead> 2100 BitBake datastore using Python functions.
2102 <row> 2101 The Bitbake datastore has an API that allows you this
2103 <entry align="left"><emphasis>Operation</emphasis></entry> 2102 access.
2104 <entry align="left"><emphasis>Description</emphasis></entry> 2103 Here is a list of available operations:
2105 </row> 2104 </para>
2106 </thead> 2105
2107 <tbody> 2106 <para>
2108 <row> 2107 <informaltable frame='none'>
2109 <entry align="left"><filename>d.getVar("X", expand)</filename></entry> 2108 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
2110 <entry align="left">Returns the value of variable "X". 2109 <colspec colname='c1' colwidth='1*'/>
2111 Using "expand=True" expands the value.</entry> 2110 <colspec colname='c2' colwidth='1*'/>
2112 </row> 2111 <thead>
2113 <row> 2112 <row>
2114 <entry align="left"><filename>d.setVar("X", "value")</filename></entry> 2113 <entry align="left"><emphasis>Operation</emphasis></entry>
2115 <entry align="left">Sets the variable "X" to "value".</entry> 2114 <entry align="left"><emphasis>Description</emphasis></entry>
2116 </row> 2115 </row>
2117 <row> 2116 </thead>
2118 <entry align="left"><filename>d.appendVar("X", "value")</filename></entry> 2117 <tbody>
2119 <entry align="left">Adds "value" to the end of the variable "X".</entry> 2118 <row>
2120 </row> 2119 <entry align="left"><filename>d.getVar("X", expand)</filename></entry>
2121 <row> 2120 <entry align="left">Returns the value of variable "X".
2122 <entry align="left"><filename>d.prependVar("X", "value")</filename></entry>
2123 <entry align="left">Adds "value" to the start of the variable "X".</entry>
2124 </row>
2125 <row>
2126 <entry align="left"><filename>d.delVar("X")</filename></entry>
2127 <entry align="left">Deletes the variable "X" from the datastore.</entry>
2128 </row>
2129 <row>
2130 <entry align="left"><filename>d.renameVar("X", "Y")</filename></entry>
2131 <entry align="left">Renames the variable "X" to "Y".</entry>
2132 </row>
2133 <row>
2134 <entry align="left"><filename>d.getVarFlag("X", flag, expand)</filename></entry>
2135 <entry align="left">Returns the value of variable "X".
2136 Using "expand=True" expands the value.</entry> 2121 Using "expand=True" expands the value.</entry>
2137 </row> 2122 </row>
2138 <row> 2123 <row>
2139 <entry align="left"><filename>d.setVarFlag("X", flag, "value")</filename></entry> 2124 <entry align="left"><filename>d.setVar("X", "value")</filename></entry>
2140 <entry align="left">Sets the named flag for variable "X" to "value".</entry> 2125 <entry align="left">Sets the variable "X" to "value".</entry>
2141 </row> 2126 </row>
2142 <row> 2127 <row>
2143 <entry align="left"><filename>d.appendVarFlag("X", flag, "value")</filename></entry> 2128 <entry align="left"><filename>d.appendVar("X", "value")</filename></entry>
2144 <entry align="left">Appends "value" to the named flag on the 2129 <entry align="left">Adds "value" to the end of the variable "X".</entry>
2145 variable "X".</entry> 2130 </row>
2146 </row> 2131 <row>
2147 <row> 2132 <entry align="left"><filename>d.prependVar("X", "value")</filename></entry>
2148 <entry align="left"><filename>d.prependVarFlag("X", flag, "value")</filename></entry> 2133 <entry align="left">Adds "value" to the start of the variable "X".</entry>
2149 <entry align="left">Prepends "value" to the named flag on 2134 </row>
2150 the variable "X".</entry> 2135 <row>
2151 </row> 2136 <entry align="left"><filename>d.delVar("X")</filename></entry>
2152 <row> 2137 <entry align="left">Deletes the variable "X" from the datastore.</entry>
2153 <entry align="left"><filename>d.delVarFlag("X", flag)</filename></entry> 2138 </row>
2154 <entry align="left">Deletes the named flag on the variable 2139 <row>
2155 "X" from the datastore.</entry> 2140 <entry align="left"><filename>d.renameVar("X", "Y")</filename></entry>
2156 </row> 2141 <entry align="left">Renames the variable "X" to "Y".</entry>
2157 <row> 2142 </row>
2158 <entry align="left"><filename>d.setVarFlags("X", flagsdict)</filename></entry> 2143 <row>
2159 <entry align="left">Sets the flags specified in 2144 <entry align="left"><filename>d.getVarFlag("X", flag, expand)</filename></entry>
2160 the <filename>flagsdict()</filename> parameter. 2145 <entry align="left">Returns the value of variable "X".
2161 <filename>setVarFlags</filename> does not clear previous flags. 2146 Using "expand=True" expands the value.</entry>
2162 Think of this operation as <filename>addVarFlags</filename>.</entry> 2147 </row>
2163 </row> 2148 <row>
2164 <row> 2149 <entry align="left"><filename>d.setVarFlag("X", flag, "value")</filename></entry>
2165 <entry align="left"><filename>d.getVarFlags("X")</filename></entry> 2150 <entry align="left">Sets the named flag for variable "X" to "value".</entry>
2166 <entry align="left">Returns a <filename>flagsdict</filename> of the flags for 2151 </row>
2167 the variable "X".</entry> 2152 <row>
2168 </row> 2153 <entry align="left"><filename>d.appendVarFlag("X", flag, "value")</filename></entry>
2169 <row> 2154 <entry align="left">Appends "value" to the named flag on the
2170 <entry align="left"><filename>d.delVarFlags("X")</filename></entry> 2155 variable "X".</entry>
2171 <entry align="left">Deletes all the flags for the variable "X".</entry> 2156 </row>
2172 </row> 2157 <row>
2173 <row> 2158 <entry align="left"><filename>d.prependVarFlag("X", flag, "value")</filename></entry>
2174 <entry align="left"><filename>d.expand(expression)</filename></entry> 2159 <entry align="left">Prepends "value" to the named flag on
2175 <entry align="left">Expands variable references in the specified string expression.</entry> 2160 the variable "X".</entry>
2176 </row> 2161 </row>
2177 </tbody> 2162 <row>
2178 </tgroup> 2163 <entry align="left"><filename>d.delVarFlag("X", flag)</filename></entry>
2179 </informaltable> 2164 <entry align="left">Deletes the named flag on the variable
2180 </para> 2165 "X" from the datastore.</entry>
2166 </row>
2167 <row>
2168 <entry align="left"><filename>d.setVarFlags("X", flagsdict)</filename></entry>
2169 <entry align="left">Sets the flags specified in
2170 the <filename>flagsdict()</filename> parameter.
2171 <filename>setVarFlags</filename> does not clear previous flags.
2172 Think of this operation as <filename>addVarFlags</filename>.</entry>
2173 </row>
2174 <row>
2175 <entry align="left"><filename>d.getVarFlags("X")</filename></entry>
2176 <entry align="left">Returns a <filename>flagsdict</filename> of the flags for
2177 the variable "X".</entry>
2178 </row>
2179 <row>
2180 <entry align="left"><filename>d.delVarFlags("X")</filename></entry>
2181 <entry align="left">Deletes all the flags for the variable "X".</entry>
2182 </row>
2183 <row>
2184 <entry align="left"><filename>d.expand(expression)</filename></entry>
2185 <entry align="left">Expands variable references in the specified string expression.</entry>
2186 </row>
2187 </tbody>
2188 </tgroup>
2189 </informaltable>
2190 </para>
2191 </section>
2192
2193 <section id='other-functions'>
2194 <title>Other Functions</title>
2195
2196 <para>
2197 You can find many other functions that can be called
2198 from Python by looking at the source code of the
2199 <filename>bb</filename> module, which is in
2200 <filename>bitbake/lib/bb</filename>.
2201 For example,
2202 <filename>bitbake/lib/bb/utils.py</filename> includes
2203 the commonly used functions
2204 <filename>bb.utils.contains()</filename> and
2205 <filename>bb.utils.mkdirhier()</filename>, which come
2206 with docstrings.
2207 </para>
2208 </section>
2181 </section> 2209 </section>
2182 2210
2183 <section id='task-checksums-and-setscene'> 2211 <section id='task-checksums-and-setscene'>