diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-12-21 13:52:46 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-01-05 12:36:08 +0000 |
commit | 563828bad19a242bba9ce3db461bb5807037dfdf (patch) | |
tree | f070e047f30de99d93364f04c1fd9c254ba5273c /meta/classes/multilib_global.bbclass | |
parent | 0f485bfd6fc82a109b9da629e464fca1e90faec3 (diff) | |
download | openembedded-core-563828bad19a242bba9ce3db461bb5807037dfdf.tar.gz openembedded-core-563828bad19a242bba9ce3db461bb5807037dfdf.tar.bz2 openembedded-core-563828bad19a242bba9ce3db461bb5807037dfdf.tar.xz openembedded-core-563828bad19a242bba9ce3db461bb5807037dfdf.zip |
multilib: Abstract class extension code into classextend.py
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/multilib_global.bbclass')
-rw-r--r-- | meta/classes/multilib_global.bbclass | 48 |
1 files changed, 12 insertions, 36 deletions
diff --git a/meta/classes/multilib_global.bbclass b/meta/classes/multilib_global.bbclass index 2da66a5e6..b76fd9416 100644 --- a/meta/classes/multilib_global.bbclass +++ b/meta/classes/multilib_global.bbclass @@ -8,55 +8,31 @@ python multilib_virtclass_handler_global () { if bb.data.inherits_class('kernel', e.data) or bb.data.inherits_class('module-base', e.data): variants = (e.data.getVar("MULTILIB_VARIANTS", True) or "").split() + import oe.classextend + clsextends = [] + for variant in variants: + clsextends.append(oe.classextend.ClassExtender(variant, e.data)) + # Process PROVIDES origprovs = provs = e.data.getVar("PROVIDES", True) or "" - for variant in variants: - provs = provs + " " + multilib_map_variable("PROVIDES", variant, e.data) - # Reset to original value so next time around multilib_map_variable works properly - e.data.setVar("PROVIDES", origprovs) + for clsextend in clsextends: + provs = provs + " " + clsextend.map_variable("PROVIDES", setvar=False) e.data.setVar("PROVIDES", provs) # Process RPROVIDES origrprovs = rprovs = e.data.getVar("RPROVIDES", True) or "" - for variant in variants: - rprovs = rprovs + " " + multilib_map_variable("RPROVIDES", variant, e.data) - # Reset to original value so next time around multilib_map_variable works properly - e.data.setVar("RPROVIDES", origrprovs) + for clsextend in clsextends: + rprovs = rprovs + " " + clsextend.map_variable("RPROVIDES", setvar=False) e.data.setVar("RPROVIDES", rprovs) # Process RPROVIDES_${PN}... for pkg in (e.data.getVar("PACKAGES", True) or "").split(): origrprovs = rprovs = e.data.getVar("RPROVIDES_%s" % pkg, True) or "" - for variant in variants: - rprovs = rprovs + " " + multilib_map_variable("RPROVIDES_%s" % pkg, variant, e.data) - rprovs = rprovs + " " + variant + "-" + pkg - # Reset to original value so next time around multilib_map_variable works properly - e.data.setVar("RPROVIDES_%s" % pkg, origrprovs) + for clsextend in clsextends: + rprovs = rprovs + " " + clsextend.map_variable("RPROVIDES_%s" % pkg, setvar=False) + rprovs = rprovs + " " + clsextend.extname + "-" + pkg e.data.setVar("RPROVIDES_%s" % pkg, rprovs) } addhandler multilib_virtclass_handler_global -def multilib_extend_name(variant, name): - if name.startswith("kernel-module"): - return name - if name.startswith("virtual/"): - subs = name.split("/", 1)[1] - if not subs.startswith(variant): - return "virtual/" + variant + "-" + subs - return name - if not name.startswith(variant): - return variant + "-" + name - return name - -def multilib_map_variable(varname, variant, d): - var = d.getVar(varname, True) - if not var: - return "" - var = var.split() - newvar = [] - for v in var: - newvar.append(multilib_extend_name(variant, v)) - newdata = " ".join(newvar) - d.setVar(varname, newdata) - return newdata |