utils.bbclass/multilib.class: Added misc supporting functions.

1. Added variable MULTILIB_VARIANTS to store all the instance variants
for multilib extend.

2. Added function all_multilib_tune_values to collect the variable
values for all multilib instance.

3. multilib bbclass handler will save the orignal value of all variables
defined in MULTILIB_SAVE_VARNAME.

(From OE-Core rev: 18bba910e04bff75460f408e4557d4bae21ad592)

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Lianhao Lu 2011-07-29 22:21:58 +08:00 committed by Richard Purdie
parent 92ad22dc08
commit 375cf1561c
4 changed files with 39 additions and 1 deletions

View File

@ -6,7 +6,12 @@ python multilib_virtclass_handler () {
variant = e.data.getVar("BBEXTENDVARIANT", True)
if cls != "multilib" or not variant:
return
save_var_name=e.data.getVar("MULTILIB_SAVE_VARNAME", True) or ""
for name in save_var_name.split():
val=e.data.getVar(name, True)
if val:
e.data.setVar(name + "_MULTILIB_ORIGINAL", val)
override = ":virtclass-multilib-" + variant
e.data.setVar("MLPREFIX", variant + "-")

View File

@ -341,3 +341,32 @@ def base_set_filespath(path, d):
for o in overrides.split(":"):
filespath.append(os.path.join(p, o))
return ":".join(filespath)
def extend_variants(d, var, extend, delim=':'):
"""Return a string of all bb class extend variants for the given extend"""
variants = []
whole = d.getVar(var, True) or ""
for ext in whole.split():
eext = ext.split(delim)
if len(eext) > 1 and eext[0] == extend:
variants.append(eext[1])
return " ".join(variants)
def all_multilib_tune_values(d, var, unique=True):
"""Return a string of all ${var} in all multilib tune configuration"""
values = []
value = d.getVar(var, True) or ""
if value != "":
values.append(value)
variants = d.getVar("MULTILIB_VARIANTS", True) or ""
for item in variants.split():
localdata = bb.data.createCopy(d)
overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
localdata.setVar("OVERRIDES", overrides)
bb.data.update_data(localdata)
value = localdata.getVar(var, True) or ""
if value != "":
values.append(value)
if unique:
values = set(values)
return " ".join(values)

View File

@ -749,3 +749,4 @@ BB_HASHTASK_WHITELIST ?= "(.*-cross$|.*-native$|.*-cross-initial$|.*-cross-inter
BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL TERM USER FILESPATH USERNAME STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE"
MLPREFIX ??= ""
MULTILIB_VARIANTS ??= ""

View File

@ -1,6 +1,9 @@
baselib = "${@d.getVar('BASE_LIB_tune-' + (d.getVar('DEFAULTTUNE', True) or 'INVALID'), True) or 'lib'}"
MULTILIB_VARIANTS = "${@extend_variants(d,'MULTILIBS','multilib')}"
MULTILIB_SAVE_VARNAME = "DEFAULTTUNE"
MULTILIBS ??= "multilib:lib32"
BBCLASSEXTEND_append_pn-acl = " ${MULTILIBS}"