diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-08-15 23:59:32 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-09-02 18:25:11 +0100 |
commit | f9c3639238c2a9f1072e39ba26d0e521c5951b95 (patch) | |
tree | 9a5af0788af56113a0c62f6e48aa6c6cebe63118 /meta/classes/multilib_global.bbclass | |
parent | accab54cd5d595e5c4b40c86baa1128df4c60615 (diff) | |
download | poky-f9c3639238c2a9f1072e39ba26d0e521c5951b95.tar.gz |
multilib: Only build one kernel
For a given system we only want one kernel to be built. This change makes
the main kernel recipe provide all of the provides of the various enabled
multilibs hence allowing it to fulfil all the appropriate dependencies.
To make this work a global multilib class file needed to be created.
This patch also enables this multi provider functionality for "allarch"
packages.
[YOCTO #1361]
(From OE-Core rev: 2fd257f6c610624f05c8dd3fe1486364af04696f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/multilib_global.bbclass')
-rw-r--r-- | meta/classes/multilib_global.bbclass | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/classes/multilib_global.bbclass b/meta/classes/multilib_global.bbclass new file mode 100644 index 0000000000..217349b2d4 --- /dev/null +++ b/meta/classes/multilib_global.bbclass | |||
@@ -0,0 +1,39 @@ | |||
1 | python multilib_virtclass_handler_global () { | ||
2 | if not e.data: | ||
3 | return | ||
4 | |||
5 | variant = e.data.getVar("BBEXTENDVARIANT", True) | ||
6 | |||
7 | if isinstance(e, bb.event.RecipeParsed) and not variant: | ||
8 | if bb.data.inherits_class('kernel', e.data) or bb.data.inherits_class('module-base', e.data) or bb.data.inherits_class('allarch', e.data): | ||
9 | origprovs = provs = e.data.getVar("PROVIDES", True) | ||
10 | variants = (e.data.getVar("MULTILIB_VARIANTS", True) or "").split() | ||
11 | for variant in variants: | ||
12 | provs = provs + " " + multilib_map_variable("PROVIDES", variant, e.data) | ||
13 | e.data.setVar("PROVIDES", origprovs) | ||
14 | e.data.setVar("PROVIDES", provs) | ||
15 | } | ||
16 | |||
17 | addhandler multilib_virtclass_handler_global | ||
18 | |||
19 | def multilib_extend_name(variant, name): | ||
20 | if name.startswith("virtual/"): | ||
21 | subs = name.split("/", 1)[1] | ||
22 | if not subs.startswith(variant): | ||
23 | return "virtual/" + variant + "-" + subs | ||
24 | return name | ||
25 | if not name.startswith(variant): | ||
26 | return variant + "-" + name | ||
27 | return name | ||
28 | |||
29 | def multilib_map_variable(varname, variant, d): | ||
30 | var = d.getVar(varname, True) | ||
31 | if not var: | ||
32 | return | ||
33 | var = var.split() | ||
34 | newvar = [] | ||
35 | for v in var: | ||
36 | newvar.append(multilib_extend_name(variant, v)) | ||
37 | newdata = " ".join(newvar) | ||
38 | d.setVar(varname, newdata) | ||
39 | return newdata | ||