2014-08-14 18:03:36 +00:00
|
|
|
def preferred_ml_updates(d):
|
|
|
|
# If any PREFERRED_PROVIDER or PREFERRED_VERSION are set,
|
|
|
|
# we need to mirror these variables in the multilib case;
|
|
|
|
multilibs = d.getVar('MULTILIBS', True) or ""
|
|
|
|
if not multilibs:
|
2011-08-15 22:59:32 +00:00
|
|
|
return
|
|
|
|
|
2014-08-14 18:03:36 +00:00
|
|
|
prefixes = []
|
|
|
|
for ext in multilibs.split():
|
|
|
|
eext = ext.split(':')
|
|
|
|
if len(eext) > 1 and eext[0] == 'multilib':
|
|
|
|
prefixes.append(eext[1])
|
|
|
|
|
|
|
|
versions = []
|
|
|
|
providers = []
|
|
|
|
for v in d.keys():
|
|
|
|
if v.startswith("PREFERRED_VERSION_"):
|
|
|
|
versions.append(v)
|
|
|
|
if v.startswith("PREFERRED_PROVIDER_"):
|
|
|
|
providers.append(v)
|
|
|
|
|
|
|
|
for v in versions:
|
|
|
|
val = d.getVar(v, False)
|
|
|
|
pkg = v.replace("PREFERRED_VERSION_", "")
|
|
|
|
if pkg.endswith("-native") or "-crosssdk-" in pkg or pkg.startswith(("nativesdk-", "virtual/nativesdk-")):
|
|
|
|
continue
|
|
|
|
if '-cross-' in pkg and '${' in pkg:
|
|
|
|
for p in prefixes:
|
|
|
|
localdata = bb.data.createCopy(d)
|
|
|
|
override = ":virtclass-multilib-" + p
|
|
|
|
localdata.setVar("OVERRIDES", localdata.getVar("OVERRIDES", False) + override)
|
|
|
|
bb.data.update_data(localdata)
|
2015-07-31 10:29:35 +00:00
|
|
|
if "-canadian-" in pkg:
|
|
|
|
newname = localdata.expand(v)
|
|
|
|
else:
|
|
|
|
newname = localdata.expand(v).replace("PREFERRED_VERSION_", "PREFERRED_VERSION_" + p + '-')
|
2014-08-14 18:03:36 +00:00
|
|
|
if newname != v:
|
|
|
|
newval = localdata.expand(val)
|
|
|
|
d.setVar(newname, newval)
|
|
|
|
# Avoid future variable key expansion
|
|
|
|
vexp = d.expand(v)
|
|
|
|
if v != vexp and d.getVar(v, False):
|
|
|
|
d.renameVar(v, vexp)
|
|
|
|
continue
|
|
|
|
for p in prefixes:
|
|
|
|
newname = "PREFERRED_VERSION_" + p + "-" + pkg
|
|
|
|
if not d.getVar(newname, False):
|
|
|
|
d.setVar(newname, val)
|
|
|
|
|
|
|
|
for prov in providers:
|
|
|
|
val = d.getVar(prov, False)
|
|
|
|
pkg = prov.replace("PREFERRED_PROVIDER_", "")
|
|
|
|
if pkg.endswith("-native") or "-crosssdk-" in pkg or pkg.startswith(("nativesdk-", "virtual/nativesdk-")):
|
|
|
|
continue
|
|
|
|
if 'cross-canadian' in pkg:
|
|
|
|
for p in prefixes:
|
|
|
|
localdata = bb.data.createCopy(d)
|
|
|
|
override = ":virtclass-multilib-" + p
|
|
|
|
localdata.setVar("OVERRIDES", localdata.getVar("OVERRIDES", False) + override)
|
|
|
|
bb.data.update_data(localdata)
|
|
|
|
newname = localdata.expand(prov)
|
|
|
|
if newname != prov:
|
|
|
|
newval = localdata.expand(val)
|
|
|
|
d.setVar(newname, newval)
|
|
|
|
# Avoid future variable key expansion
|
|
|
|
provexp = d.expand(prov)
|
|
|
|
if prov != provexp and d.getVar(prov, False):
|
|
|
|
d.renameVar(prov, provexp)
|
|
|
|
continue
|
|
|
|
virt = ""
|
|
|
|
if pkg.startswith("virtual/"):
|
|
|
|
pkg = pkg.replace("virtual/", "")
|
|
|
|
virt = "virtual/"
|
|
|
|
for p in prefixes:
|
|
|
|
if pkg != "kernel":
|
|
|
|
newval = p + "-" + val
|
|
|
|
|
|
|
|
# implement variable keys
|
|
|
|
localdata = bb.data.createCopy(d)
|
|
|
|
override = ":virtclass-multilib-" + p
|
|
|
|
localdata.setVar("OVERRIDES", localdata.getVar("OVERRIDES", False) + override)
|
|
|
|
bb.data.update_data(localdata)
|
|
|
|
newname = localdata.expand(prov)
|
|
|
|
if newname != prov and not d.getVar(newname, False):
|
|
|
|
d.setVar(newname, localdata.expand(newval))
|
|
|
|
|
|
|
|
# implement alternative multilib name
|
|
|
|
newname = localdata.expand("PREFERRED_PROVIDER_" + virt + p + "-" + pkg)
|
|
|
|
if not d.getVar(newname, False):
|
2015-07-01 15:18:21 +00:00
|
|
|
d.setVar(newname, localdata.expand(newval))
|
2014-08-14 18:03:36 +00:00
|
|
|
# Avoid future variable key expansion
|
|
|
|
provexp = d.expand(prov)
|
|
|
|
if prov != provexp and d.getVar(prov, False):
|
|
|
|
d.renameVar(prov, provexp)
|
|
|
|
|
|
|
|
|
|
|
|
mp = (d.getVar("MULTI_PROVIDER_WHITELIST", True) or "").split()
|
|
|
|
extramp = []
|
|
|
|
for p in mp:
|
|
|
|
if p.endswith("-native") or "-crosssdk-" in p or p.startswith(("nativesdk-", "virtual/nativesdk-")) or 'cross-canadian' in p:
|
|
|
|
continue
|
|
|
|
virt = ""
|
|
|
|
if p.startswith("virtual/"):
|
|
|
|
p = p.replace("virtual/", "")
|
|
|
|
virt = "virtual/"
|
|
|
|
for pref in prefixes:
|
|
|
|
extramp.append(virt + pref + "-" + p)
|
|
|
|
d.setVar("MULTI_PROVIDER_WHITELIST", " ".join(mp + extramp))
|
|
|
|
|
|
|
|
python multilib_virtclass_handler_vendor () {
|
|
|
|
if isinstance(e, bb.event.ConfigParsed):
|
2012-09-26 11:56:58 +00:00
|
|
|
for v in e.data.getVar("MULTILIB_VARIANTS", True).split():
|
|
|
|
if e.data.getVar("TARGET_VENDOR_virtclass-multilib-" + v, False) is None:
|
2013-05-07 12:55:53 +00:00
|
|
|
e.data.setVar("TARGET_VENDOR_virtclass-multilib-" + v, e.data.getVar("TARGET_VENDOR", False) + "ml" + v)
|
2014-08-14 18:03:36 +00:00
|
|
|
preferred_ml_updates(e.data)
|
|
|
|
}
|
|
|
|
addhandler multilib_virtclass_handler_vendor
|
|
|
|
multilib_virtclass_handler_vendor[eventmask] = "bb.event.ConfigParsed"
|
|
|
|
|
|
|
|
python multilib_virtclass_handler_global () {
|
|
|
|
if not e.data:
|
|
|
|
return
|
2012-09-26 11:56:58 +00:00
|
|
|
|
2011-08-15 22:59:32 +00:00
|
|
|
variant = e.data.getVar("BBEXTENDVARIANT", True)
|
|
|
|
|
|
|
|
if isinstance(e, bb.event.RecipeParsed) and not variant:
|
2012-12-24 11:28:38 +00:00
|
|
|
if bb.data.inherits_class('kernel', e.data) or \
|
|
|
|
bb.data.inherits_class('module-base', e.data) or \
|
|
|
|
(bb.data.inherits_class('allarch', e.data) and\
|
|
|
|
not bb.data.inherits_class('packagegroup', e.data)):
|
2011-08-15 22:59:32 +00:00
|
|
|
variants = (e.data.getVar("MULTILIB_VARIANTS", True) or "").split()
|
2011-09-20 17:06:54 +00:00
|
|
|
|
2011-12-21 13:52:46 +00:00
|
|
|
import oe.classextend
|
|
|
|
clsextends = []
|
|
|
|
for variant in variants:
|
|
|
|
clsextends.append(oe.classextend.ClassExtender(variant, e.data))
|
|
|
|
|
2011-09-20 17:06:54 +00:00
|
|
|
# Process PROVIDES
|
|
|
|
origprovs = provs = e.data.getVar("PROVIDES", True) or ""
|
2011-12-21 13:52:46 +00:00
|
|
|
for clsextend in clsextends:
|
|
|
|
provs = provs + " " + clsextend.map_variable("PROVIDES", setvar=False)
|
2011-08-15 22:59:32 +00:00
|
|
|
e.data.setVar("PROVIDES", provs)
|
2011-09-20 17:06:54 +00:00
|
|
|
|
|
|
|
# Process RPROVIDES
|
|
|
|
origrprovs = rprovs = e.data.getVar("RPROVIDES", True) or ""
|
2011-12-21 13:52:46 +00:00
|
|
|
for clsextend in clsextends:
|
|
|
|
rprovs = rprovs + " " + clsextend.map_variable("RPROVIDES", setvar=False)
|
2015-06-11 22:01:48 +00:00
|
|
|
if rprovs.strip():
|
|
|
|
e.data.setVar("RPROVIDES", rprovs)
|
2011-09-20 17:06:54 +00:00
|
|
|
|
|
|
|
# Process RPROVIDES_${PN}...
|
|
|
|
for pkg in (e.data.getVar("PACKAGES", True) or "").split():
|
|
|
|
origrprovs = rprovs = e.data.getVar("RPROVIDES_%s" % pkg, True) or ""
|
2011-12-21 13:52:46 +00:00
|
|
|
for clsextend in clsextends:
|
|
|
|
rprovs = rprovs + " " + clsextend.map_variable("RPROVIDES_%s" % pkg, setvar=False)
|
|
|
|
rprovs = rprovs + " " + clsextend.extname + "-" + pkg
|
2011-09-20 17:06:54 +00:00
|
|
|
e.data.setVar("RPROVIDES_%s" % pkg, rprovs)
|
2011-08-15 22:59:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
addhandler multilib_virtclass_handler_global
|
2013-06-12 16:31:57 +00:00
|
|
|
multilib_virtclass_handler_global[eventmask] = "bb.event.RecipePreFinalise bb.event.RecipeParsed"
|
2011-08-15 22:59:32 +00:00
|
|
|
|