From 4dd8a0d6d6c9f9691e25c2ea8c4fc86435a8e864 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 17 Jan 2014 16:35:32 +0000 Subject: bitbake: user-manual-metadata: Reorder sections to more logical order (Bitbake rev: 6f2bed62bde5cd20f91c336b158f60f4a6bcb82f) Signed-off-by: Richard Purdie --- bitbake/doc/user-manual/user-manual-metadata.xml | 187 ++++++++++++----------- 1 file changed, 95 insertions(+), 92 deletions(-) (limited to 'bitbake') 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. In this example, FOO is now 789 123456. +
+ Variable flags + 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. + VARIABLE[SOMEFLAG] = "value" + In this example, VARIABLE has a flag, SOMEFLAG which is set to value. +
+ +
+ Python variable expansion + DATE = "${@time.strftime('%Y%m%d',time.gmtime())}" + This would result in the DATE variable containing today's date. +
+
Conditional metadata set OVERRIDES is a : separated variable containing each item you want to satisfy conditions. So, if you have a variable which is conditional on arm, and arm is in OVERRIDES, then the arm specific version of the variable is used rather than the non-conditional version. Example: @@ -120,6 +133,56 @@ yourself. In this example, DEPENDS is set to glibc ncurses libmad.
+
+ Variable interaction: Worked Examples + 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. + + There is often confusion about which order overrides and the various append operators take effect. + + OVERRIDES = "foo" +A_foo_append = "X" + In this case, X is unconditionally appended to the variable A_foo. Since foo is an override, A_foo would then replace A. + + OVERRIDES = "foo" +A = "X" +A_append_foo = "Y" + In this case, only when foo is in OVERRIDES, Y is appended to the variable A so the value of A would become XY (NB: no spaces are appended). + + OVERRIDES = "foo" +A_foo_append = "X" +A_foo_append += "Y" + This behaves as per the first case above, but the value of A would be "X Y" instead of just "X". + + A = "1" +A_append = "2" +A_append = "3" +A += "4" +A .= "5" + + Would ultimately result in A taking the value "1 4523" since the _append operator executes at the same time as the expansion of other overrides. + +
+
+ Key Expansion + + Key expansion happens at the data store finalisation time just before overrides are expanded. + + A${B} = "X" +B = "2" +A2 = "Y" + So in this case A2 would take the value of "X". +
+ + +
+ Inheritance + +
+ Inheritance + NOTE: This is only supported in .bb and .bbclass files. + The inherit 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 BBPATH, where filename is what you inherited. +
+
Inclusion Next, there is the include directive, which causes BitBake to parse whatever file you specify, and insert it at that location, which is not unlike make. However, if the path specified on the include line is a relative path, BitBake will locate the first one it can find within BBPATH. @@ -131,25 +194,7 @@ raise an ParseError if the file to be included cannot be found. Otherwise it wil include directive.
-
- Python variable expansion - DATE = "${@time.strftime('%Y%m%d',time.gmtime())}" - This would result in the DATE variable containing today's date. -
- -
- Defining executable metadata - NOTE: This is only supported in .bb and .bbclass files. - do_mytask () { - echo "Hello, world!" -} - This is essentially identical to setting a variable, except that this variable happens to be executable shell code. - python do_printdate () { - import time - print time.strftime('%Y%m%d', time.gmtime()) -} - This is the similar to the previous, but flags it as Python so that BitBake knows it is Python code. -
+
Defining Python functions into the global Python namespace @@ -165,16 +210,18 @@ include directive. This would result in DEPENDS containing dependencywithcond.
-
- Variable flags - 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. - VARIABLE[SOMEFLAG] = "value" - In this example, VARIABLE has a flag, SOMEFLAG which is set to value. -
-
- Inheritance +
+ Defining executable metadata NOTE: This is only supported in .bb and .bbclass files. - The inherit 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 BBPATH, where filename is what you inherited. + do_mytask () { + echo "Hello, world!" +} + This is essentially identical to setting a variable, except that this variable happens to be executable shell code. + python do_printdate () { + import time + print time.strftime('%Y%m%d', time.gmtime()) +} + This is the similar to the previous, but flags it as Python so that BitBake knows it is Python code.
@@ -202,6 +249,25 @@ addtask printdate before do_build For the 'deptask', 'rdeptask', 'depends', 'rdepends' and 'recrdeptask' flags please see the dependencies section.
+
+ Parsing +
+ Configuration files + The first kind of metadata in BitBake is configuration metadata. This metadata is global, and therefore affects all packages and tasks which are executed. + 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. + BitBake will then expect to find 'conf/bitbake.conf' somewhere in the user specified BBPATH. That configuration file generally has include directives to pull in any other metadata (generally files specific to architecture, machine, local and so on). + Only variable definitions and include directives are allowed in .conf files. +
+
+ Classes + BitBake classes are our rudimentary inheritance mechanism. As briefly mentioned in the metadata introduction, they're parsed when an inherit directive is encountered, and they are located in classes/ relative to the directories in BBPATH. +
+
+ .bb files + 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 BBFILES variable, which is set to a space separated list of .bb files, and does handle wildcards. +
+
+
Events NOTE: This is only supported in .bb and .bbclass files. @@ -232,53 +298,7 @@ SRC_URI_git = "git://someurl/somepath.git" SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;patch=1" 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 BPV variable, for use in file:// search paths (FILESPATH).
-
-
- Variable interaction: Worked Examples - 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. - -
- Override and append ordering - - There is often confusion about which order overrides and the various append operators take effect. - - OVERRIDES = "foo" -A_foo_append = "X" - In this case, X is unconditionally appended to the variable A_foo. Since foo is an override, A_foo would then replace A. - - OVERRIDES = "foo" -A = "X" -A_append_foo = "Y" - In this case, only when foo is in OVERRIDES, Y is appended to the variable A so the value of A would become XY (NB: no spaces are appended). - - OVERRIDES = "foo" -A_foo_append = "X" -A_foo_append += "Y" - This behaves as per the first case above, but the value of A would be "X Y" instead of just "X". - - A = "1" -A_append = "2" -A_append = "3" -A += "4" -A .= "5" - - Would ultimately result in A taking the value "1 4523" since the _append operator executes at the same time as the expansion of other overrides. - -
- -
- Key Expansion - - Key expansion happens at the data store finalisation time just before overrides are expanded. - - A${B} = "X" -B = "2" -A2 = "Y" - So in this case A2 would take the value of "X". -
- -
Dependency handling 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. @@ -316,22 +336,5 @@ SRC_URI_append_1.0.7+ = "file://some_patch_which_the_new_versions_need.patch;pat
-
- Parsing -
- Configuration files - The first kind of metadata in BitBake is configuration metadata. This metadata is global, and therefore affects all packages and tasks which are executed. - 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. - BitBake will then expect to find 'conf/bitbake.conf' somewhere in the user specified BBPATH. That configuration file generally has include directives to pull in any other metadata (generally files specific to architecture, machine, local and so on). - Only variable definitions and include directives are allowed in .conf files. -
-
- Classes - BitBake classes are our rudimentary inheritance mechanism. As briefly mentioned in the metadata introduction, they're parsed when an inherit directive is encountered, and they are located in classes/ relative to the directories in BBPATH. -
-
- .bb files - 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 BBFILES variable, which is set to a space separated list of .bb files, and does handle wildcards. -
-
+ -- cgit v1.2.3-54-g00ecf