Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Saul Wold <sgw@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [CONSOLIDATED PULL 03/12] utils.bbclass/multilib.class: Added misc supporting functions.
Date: Sun, 14 Aug 2011 16:30:37 -0700	[thread overview]
Message-ID: <7443e896b8c85ab870f00a81151d827bda343eef.1313363644.git.sgw@linux.intel.com> (raw)
In-Reply-To: <cover.1313363644.git.sgw@linux.intel.com>
In-Reply-To: <cover.1313363644.git.sgw@linux.intel.com>

From: Lianhao Lu <lianhao.lu@intel.com>

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.

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

diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass
index 6e1669f..571b7be 100644
--- a/meta/classes/multilib.bbclass
+++ b/meta/classes/multilib.bbclass
@@ -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 + "-")
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 8c3a9b8..c66c184 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -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)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 7bb68b8..b309516 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -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 ??= ""
diff --git a/meta/conf/multilib.conf b/meta/conf/multilib.conf
index f2a2002..36793d2 100644
--- a/meta/conf/multilib.conf
+++ b/meta/conf/multilib.conf
@@ -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}"
-- 
1.7.6




  parent reply	other threads:[~2011-08-14 23:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 23:30 [CONSOLIDATED PULL 00/12] Various Fixes Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 01/12] bluez4: Added new recipe 4.96 and removed 4.82 version Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 02/12] valgrind: supporting on Linux kernel 3.x Saul Wold
2011-08-14 23:30 ` Saul Wold [this message]
2011-08-15 11:53   ` [CONSOLIDATED PULL 03/12] utils.bbclass/multilib.class: Added misc supporting functions Richard Purdie
2011-08-14 23:30 ` [CONSOLIDATED PULL 04/12] eglibc: Modify ldd script according to multilib config Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 05/12] image: populate site config files into roootfs Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 06/12] meta-toolchain/environment: Use site config in rootfs Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 07/12] intltool: Use nativeperl binary for PERL instead of 'perl' Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 08/12] pixman: remove spurious dependency on libx11 Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 09/12] libx11: skip self if x11 not in DISTRO_FEATURES Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 10/12] cairo: only use x11 if selected " Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 11/12] dbus: only use x11 if DISTRO_FEATURES has selected it Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 12/12] default-distrovars: add x11 to default DISTRO_FEATURES Saul Wold
2011-08-15 11:52 ` [CONSOLIDATED PULL 00/12] Various Fixes Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7443e896b8c85ab870f00a81151d827bda343eef.1313363644.git.sgw@linux.intel.com \
    --to=sgw@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox