summaryrefslogtreecommitdiffstats
path: root/meta/classes/multilib_global.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-12-21 13:52:46 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-01-05 12:36:29 +0000
commit8e43f9a751f1637d483d48aa9a9a647d1e3d2003 (patch)
tree77eb98fbd61bf59f66c02089c74661353254d01a /meta/classes/multilib_global.bbclass
parent0fa52f70789afe5a53384ba20249af34c16a8568 (diff)
downloadpoky-8e43f9a751f1637d483d48aa9a9a647d1e3d2003.tar.gz
multilib: Abstract class extension code into classextend.py
(From OE-Core rev: 563828bad19a242bba9ce3db461bb5807037dfdf) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/multilib_global.bbclass')
-rw-r--r--meta/classes/multilib_global.bbclass48
1 files changed, 12 insertions, 36 deletions
diff --git a/meta/classes/multilib_global.bbclass b/meta/classes/multilib_global.bbclass
index 2da66a5e6e..b76fd94162 100644
--- a/meta/classes/multilib_global.bbclass
+++ b/meta/classes/multilib_global.bbclass
@@ -8,55 +8,31 @@ python multilib_virtclass_handler_global () {
8 if bb.data.inherits_class('kernel', e.data) or bb.data.inherits_class('module-base', e.data): 8 if bb.data.inherits_class('kernel', e.data) or bb.data.inherits_class('module-base', e.data):
9 variants = (e.data.getVar("MULTILIB_VARIANTS", True) or "").split() 9 variants = (e.data.getVar("MULTILIB_VARIANTS", True) or "").split()
10 10
11 import oe.classextend
12 clsextends = []
13 for variant in variants:
14 clsextends.append(oe.classextend.ClassExtender(variant, e.data))
15
11 # Process PROVIDES 16 # Process PROVIDES
12 origprovs = provs = e.data.getVar("PROVIDES", True) or "" 17 origprovs = provs = e.data.getVar("PROVIDES", True) or ""
13 for variant in variants: 18 for clsextend in clsextends:
14 provs = provs + " " + multilib_map_variable("PROVIDES", variant, e.data) 19 provs = provs + " " + clsextend.map_variable("PROVIDES", setvar=False)
15 # Reset to original value so next time around multilib_map_variable works properly
16 e.data.setVar("PROVIDES", origprovs)
17 e.data.setVar("PROVIDES", provs) 20 e.data.setVar("PROVIDES", provs)
18 21
19 # Process RPROVIDES 22 # Process RPROVIDES
20 origrprovs = rprovs = e.data.getVar("RPROVIDES", True) or "" 23 origrprovs = rprovs = e.data.getVar("RPROVIDES", True) or ""
21 for variant in variants: 24 for clsextend in clsextends:
22 rprovs = rprovs + " " + multilib_map_variable("RPROVIDES", variant, e.data) 25 rprovs = rprovs + " " + clsextend.map_variable("RPROVIDES", setvar=False)
23 # Reset to original value so next time around multilib_map_variable works properly
24 e.data.setVar("RPROVIDES", origrprovs)
25 e.data.setVar("RPROVIDES", rprovs) 26 e.data.setVar("RPROVIDES", rprovs)
26 27
27 # Process RPROVIDES_${PN}... 28 # Process RPROVIDES_${PN}...
28 for pkg in (e.data.getVar("PACKAGES", True) or "").split(): 29 for pkg in (e.data.getVar("PACKAGES", True) or "").split():
29 origrprovs = rprovs = e.data.getVar("RPROVIDES_%s" % pkg, True) or "" 30 origrprovs = rprovs = e.data.getVar("RPROVIDES_%s" % pkg, True) or ""
30 for variant in variants: 31 for clsextend in clsextends:
31 rprovs = rprovs + " " + multilib_map_variable("RPROVIDES_%s" % pkg, variant, e.data) 32 rprovs = rprovs + " " + clsextend.map_variable("RPROVIDES_%s" % pkg, setvar=False)
32 rprovs = rprovs + " " + variant + "-" + pkg 33 rprovs = rprovs + " " + clsextend.extname + "-" + pkg
33 # Reset to original value so next time around multilib_map_variable works properly
34 e.data.setVar("RPROVIDES_%s" % pkg, origrprovs)
35 e.data.setVar("RPROVIDES_%s" % pkg, rprovs) 34 e.data.setVar("RPROVIDES_%s" % pkg, rprovs)
36} 35}
37 36
38addhandler multilib_virtclass_handler_global 37addhandler multilib_virtclass_handler_global
39 38
40def multilib_extend_name(variant, name):
41 if name.startswith("kernel-module"):
42 return name
43 if name.startswith("virtual/"):
44 subs = name.split("/", 1)[1]
45 if not subs.startswith(variant):
46 return "virtual/" + variant + "-" + subs
47 return name
48 if not name.startswith(variant):
49 return variant + "-" + name
50 return name
51
52def multilib_map_variable(varname, variant, d):
53 var = d.getVar(varname, True)
54 if not var:
55 return ""
56 var = var.split()
57 newvar = []
58 for v in var:
59 newvar.append(multilib_extend_name(variant, v))
60 newdata = " ".join(newvar)
61 d.setVar(varname, newdata)
62 return newdata