diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-17 16:35:32 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-27 21:03:20 +0000 |
commit | 4dd8a0d6d6c9f9691e25c2ea8c4fc86435a8e864 (patch) | |
tree | 8a522f8f8147bc3d20a8647fab26fc6550e0de78 /bitbake | |
parent | 633db4f0ff77fdeec0ba88794686083f2fc283dd (diff) | |
download | poky-4dd8a0d6d6c9f9691e25c2ea8c4fc86435a8e864.tar.gz |
bitbake: user-manual-metadata: Reorder sections to more logical order
(Bitbake rev: 6f2bed62bde5cd20f91c336b158f60f4a6bcb82f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/doc/user-manual/user-manual-metadata.xml | 187 |
1 files changed, 95 insertions, 92 deletions
diff --git a/bitbake/doc/user-manual/user-manual-metadata.xml b/bitbake/doc/user-manual/user-manual-metadata.xml index 10014929b9..efbbfb469e 100644 --- a/bitbake/doc/user-manual/user-manual-metadata.xml +++ b/bitbake/doc/user-manual/user-manual-metadata.xml | |||
@@ -101,6 +101,19 @@ yourself.</para> | |||
101 | <para>In this example, <varname>FOO</varname> is now <literal>789 123456</literal>.</para> | 101 | <para>In this example, <varname>FOO</varname> is now <literal>789 123456</literal>.</para> |
102 | </section> | 102 | </section> |
103 | 103 | ||
104 | <section id='variable-flags'> | ||
105 | <title>Variable flags</title> | ||
106 | <para>Variables can have associated flags which provide a way of tagging extra information onto a variable. Several flags are used internally by BitBake but they can be used externally too if needed. The standard operations mentioned above also work on flags.</para> | ||
107 | <para><screen><varname>VARIABLE</varname>[<varname>SOMEFLAG</varname>] = "value"</screen></para> | ||
108 | <para>In this example, <varname>VARIABLE</varname> has a flag, <varname>SOMEFLAG</varname> which is set to <literal>value</literal>.</para> | ||
109 | </section> | ||
110 | |||
111 | <section id='inline-python-variable-expansion'> | ||
112 | <title>Python variable expansion</title> | ||
113 | <para><screen><varname>DATE</varname> = "${@time.strftime('%Y%m%d',time.gmtime())}"</screen></para> | ||
114 | <para>This would result in the <varname>DATE</varname> variable containing today's date.</para> | ||
115 | </section> | ||
116 | |||
104 | <section id='conditional-syntax-overrides'> | 117 | <section id='conditional-syntax-overrides'> |
105 | <title>Conditional metadata set</title> | 118 | <title>Conditional metadata set</title> |
106 | <para>OVERRIDES is a <quote>:</quote> separated variable containing each item you want to satisfy conditions. So, if you have a variable which is conditional on <quote>arm</quote>, and <quote>arm</quote> is in OVERRIDES, then the <quote>arm</quote> specific version of the variable is used rather than the non-conditional version. Example:</para> | 119 | <para>OVERRIDES is a <quote>:</quote> separated variable containing each item you want to satisfy conditions. So, if you have a variable which is conditional on <quote>arm</quote>, and <quote>arm</quote> is in OVERRIDES, then the <quote>arm</quote> specific version of the variable is used rather than the non-conditional version. Example:</para> |
@@ -120,6 +133,56 @@ yourself.</para> | |||
120 | <para>In this example, <varname>DEPENDS</varname> is set to <literal>glibc ncurses libmad</literal>.</para> | 133 | <para>In this example, <varname>DEPENDS</varname> is set to <literal>glibc ncurses libmad</literal>.</para> |
121 | </section> | 134 | </section> |
122 | 135 | ||
136 | <section id='variable-interaction-worked-examples'> | ||
137 | <title>Variable interaction: Worked Examples</title> | ||
138 | <para>Despite the documentation of the different forms of variable definition above, it can be hard to work out what happens when variable operators are combined. This section documents some common questions people have regarding the way variables interact.</para> | ||
139 | |||
140 | <para>There is often confusion about which order overrides and the various append operators take effect.</para> | ||
141 | |||
142 | <para><screen><varname>OVERRIDES</varname> = "foo" | ||
143 | <varname>A_foo_append</varname> = "X"</screen></para> | ||
144 | <para>In this case, X is unconditionally appended to the variable <varname>A_foo</varname>. Since foo is an override, A_foo would then replace <varname>A</varname>.</para> | ||
145 | |||
146 | <para><screen><varname>OVERRIDES</varname> = "foo" | ||
147 | <varname>A</varname> = "X" | ||
148 | <varname>A_append_foo</varname> = "Y"</screen></para> | ||
149 | <para>In this case, only when foo is in OVERRIDES, Y is appended to the variable <varname>A</varname> so the value of <varname>A</varname> would become XY (NB: no spaces are appended).</para> | ||
150 | |||
151 | <para><screen><varname>OVERRIDES</varname> = "foo" | ||
152 | <varname>A_foo_append</varname> = "X" | ||
153 | <varname>A_foo_append</varname> += "Y"</screen></para> | ||
154 | <para>This behaves as per the first case above, but the value of <varname>A</varname> would be "X Y" instead of just "X".</para> | ||
155 | |||
156 | <para><screen><varname>A</varname> = "1" | ||
157 | <varname>A_append</varname> = "2" | ||
158 | <varname>A_append</varname> = "3" | ||
159 | <varname>A</varname> += "4" | ||
160 | <varname>A</varname> .= "5"</screen></para> | ||
161 | |||
162 | <para>Would ultimately result in <varname>A</varname> taking the value "1 4523" since the _append operator executes at the same time as the expansion of other overrides.</para> | ||
163 | |||
164 | </section> | ||
165 | <section id='key-expansion'> | ||
166 | <title>Key Expansion</title> | ||
167 | |||
168 | <para>Key expansion happens at the data store finalisation time just before overrides are expanded.</para> | ||
169 | |||
170 | <para><screen><varname>A${B}</varname> = "X" | ||
171 | <varname>B</varname> = "2" | ||
172 | <varname>A2</varname> = "Y"</screen></para> | ||
173 | <para>So in this case <varname>A2</varname> would take the value of "X".</para> | ||
174 | </section> | ||
175 | </section> | ||
176 | |||
177 | <section id='inheritance'> | ||
178 | <title>Inheritance</title> | ||
179 | |||
180 | <section id='inheritance-directive'> | ||
181 | <title>Inheritance</title> | ||
182 | <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para> | ||
183 | <para>The <literal>inherit</literal> directive is a means of specifying what classes of functionality your .bb requires. It is a rudimentary form of inheritance. For example, you can easily abstract out the tasks involved in building a package that uses autoconf and automake, and put that into a bbclass for your packages to make use of. A given bbclass is located by searching for classes/filename.bbclass in <envar>BBPATH</envar>, where filename is what you inherited.</para> | ||
184 | </section> | ||
185 | |||
123 | <section id='inclusion-directive'> | 186 | <section id='inclusion-directive'> |
124 | <title>Inclusion</title> | 187 | <title>Inclusion</title> |
125 | <para>Next, there is the <literal>include</literal> directive, which causes BitBake to parse whatever file you specify, and insert it at that location, which is not unlike <command>make</command>. However, if the path specified on the <literal>include</literal> line is a relative path, BitBake will locate the first one it can find within <envar>BBPATH</envar>.</para> | 188 | <para>Next, there is the <literal>include</literal> directive, which causes BitBake to parse whatever file you specify, and insert it at that location, which is not unlike <command>make</command>. However, if the path specified on the <literal>include</literal> line is a relative path, BitBake will locate the first one it can find within <envar>BBPATH</envar>.</para> |
@@ -131,25 +194,7 @@ raise an ParseError if the file to be included cannot be found. Otherwise it wil | |||
131 | include</literal> directive.</para> | 194 | include</literal> directive.</para> |
132 | </section> | 195 | </section> |
133 | 196 | ||
134 | <section id='inline-python-variable-expansion'> | 197 | </section> |
135 | <title>Python variable expansion</title> | ||
136 | <para><screen><varname>DATE</varname> = "${@time.strftime('%Y%m%d',time.gmtime())}"</screen></para> | ||
137 | <para>This would result in the <varname>DATE</varname> variable containing today's date.</para> | ||
138 | </section> | ||
139 | |||
140 | <section> | ||
141 | <title>Defining executable metadata</title> | ||
142 | <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para> | ||
143 | <para><screen>do_mytask () { | ||
144 | echo "Hello, world!" | ||
145 | }</screen></para> | ||
146 | <para>This is essentially identical to setting a variable, except that this variable happens to be executable shell code.</para> | ||
147 | <para><screen>python do_printdate () { | ||
148 | import time | ||
149 | print time.strftime('%Y%m%d', time.gmtime()) | ||
150 | }</screen></para> | ||
151 | <para>This is the similar to the previous, but flags it as Python so that BitBake knows it is Python code.</para> | ||
152 | </section> | ||
153 | 198 | ||
154 | <section id='defining-python-functions-into-the-global-python-namespace'> | 199 | <section id='defining-python-functions-into-the-global-python-namespace'> |
155 | <title>Defining Python functions into the global Python namespace</title> | 200 | <title>Defining Python functions into the global Python namespace</title> |
@@ -165,16 +210,18 @@ include</literal> directive.</para> | |||
165 | <para>This would result in <varname>DEPENDS</varname> containing <literal>dependencywithcond</literal>.</para> | 210 | <para>This would result in <varname>DEPENDS</varname> containing <literal>dependencywithcond</literal>.</para> |
166 | </section> | 211 | </section> |
167 | 212 | ||
168 | <section id='variable-flags'> | 213 | <section> |
169 | <title>Variable flags</title> | 214 | <title>Defining executable metadata</title> |
170 | <para>Variables can have associated flags which provide a way of tagging extra information onto a variable. Several flags are used internally by BitBake but they can be used externally too if needed. The standard operations mentioned above also work on flags.</para> | ||
171 | <para><screen><varname>VARIABLE</varname>[<varname>SOMEFLAG</varname>] = "value"</screen></para> | ||
172 | <para>In this example, <varname>VARIABLE</varname> has a flag, <varname>SOMEFLAG</varname> which is set to <literal>value</literal>.</para> | ||
173 | </section> | ||
174 | <section id='inheritance-directive'> | ||
175 | <title>Inheritance</title> | ||
176 | <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para> | 215 | <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para> |
177 | <para>The <literal>inherit</literal> directive is a means of specifying what classes of functionality your .bb requires. It is a rudimentary form of inheritance. For example, you can easily abstract out the tasks involved in building a package that uses autoconf and automake, and put that into a bbclass for your packages to make use of. A given bbclass is located by searching for classes/filename.bbclass in <envar>BBPATH</envar>, where filename is what you inherited.</para> | 216 | <para><screen>do_mytask () { |
217 | echo "Hello, world!" | ||
218 | }</screen></para> | ||
219 | <para>This is essentially identical to setting a variable, except that this variable happens to be executable shell code.</para> | ||
220 | <para><screen>python do_printdate () { | ||
221 | import time | ||
222 | print time.strftime('%Y%m%d', time.gmtime()) | ||
223 | }</screen></para> | ||
224 | <para>This is the similar to the previous, but flags it as Python so that BitBake knows it is Python code.</para> | ||
178 | </section> | 225 | </section> |
179 | 226 | ||
180 | <section> | 227 | <section> |
@@ -202,6 +249,25 @@ addtask printdate before do_build</screen></para> | |||
202 | <para> For the 'deptask', 'rdeptask', 'depends', 'rdepends' and 'recrdeptask' flags please see the dependencies section.</para> | 249 | <para> For the 'deptask', 'rdeptask', 'depends', 'rdepends' and 'recrdeptask' flags please see the dependencies section.</para> |
203 | </section> | 250 | </section> |
204 | 251 | ||
252 | <section id='parsing-overview'> | ||
253 | <title>Parsing</title> | ||
254 | <section id='configiguration-files'> | ||
255 | <title>Configuration files</title> | ||
256 | <para>The first kind of metadata in BitBake is configuration metadata. This metadata is global, and therefore affects <emphasis>all</emphasis> packages and tasks which are executed.</para> | ||
257 | <para>BitBake will first search the current working directory for an optional "conf/bblayers.conf" configuration file. This file is expected to contain a BBLAYERS variable which is a space delimited list of 'layer' directories. For each directory in this list, a "conf/layer.conf" file will be searched for and parsed with the LAYERDIR variable being set to the directory where the layer was found. The idea is these files will setup BBPATH and other variables correctly for a given build directory automatically for the user.</para> | ||
258 | <para>BitBake will then expect to find 'conf/bitbake.conf' somewhere in the user specified <envar>BBPATH</envar>. That configuration file generally has include directives to pull in any other metadata (generally files specific to architecture, machine, <emphasis>local</emphasis> and so on).</para> | ||
259 | <para>Only variable definitions and include directives are allowed in .conf files.</para> | ||
260 | </section> | ||
261 | <section id='classes'> | ||
262 | <title>Classes</title> | ||
263 | <para>BitBake classes are our rudimentary inheritance mechanism. As briefly mentioned in the metadata introduction, they're parsed when an <literal>inherit</literal> directive is encountered, and they are located in classes/ relative to the directories in <envar>BBPATH</envar>.</para> | ||
264 | </section> | ||
265 | <section id='bb-files'> | ||
266 | <title>.bb files</title> | ||
267 | <para>A BitBake (.bb) file is a logical unit of tasks to be executed. Normally this is a package to be built. Inter-.bb dependencies are obeyed. The files themselves are located via the <varname>BBFILES</varname> variable, which is set to a space separated list of .bb files, and does handle wildcards.</para> | ||
268 | </section> | ||
269 | </section> | ||
270 | |||
205 | <section id='events'> | 271 | <section id='events'> |
206 | <title>Events</title> | 272 | <title>Events</title> |
207 | <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para> | 273 | <para><emphasis>NOTE:</emphasis> This is only supported in .bb and .bbclass files.</para> |
@@ -232,53 +298,7 @@ SRC_URI_git = "git://someurl/somepath.git"</screen></para> | |||
232 | SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;patch=1"</screen></para> | 298 | SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;patch=1"</screen></para> |
233 | <para>Note that the name of the range will default to the original version of the recipe, so given OE, a recipe file of foo_1.0.0+.bb will default the name of its versions to 1.0.0+. This is useful, as the range name is not only placed into overrides; it's also made available for the metadata to use in the form of the <varname>BPV</varname> variable, for use in file:// search paths (<varname>FILESPATH</varname>).</para> | 299 | <para>Note that the name of the range will default to the original version of the recipe, so given OE, a recipe file of foo_1.0.0+.bb will default the name of its versions to 1.0.0+. This is useful, as the range name is not only placed into overrides; it's also made available for the metadata to use in the form of the <varname>BPV</varname> variable, for use in file:// search paths (<varname>FILESPATH</varname>).</para> |
234 | </section> | 300 | </section> |
235 | </section> | ||
236 | 301 | ||
237 | <section id='variable-interaction-worked-examples'> | ||
238 | <title>Variable interaction: Worked Examples</title> | ||
239 | <para>Despite the documentation of the different forms of variable definition above, it can be hard to work out what happens when variable operators are combined. This section documents some common questions people have regarding the way variables interact.</para> | ||
240 | |||
241 | <section> | ||
242 | <title>Override and append ordering</title> | ||
243 | |||
244 | <para>There is often confusion about which order overrides and the various append operators take effect.</para> | ||
245 | |||
246 | <para><screen><varname>OVERRIDES</varname> = "foo" | ||
247 | <varname>A_foo_append</varname> = "X"</screen></para> | ||
248 | <para>In this case, X is unconditionally appended to the variable <varname>A_foo</varname>. Since foo is an override, A_foo would then replace <varname>A</varname>.</para> | ||
249 | |||
250 | <para><screen><varname>OVERRIDES</varname> = "foo" | ||
251 | <varname>A</varname> = "X" | ||
252 | <varname>A_append_foo</varname> = "Y"</screen></para> | ||
253 | <para>In this case, only when foo is in OVERRIDES, Y is appended to the variable <varname>A</varname> so the value of <varname>A</varname> would become XY (NB: no spaces are appended).</para> | ||
254 | |||
255 | <para><screen><varname>OVERRIDES</varname> = "foo" | ||
256 | <varname>A_foo_append</varname> = "X" | ||
257 | <varname>A_foo_append</varname> += "Y"</screen></para> | ||
258 | <para>This behaves as per the first case above, but the value of <varname>A</varname> would be "X Y" instead of just "X".</para> | ||
259 | |||
260 | <para><screen><varname>A</varname> = "1" | ||
261 | <varname>A_append</varname> = "2" | ||
262 | <varname>A_append</varname> = "3" | ||
263 | <varname>A</varname> += "4" | ||
264 | <varname>A</varname> .= "5"</screen></para> | ||
265 | |||
266 | <para>Would ultimately result in <varname>A</varname> taking the value "1 4523" since the _append operator executes at the same time as the expansion of other overrides.</para> | ||
267 | |||
268 | </section> | ||
269 | |||
270 | <section id='key-expansion'> | ||
271 | <title>Key Expansion</title> | ||
272 | |||
273 | <para>Key expansion happens at the data store finalisation time just before overrides are expanded.</para> | ||
274 | |||
275 | <para><screen><varname>A${B}</varname> = "X" | ||
276 | <varname>B</varname> = "2" | ||
277 | <varname>A2</varname> = "Y"</screen></para> | ||
278 | <para>So in this case <varname>A2</varname> would take the value of "X".</para> | ||
279 | </section> | ||
280 | |||
281 | </section> | ||
282 | <section id='dependencies'> | 302 | <section id='dependencies'> |
283 | <title>Dependency handling</title> | 303 | <title>Dependency handling</title> |
284 | <para>BitBake handles dependencies at the task level since to allow for efficient operation with multiple processed executing in parallel. A robust method of specifying task dependencies is therefore needed. </para> | 304 | <para>BitBake handles dependencies at the task level since to allow for efficient operation with multiple processed executing in parallel. A robust method of specifying task dependencies is therefore needed. </para> |
@@ -316,22 +336,5 @@ SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;pat | |||
316 | </section> | 336 | </section> |
317 | </section> | 337 | </section> |
318 | 338 | ||
319 | <section id='parsing-overview'> | 339 | |
320 | <title>Parsing</title> | ||
321 | <section id='configiguration-files'> | ||
322 | <title>Configuration files</title> | ||
323 | <para>The first kind of metadata in BitBake is configuration metadata. This metadata is global, and therefore affects <emphasis>all</emphasis> packages and tasks which are executed.</para> | ||
324 | <para>BitBake will first search the current working directory for an optional "conf/bblayers.conf" configuration file. This file is expected to contain a BBLAYERS variable which is a space delimited list of 'layer' directories. For each directory in this list, a "conf/layer.conf" file will be searched for and parsed with the LAYERDIR variable being set to the directory where the layer was found. The idea is these files will setup BBPATH and other variables correctly for a given build directory automatically for the user.</para> | ||
325 | <para>BitBake will then expect to find 'conf/bitbake.conf' somewhere in the user specified <envar>BBPATH</envar>. That configuration file generally has include directives to pull in any other metadata (generally files specific to architecture, machine, <emphasis>local</emphasis> and so on).</para> | ||
326 | <para>Only variable definitions and include directives are allowed in .conf files.</para> | ||
327 | </section> | ||
328 | <section id='classes'> | ||
329 | <title>Classes</title> | ||
330 | <para>BitBake classes are our rudimentary inheritance mechanism. As briefly mentioned in the metadata introduction, they're parsed when an <literal>inherit</literal> directive is encountered, and they are located in classes/ relative to the directories in <envar>BBPATH</envar>.</para> | ||
331 | </section> | ||
332 | <section id='bb-files'> | ||
333 | <title>.bb files</title> | ||
334 | <para>A BitBake (.bb) file is a logical unit of tasks to be executed. Normally this is a package to be built. Inter-.bb dependencies are obeyed. The files themselves are located via the <varname>BBFILES</varname> variable, which is set to a space separated list of .bb files, and does handle wildcards.</para> | ||
335 | </section> | ||
336 | </section> | ||
337 | </chapter> | 340 | </chapter> |