diff options
Diffstat (limited to 'meta/classes/multilib_global.bbclass')
-rw-r--r-- | meta/classes/multilib_global.bbclass | 117 |
1 files changed, 114 insertions, 3 deletions
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 @@ | |||
1 | python multilib_virtclass_handler_global () { | 1 | def 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 | |||
107 | python 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 | } | ||
114 | addhandler multilib_virtclass_handler_vendor | ||
115 | multilib_virtclass_handler_vendor[eventmask] = "bb.event.ConfigParsed" | ||
116 | |||
117 | python 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 | ||