blob: 519c1a55ba2a99df6035dc4d8cadf083b83e2a01 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001python multilib_virtclass_handler () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002 cls = e.data.getVar("BBEXTENDCURR")
3 variant = e.data.getVar("BBEXTENDVARIANT")
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004 if cls != "multilib" or not variant:
5 return
6
Brad Bishopd7bf8c12018-02-25 22:55:05 -05007 localdata = bb.data.createCopy(e.data)
8 localdata.delVar('TMPDIR')
9 e.data.setVar('STAGING_KERNEL_DIR', localdata.getVar('STAGING_KERNEL_DIR'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010
11 # There should only be one kernel in multilib configs
12 # We also skip multilib setup for module packages.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013 provides = (e.data.getVar("PROVIDES") or "").split()
Brad Bishop316dfdd2018-06-25 12:45:53 -040014 if "virtual/kernel" in provides or bb.data.inherits_class('module-base', e.data) or "make-mod-scripts" in e.data.getVar("PN"):
15 raise bb.parse.SkipRecipe("We shouldn't have multilib variants for the kernel")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016
Brad Bishop6e60e8b2018-02-01 10:27:11 -050017 save_var_name=e.data.getVar("MULTILIB_SAVE_VARNAME") or ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018 for name in save_var_name.split():
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019 val=e.data.getVar(name)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020 if val:
21 e.data.setVar(name + "_MULTILIB_ORIGINAL", val)
22
23 overrides = e.data.getVar("OVERRIDES", False)
24 pn = e.data.getVar("PN", False)
25 overrides = overrides.replace("pn-${PN}", "pn-${PN}:pn-" + pn)
26 e.data.setVar("OVERRIDES", overrides)
27
28 if bb.data.inherits_class('image', e.data):
29 e.data.setVar("MLPREFIX", variant + "-")
30 e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False))
Brad Bishop6e60e8b2018-02-01 10:27:11 -050031 e.data.setVar('SDKTARGETSYSROOT', e.data.getVar('SDKTARGETSYSROOT'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032 target_vendor = e.data.getVar("TARGET_VENDOR_" + "virtclass-multilib-" + variant, False)
33 if target_vendor:
34 e.data.setVar("TARGET_VENDOR", target_vendor)
35 return
36
37 if bb.data.inherits_class('cross-canadian', e.data):
38 e.data.setVar("MLPREFIX", variant + "-")
39 override = ":virtclass-multilib-" + variant
40 e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041 return
42
43 if bb.data.inherits_class('native', e.data):
Brad Bishop316dfdd2018-06-25 12:45:53 -040044 raise bb.parse.SkipRecipe("We can't extend native recipes")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045
46 if bb.data.inherits_class('nativesdk', e.data) or bb.data.inherits_class('crosssdk', e.data):
Brad Bishop316dfdd2018-06-25 12:45:53 -040047 raise bb.parse.SkipRecipe("We can't extend nativesdk recipes")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048
49 if bb.data.inherits_class('allarch', e.data) and not bb.data.inherits_class('packagegroup', e.data):
Brad Bishop316dfdd2018-06-25 12:45:53 -040050 raise bb.parse.SkipRecipe("Don't extend allarch recipes which are not packagegroups")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051
52
53 # Expand this since this won't work correctly once we set a multilib into place
Brad Bishop6e60e8b2018-02-01 10:27:11 -050054 e.data.setVar("ALL_MULTILIB_PACKAGE_ARCHS", e.data.getVar("ALL_MULTILIB_PACKAGE_ARCHS"))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055
56 override = ":virtclass-multilib-" + variant
57
Brad Bishop6e60e8b2018-02-01 10:27:11 -050058 blacklist = e.data.getVarFlag('PNBLACKLIST', e.data.getVar('PN'))
59 if blacklist:
60 pn_new = variant + "-" + e.data.getVar('PN')
61 if not e.data.getVarFlag('PNBLACKLIST', pn_new):
62 e.data.setVarFlag('PNBLACKLIST', pn_new, blacklist)
63
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064 e.data.setVar("MLPREFIX", variant + "-")
65 e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False))
66 e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override)
67
68 # Expand the WHITELISTs with multilib prefix
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050069 for whitelist in ["WHITELIST_GPL-3.0", "LGPLv2_WHITELIST_GPL-3.0"]:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050070 pkgs = e.data.getVar(whitelist)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071 for pkg in pkgs.split():
72 pkgs += " " + variant + "-" + pkg
73 e.data.setVar(whitelist, pkgs)
74
75 # DEFAULTTUNE can change TARGET_ARCH override so expand this now before update_data
76 newtune = e.data.getVar("DEFAULTTUNE_" + "virtclass-multilib-" + variant, False)
77 if newtune:
78 e.data.setVar("DEFAULTTUNE", newtune)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079}
80
81addhandler multilib_virtclass_handler
82multilib_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
83
84STAGINGCC_prepend = "${BBEXTENDVARIANT}-"
85
86python __anonymous () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050087 variant = d.getVar("BBEXTENDVARIANT")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088
89 import oe.classextend
90
91 clsextend = oe.classextend.ClassExtender(variant, d)
92
93 if bb.data.inherits_class('image', d):
94 clsextend.map_depends_variable("PACKAGE_INSTALL")
95 clsextend.map_depends_variable("LINGUAS_INSTALL")
96 clsextend.map_depends_variable("RDEPENDS")
Brad Bishop6e60e8b2018-02-01 10:27:11 -050097 pinstall = d.getVar("LINGUAS_INSTALL") + " " + d.getVar("PACKAGE_INSTALL")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098 d.setVar("PACKAGE_INSTALL", pinstall)
99 d.setVar("LINGUAS_INSTALL", "")
100 # FIXME, we need to map this to something, not delete it!
101 d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", "")
Brad Bishop316dfdd2018-06-25 12:45:53 -0400102 bb.build.deltask('do_populate_sdk', d)
103 bb.build.deltask('do_populate_sdk_ext', d)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104 return
105
106 clsextend.map_depends_variable("DEPENDS")
107 clsextend.map_variable("PROVIDES")
108
109 if bb.data.inherits_class('cross-canadian', d):
110 return
111
112 clsextend.rename_packages()
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500113 clsextend.rename_package_variables((d.getVar("PACKAGEVARS") or "").split())
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500114
115 clsextend.map_packagevars()
116 clsextend.map_regexp_variable("PACKAGES_DYNAMIC")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500117 clsextend.map_variable("INITSCRIPT_PACKAGES")
118 clsextend.map_variable("USERADD_PACKAGES")
119 clsextend.map_variable("SYSTEMD_PACKAGES")
120}
121
122PACKAGEFUNCS_append = " do_package_qa_multilib"
123
124python do_package_qa_multilib() {
125
126 def check_mlprefix(pkg, var, mlprefix):
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500127 values = bb.utils.explode_deps(d.getVar('%s_%s' % (var, pkg)) or d.getVar(var) or "")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500128 candidates = []
129 for i in values:
130 if i.startswith('virtual/'):
131 i = i[len('virtual/'):]
132 if (not i.startswith('kernel-module')) and (not i.startswith(mlprefix)) and \
133 (not 'cross-canadian' in i) and (not i.startswith("nativesdk-")) and \
134 (not i.startswith("rtld")) and (not i.startswith('kernel-vmlinux')):
135 candidates.append(i)
136 if len(candidates) > 0:
137 msg = "%s package %s - suspicious values '%s' in %s" \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500138 % (d.getVar('PN'), pkg, ' '.join(candidates), var)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500139 package_qa_handle_error("multilib", msg, d)
140
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500141 ml = d.getVar('MLPREFIX')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500142 if not ml:
143 return
144
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500145 packages = d.getVar('PACKAGES')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500146 for pkg in packages.split():
147 check_mlprefix(pkg, 'RDEPENDS', ml)
148 check_mlprefix(pkg, 'RPROVIDES', ml)
149 check_mlprefix(pkg, 'RRECOMMENDS', ml)
150 check_mlprefix(pkg, 'RSUGGESTS', ml)
151 check_mlprefix(pkg, 'RREPLACES', ml)
152 check_mlprefix(pkg, 'RCONFLICTS', ml)
153}