summaryrefslogtreecommitdiffstats
path: root/meta/classes/multilib.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/multilib.bbclass')
-rw-r--r--meta/classes/multilib.bbclass141
1 files changed, 141 insertions, 0 deletions
diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass
new file mode 100644
index 0000000..9a1cb1d
--- /dev/null
+++ b/meta/classes/multilib.bbclass
@@ -0,0 +1,141 @@
1python multilib_virtclass_handler () {
2 cls = e.data.getVar("BBEXTENDCURR", True)
3 variant = e.data.getVar("BBEXTENDVARIANT", True)
4 if cls != "multilib" or not variant:
5 return
6
7 e.data.setVar('STAGING_KERNEL_DIR', e.data.getVar('STAGING_KERNEL_DIR', True))
8
9 # There should only be one kernel in multilib configs
10 # We also skip multilib setup for module packages.
11 provides = (e.data.getVar("PROVIDES", True) or "").split()
12 if "virtual/kernel" in provides or bb.data.inherits_class('module-base', e.data):
13 raise bb.parse.SkipPackage("We shouldn't have multilib variants for the kernel")
14
15 save_var_name=e.data.getVar("MULTILIB_SAVE_VARNAME", True) or ""
16 for name in save_var_name.split():
17 val=e.data.getVar(name, True)
18 if val:
19 e.data.setVar(name + "_MULTILIB_ORIGINAL", val)
20
21 if bb.data.inherits_class('image', e.data):
22 e.data.setVar("MLPREFIX", variant + "-")
23 e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False))
24 return
25
26 if bb.data.inherits_class('cross-canadian', e.data):
27 e.data.setVar("MLPREFIX", variant + "-")
28 override = ":virtclass-multilib-" + variant
29 e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override)
30 bb.data.update_data(e.data)
31 return
32
33 if bb.data.inherits_class('native', e.data):
34 raise bb.parse.SkipPackage("We can't extend native recipes")
35
36 if bb.data.inherits_class('nativesdk', e.data) or bb.data.inherits_class('crosssdk', e.data):
37 raise bb.parse.SkipPackage("We can't extend nativesdk recipes")
38
39 if bb.data.inherits_class('allarch', e.data) and not bb.data.inherits_class('packagegroup', e.data):
40 raise bb.parse.SkipPackage("Don't extend allarch recipes which are not packagegroups")
41
42
43 # Expand this since this won't work correctly once we set a multilib into place
44 e.data.setVar("ALL_MULTILIB_PACKAGE_ARCHS", e.data.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True))
45
46 override = ":virtclass-multilib-" + variant
47
48 e.data.setVar("MLPREFIX", variant + "-")
49 e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False))
50 e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override)
51
52 # Expand the WHITELISTs with multilib prefix
53 for whitelist in ["HOSTTOOLS_WHITELIST_GPLv3", "WHITELIST_GPLv3", "LGPLv2_WHITELIST_GPLv3"]:
54 pkgs = e.data.getVar(whitelist, True)
55 for pkg in pkgs.split():
56 pkgs += " " + variant + "-" + pkg
57 e.data.setVar(whitelist, pkgs)
58
59 # DEFAULTTUNE can change TARGET_ARCH override so expand this now before update_data
60 newtune = e.data.getVar("DEFAULTTUNE_" + "virtclass-multilib-" + variant, False)
61 if newtune:
62 e.data.setVar("DEFAULTTUNE", newtune)
63}
64
65addhandler multilib_virtclass_handler
66multilib_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
67
68STAGINGCC_prepend = "${BBEXTENDVARIANT}-"
69
70python __anonymous () {
71 variant = d.getVar("BBEXTENDVARIANT", True)
72
73 import oe.classextend
74
75 clsextend = oe.classextend.ClassExtender(variant, d)
76
77 if bb.data.inherits_class('image', d):
78 clsextend.map_depends_variable("PACKAGE_INSTALL")
79 clsextend.map_depends_variable("LINGUAS_INSTALL")
80 clsextend.map_depends_variable("RDEPENDS")
81 pinstall = d.getVar("LINGUAS_INSTALL", True) + " " + d.getVar("PACKAGE_INSTALL", True)
82 d.setVar("PACKAGE_INSTALL", pinstall)
83 d.setVar("LINGUAS_INSTALL", "")
84 # FIXME, we need to map this to something, not delete it!
85 d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", "")
86
87 if bb.data.inherits_class('populate_sdk_base', d):
88 clsextend.map_depends_variable("TOOLCHAIN_TARGET_TASK")
89 clsextend.map_depends_variable("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY")
90
91 if bb.data.inherits_class('image', d):
92 return
93
94 clsextend.map_depends_variable("DEPENDS")
95 clsextend.map_variable("PROVIDES")
96
97 if bb.data.inherits_class('cross-canadian', d):
98 return
99
100 clsextend.rename_packages()
101 clsextend.rename_package_variables((d.getVar("PACKAGEVARS", True) or "").split())
102
103 clsextend.map_packagevars()
104 clsextend.map_regexp_variable("PACKAGES_DYNAMIC")
105 clsextend.map_variable("PACKAGE_INSTALL")
106 clsextend.map_variable("INITSCRIPT_PACKAGES")
107 clsextend.map_variable("USERADD_PACKAGES")
108 clsextend.map_variable("SYSTEMD_PACKAGES")
109}
110
111PACKAGEFUNCS_append = " do_package_qa_multilib"
112
113python do_package_qa_multilib() {
114
115 def check_mlprefix(pkg, var, mlprefix):
116 values = bb.utils.explode_deps(d.getVar('%s_%s' % (var, pkg), True) or d.getVar(var, True) or "")
117 candidates = []
118 for i in values:
119 if i.startswith('virtual/'):
120 i = i[len('virtual/'):]
121 if (not i.startswith('kernel-module')) and (not i.startswith(mlprefix)) and \
122 (not 'cross-canadian' in i) and (not i.startswith("nativesdk-")) and \
123 (not i.startswith("rtld")) and (not i.startswith('kernel-vmlinux')):
124 candidates.append(i)
125 if len(candidates) > 0:
126 bb.warn("Multilib QA Issue: %s package %s - suspicious values '%s' in %s"
127 % (d.getVar('PN', True), pkg, ' '.join(candidates), var))
128
129 ml = d.getVar('MLPREFIX', True)
130 if not ml:
131 return
132
133 packages = d.getVar('PACKAGES', True)
134 for pkg in packages.split():
135 check_mlprefix(pkg, 'RDEPENDS', ml)
136 check_mlprefix(pkg, 'RPROVIDES', ml)
137 check_mlprefix(pkg, 'RRECOMMENDS', ml)
138 check_mlprefix(pkg, 'RSUGGESTS', ml)
139 check_mlprefix(pkg, 'RREPLACES', ml)
140 check_mlprefix(pkg, 'RCONFLICTS', ml)
141}