summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2014-08-14 13:03:36 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-15 18:21:50 +0100
commitcb1ab746ddc4c53f6825f3a9598b21bc5bdb7ef5 (patch)
treeada85d5bd4611ef11afd4aad0ee15599214c7eee /meta
parentc0a071e16ec04f485f06eece5b807e5afbe1c1f1 (diff)
downloadpoky-cb1ab746ddc4c53f6825f3a9598b21bc5bdb7ef5.tar.gz
multilib_global.bbclass: PREFERRED_PROVIDERS for multilibs
The code in base.bbclass to spread PREFERRED_PROVIDERS values to multilibs doesn't work for things which rely on TARGET_PREFIX, such as virtual/${TARGET_PREFIX}gcc. This is because the expansion of TARGET_PREFIX produces the wrong value if executed prior to the assignment of TARGET_VENDOR_virtclass-multilib-libxx, which will always happen since that assignment doesn't happen until recipe parsing, but the PREFERRED_PROVIDERS expansion is happening around ConfigParsed. To solve this, we make a couple of changes. First, the creation of the TARGET_VENDOR override values is moved into a new ConfigParsed event handler in multilib_global. Second, the preferred_ml_updates() function's code is moved into that function too. It seems safe to assume that PREFERRED_PROVIDER values only need to be spread to other multilibs when multilibs are in use. I don't think this directly affects any use cases that don't involve third-party or alternative toolchains. (From OE-Core rev: 513f72274460e54fd35dda5ef70fa42ba2b284f8) Signed-off-by: Peter Seebach <peter.seebach@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/base.bbclass108
-rw-r--r--meta/classes/multilib_global.bbclass117
2 files changed, 114 insertions, 111 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 2c007ab8a6..c0d61fe7aa 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -133,113 +133,6 @@ def pkgarch_mapping(d):
133 if d.getVar("TUNE_PKGARCH", True) == "armv7a-vfp-neon": 133 if d.getVar("TUNE_PKGARCH", True) == "armv7a-vfp-neon":
134 d.setVar("TUNE_PKGARCH", "armv7a") 134 d.setVar("TUNE_PKGARCH", "armv7a")
135 135
136def preferred_ml_updates(d):
137 # If any PREFERRED_PROVIDER or PREFERRED_VERSION are set,
138 # we need to mirror these variables in the multilib case;
139 multilibs = d.getVar('MULTILIBS', True) or ""
140 if not multilibs:
141 return
142
143 prefixes = []
144 for ext in multilibs.split():
145 eext = ext.split(':')
146 if len(eext) > 1 and eext[0] == 'multilib':
147 prefixes.append(eext[1])
148
149 versions = []
150 providers = []
151 for v in d.keys():
152 if v.startswith("PREFERRED_VERSION_"):
153 versions.append(v)
154 if v.startswith("PREFERRED_PROVIDER_"):
155 providers.append(v)
156
157 for v in versions:
158 val = d.getVar(v, False)
159 pkg = v.replace("PREFERRED_VERSION_", "")
160 if pkg.endswith("-native") or "-crosssdk-" in pkg or pkg.startswith(("nativesdk-", "virtual/nativesdk-")):
161 continue
162 if '-cross-' in pkg and '${' in pkg:
163 for p in prefixes:
164 localdata = bb.data.createCopy(d)
165 override = ":virtclass-multilib-" + p
166 localdata.setVar("OVERRIDES", localdata.getVar("OVERRIDES", False) + override)
167 bb.data.update_data(localdata)
168 newname = localdata.expand(v).replace("PREFERRED_VERSION_", "PREFERRED_VERSION_" + p + '-')
169 if newname != v:
170 newval = localdata.expand(val)
171 d.setVar(newname, newval)
172 # Avoid future variable key expansion
173 vexp = d.expand(v)
174 if v != vexp and d.getVar(v, False):
175 d.renameVar(v, vexp)
176 continue
177 for p in prefixes:
178 newname = "PREFERRED_VERSION_" + p + "-" + pkg
179 if not d.getVar(newname, False):
180 d.setVar(newname, val)
181
182 for prov in providers:
183 val = d.getVar(prov, False)
184 pkg = prov.replace("PREFERRED_PROVIDER_", "")
185 if pkg.endswith("-native") or "-crosssdk-" in pkg or pkg.startswith(("nativesdk-", "virtual/nativesdk-")):
186 continue
187 if 'cross-canadian' in pkg:
188 for p in prefixes:
189 localdata = bb.data.createCopy(d)
190 override = ":virtclass-multilib-" + p
191 localdata.setVar("OVERRIDES", localdata.getVar("OVERRIDES", False) + override)
192 bb.data.update_data(localdata)
193 newname = localdata.expand(prov)
194 if newname != prov:
195 newval = localdata.expand(val)
196 d.setVar(newname, newval)
197 # Avoid future variable key expansion
198 provexp = d.expand(prov)
199 if prov != provexp and d.getVar(prov, False):
200 d.renameVar(prov, provexp)
201 continue
202 virt = ""
203 if pkg.startswith("virtual/"):
204 pkg = pkg.replace("virtual/", "")
205 virt = "virtual/"
206 for p in prefixes:
207 if pkg != "kernel":
208 newval = p + "-" + val
209
210 # implement variable keys
211 localdata = bb.data.createCopy(d)
212 override = ":virtclass-multilib-" + p
213 localdata.setVar("OVERRIDES", localdata.getVar("OVERRIDES", False) + override)
214 bb.data.update_data(localdata)
215 newname = localdata.expand(prov)
216 if newname != prov and not d.getVar(newname, False):
217 d.setVar(newname, localdata.expand(newval))
218
219 # implement alternative multilib name
220 newname = localdata.expand("PREFERRED_PROVIDER_" + virt + p + "-" + pkg)
221 if not d.getVar(newname, False):
222 d.setVar(newname, newval)
223 # Avoid future variable key expansion
224 provexp = d.expand(prov)
225 if prov != provexp and d.getVar(prov, False):
226 d.renameVar(prov, provexp)
227
228
229 mp = (d.getVar("MULTI_PROVIDER_WHITELIST", True) or "").split()
230 extramp = []
231 for p in mp:
232 if p.endswith("-native") or "-crosssdk-" in p or p.startswith(("nativesdk-", "virtual/nativesdk-")) or 'cross-canadian' in p:
233 continue
234 virt = ""
235 if p.startswith("virtual/"):
236 p = p.replace("virtual/", "")
237 virt = "virtual/"
238 for pref in prefixes:
239 extramp.append(virt + pref + "-" + p)
240 d.setVar("MULTI_PROVIDER_WHITELIST", " ".join(mp + extramp))
241
242
243def get_layers_branch_rev(d): 136def get_layers_branch_rev(d):
244 layers = (d.getVar("BBLAYERS", True) or "").split() 137 layers = (d.getVar("BBLAYERS", True) or "").split()
245 layers_branch_rev = ["%-17s = \"%s:%s\"" % (os.path.basename(i), \ 138 layers_branch_rev = ["%-17s = \"%s:%s\"" % (os.path.basename(i), \
@@ -290,7 +183,6 @@ python base_eventhandler() {
290 e.data.setVar("NATIVELSBSTRING", lsb_distro_identifier(e.data)) 183 e.data.setVar("NATIVELSBSTRING", lsb_distro_identifier(e.data))
291 e.data.setVar('BB_VERSION', bb.__version__) 184 e.data.setVar('BB_VERSION', bb.__version__)
292 pkgarch_mapping(e.data) 185 pkgarch_mapping(e.data)
293 preferred_ml_updates(e.data)
294 oe.utils.features_backfill("DISTRO_FEATURES", e.data) 186 oe.utils.features_backfill("DISTRO_FEATURES", e.data)
295 oe.utils.features_backfill("MACHINE_FEATURES", e.data) 187 oe.utils.features_backfill("MACHINE_FEATURES", e.data)
296 188
diff --git a/meta/classes/multilib_global.bbclass b/meta/classes/multilib_global.bbclass
index 3315ba9327..8ea2a5a4b8 100644
--- a/meta/classes/multilib_global.bbclass
+++ b/meta/classes/multilib_global.bbclass
@@ -1,11 +1,122 @@
1python multilib_virtclass_handler_global () { 1def preferred_ml_updates(d):
2 if not e.data: 2 # If any PREFERRED_PROVIDER or PREFERRED_VERSION are set,
3 # we need to mirror these variables in the multilib case;
4 multilibs = d.getVar('MULTILIBS', True) or ""
5 if not multilibs:
3 return 6 return
4 7
5 if isinstance(e, bb.event.RecipePreFinalise): 8 prefixes = []
9 for ext in multilibs.split():
10 eext = ext.split(':')
11 if len(eext) > 1 and eext[0] == 'multilib':
12 prefixes.append(eext[1])
13
14 versions = []
15 providers = []
16 for v in d.keys():
17 if v.startswith("PREFERRED_VERSION_"):
18 versions.append(v)
19 if v.startswith("PREFERRED_PROVIDER_"):
20 providers.append(v)
21
22 for v in versions:
23 val = d.getVar(v, False)
24 pkg = v.replace("PREFERRED_VERSION_", "")
25 if pkg.endswith("-native") or "-crosssdk-" in pkg or pkg.startswith(("nativesdk-", "virtual/nativesdk-")):
26 continue
27 if '-cross-' in pkg and '${' in pkg:
28 for p in prefixes:
29 localdata = bb.data.createCopy(d)
30 override = ":virtclass-multilib-" + p
31 localdata.setVar("OVERRIDES", localdata.getVar("OVERRIDES", False) + override)
32 bb.data.update_data(localdata)
33 newname = localdata.expand(v).replace("PREFERRED_VERSION_", "PREFERRED_VERSION_" + p + '-')
34 if newname != v:
35 newval = localdata.expand(val)
36 d.setVar(newname, newval)
37 # Avoid future variable key expansion
38 vexp = d.expand(v)
39 if v != vexp and d.getVar(v, False):
40 d.renameVar(v, vexp)
41 continue
42 for p in prefixes:
43 newname = "PREFERRED_VERSION_" + p + "-" + pkg
44 if not d.getVar(newname, False):
45 d.setVar(newname, val)
46
47 for prov in providers:
48 val = d.getVar(prov, False)
49 pkg = prov.replace("PREFERRED_PROVIDER_", "")
50 if pkg.endswith("-native") or "-crosssdk-" in pkg or pkg.startswith(("nativesdk-", "virtual/nativesdk-")):
51 continue
52 if 'cross-canadian' in pkg:
53 for p in prefixes:
54 localdata = bb.data.createCopy(d)
55 override = ":virtclass-multilib-" + p
56 localdata.setVar("OVERRIDES", localdata.getVar("OVERRIDES", False) + override)
57 bb.data.update_data(localdata)
58 newname = localdata.expand(prov)
59 if newname != prov:
60 newval = localdata.expand(val)
61 d.setVar(newname, newval)
62 # Avoid future variable key expansion
63 provexp = d.expand(prov)
64 if prov != provexp and d.getVar(prov, False):
65 d.renameVar(prov, provexp)
66 continue
67 virt = ""
68 if pkg.startswith("virtual/"):
69 pkg = pkg.replace("virtual/", "")
70 virt = "virtual/"
71 for p in prefixes:
72 if pkg != "kernel":
73 newval = p + "-" + val
74
75 # implement variable keys
76 localdata = bb.data.createCopy(d)
77 override = ":virtclass-multilib-" + p
78 localdata.setVar("OVERRIDES", localdata.getVar("OVERRIDES", False) + override)
79 bb.data.update_data(localdata)
80 newname = localdata.expand(prov)
81 if newname != prov and not d.getVar(newname, False):
82 d.setVar(newname, localdata.expand(newval))
83
84 # implement alternative multilib name
85 newname = localdata.expand("PREFERRED_PROVIDER_" + virt + p + "-" + pkg)
86 if not d.getVar(newname, False):
87 d.setVar(newname, newval)
88 # Avoid future variable key expansion
89 provexp = d.expand(prov)
90 if prov != provexp and d.getVar(prov, False):
91 d.renameVar(prov, provexp)
92
93
94 mp = (d.getVar("MULTI_PROVIDER_WHITELIST", True) or "").split()
95 extramp = []
96 for p in mp:
97 if p.endswith("-native") or "-crosssdk-" in p or p.startswith(("nativesdk-", "virtual/nativesdk-")) or 'cross-canadian' in p:
98 continue
99 virt = ""
100 if p.startswith("virtual/"):
101 p = p.replace("virtual/", "")
102 virt = "virtual/"
103 for pref in prefixes:
104 extramp.append(virt + pref + "-" + p)
105 d.setVar("MULTI_PROVIDER_WHITELIST", " ".join(mp + extramp))
106
107python multilib_virtclass_handler_vendor () {
108 if isinstance(e, bb.event.ConfigParsed):
6 for v in e.data.getVar("MULTILIB_VARIANTS", True).split(): 109 for v in e.data.getVar("MULTILIB_VARIANTS", True).split():
7 if e.data.getVar("TARGET_VENDOR_virtclass-multilib-" + v, False) is None: 110 if e.data.getVar("TARGET_VENDOR_virtclass-multilib-" + v, False) is None:
8 e.data.setVar("TARGET_VENDOR_virtclass-multilib-" + v, e.data.getVar("TARGET_VENDOR", False) + "ml" + v) 111 e.data.setVar("TARGET_VENDOR_virtclass-multilib-" + v, e.data.getVar("TARGET_VENDOR", False) + "ml" + v)
112 preferred_ml_updates(e.data)
113}
114addhandler multilib_virtclass_handler_vendor
115multilib_virtclass_handler_vendor[eventmask] = "bb.event.ConfigParsed"
116
117python multilib_virtclass_handler_global () {
118 if not e.data:
119 return
9 120
10 variant = e.data.getVar("BBEXTENDVARIANT", True) 121 variant = e.data.getVar("BBEXTENDVARIANT", True)
11 122