Patchwork [BUG,#1236,1/3] utils.bbclass/multilib.conf: Added misc supporting functions.

login
register
mail settings
Submitter Lianhao Lu
Date Aug. 1, 2011, 11:02 a.m.
Message ID <86e74f97a7eea07d74dafa632c053da2d37e03eb.1312195779.git.lianhao.lu@intel.com>
Download mbox | patch
Permalink /patch/8957/
State New, archived
Headers show

Comments

Lianhao Lu - Aug. 1, 2011, 11:02 a.m.
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.

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
---
 meta/classes/utils.bbclass |   35 +++++++++++++++++++++++++++++++++++
 meta/conf/bitbake.conf     |    1 +
 meta/conf/multilib.conf    |    6 +++++-
 3 files changed, 41 insertions(+), 1 deletions(-)

Patch

diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 8c3a9b8..f8adaea 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -341,3 +341,38 @@  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)
+		#Fix ME. OVERRIDES not work, we have to set DEFAULTTUNE to TUNENAME
+		#overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
+		#localdata.setVar("OVERRIDES", overrides)
+		if localdata.getVar("BBEXTENDVARIANT", True) == item:
+			tunename=localdata.getVar("TUNENAME", False) or ""
+		else:
+			tunename=localdata.getVar("TUNENAME_virtclass-multilib-" + item, False) or ""
+		if tunename != "":
+			localdata.setVar("DEFAULTTUNE", tunename)
+		value = localdata.getVar(var, True) or ""
+		if value != "":
+			values.append(value)
+	if unique:
+		values = set(values)
+	return " ".join(values)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 6e109ec..bcff50e 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -736,3 +736,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 ??= ""
diff --git a/meta/conf/multilib.conf b/meta/conf/multilib.conf
index 894b7a5..60760df 100644
--- a/meta/conf/multilib.conf
+++ b/meta/conf/multilib.conf
@@ -1,6 +1,11 @@ 
 
 baselib = "${@d.getVar('BASE_LIB_tune-' + (d.getVar('DEFAULTTUNE', True) or 'INVALID'), True) or 'lib'}"
 
+MULTILIB_VARIANTS = "${@extend_variants(d,'MULTILIBS','multilib')}"
+
+TUNENAME_virtclass-multilib-lib64 ?= "x86-64"
+TUNENAME_virtclass-multilib-lib32 ?= "x86"
+
 MULTILIBS ??= "multilib:lib32"
 BBCLASSEXTEND_append_pn-linux-libc-headers = " ${MULTILIBS}"
 BBCLASSEXTEND_append_pn-eglibc-initial = " ${MULTILIBS}"
@@ -21,4 +26,3 @@  BBCLASSEXTEND_append_pn-bash = " ${MULTILIBS}"
 BBCLASSEXTEND_append_pn-ncurses = " ${MULTILIBS}"
 BBCLASSEXTEND_append_pn-expat = " ${MULTILIBS}"
 BBCLASSEXTEND_append_pn-eglibc-locale = " ${MULTILIBS}"
-