[OE-core] [PATCH] classes: Apply libc-${LIBC} overrides to target recipes only

Khem Raj raj.khem at gmail.com
Tue Nov 29 22:46:58 UTC 2011


Currently these overrides are enabled for native and nativesdk
recipes as well when inheriting native and nativesdk classes. This patch
filters these from OVERRIDES variables for native and nativesdk
recipes.

oe_filter_out and oe_filter functions currently only operated on
space separated strings. Since OVERRIDES are separated using ':'
these functions are enhanced to take and additional parameter
called 'sep' which defaults to None if not specified which means we keep
the existing behaviour.

Drop the last parameter 'd' from filter functions since it was not being
used.

adjust uclibc and gcc-runtime recipes to follow new signatures of
oe_fiter functions.

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 meta/classes/native.bbclass                        |    5 +++--
 meta/classes/nativesdk.bbclass                     |    5 +++--
 meta/classes/utils.bbclass                         |    8 ++++----
 meta/lib/oe/utils.py                               |   14 ++++++++++----
 meta/recipes-core/uclibc/uclibc.inc                |    6 +++---
 .../recipes-devtools/gcc/gcc-configure-runtime.inc |    2 +-
 6 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
index 8f7cc1f..270b4f3 100644
--- a/meta/classes/native.bbclass
+++ b/meta/classes/native.bbclass
@@ -138,8 +138,9 @@ python native_virtclass_handler () {
         if not prov.endswith("-native"):
             provides = provides.replace(prov, prov + "-native")
     e.data.setVar("PROVIDES", provides)
-
-    e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-native")
+    overrides = e.data.getVar("OVERRIDES", False);
+    overrides = oe_filter_out('libc-uclibc|libc-glibc', overrides, ':')
+    e.data.setVar("OVERRIDES",overrides + ":virtclass-native")
 }
 
 addhandler native_virtclass_handler
diff --git a/meta/classes/nativesdk.bbclass b/meta/classes/nativesdk.bbclass
index e6204c0..0f897a9 100644
--- a/meta/classes/nativesdk.bbclass
+++ b/meta/classes/nativesdk.bbclass
@@ -65,8 +65,9 @@ python nativesdk_virtclass_handler () {
     pn = e.data.getVar("PN", True)
     if not pn.endswith("-nativesdk"):
         return
-
-    e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-nativesdk")
+    overrides = e.data.getVar("OVERRIDES", False)
+    oe_filter_out('libc-uclibc|libc-glibc', overrides, ':')
+    e.data.setVar("OVERRIDES",overrides + ":virtclass-nativesdk")
 }
 
 python () {
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 103fa9a..6311017 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -32,11 +32,11 @@ def base_both_contain(variable1, variable2, checkvalue, d):
 def base_prune_suffix(var, suffixes, d):
     return oe.utils.prune_suffix(var, suffixes, d)
 
-def oe_filter(f, str, d):
-    return oe.utils.str_filter(f, str, d)
+def oe_filter(f, str, sep = None):
+    return oe.utils.str_filter(f, str, sep)
 
-def oe_filter_out(f, str, d):
-    return oe.utils.str_filter_out(f, str, d)
+def oe_filter_out(f, str, sep = None):
+    return oe.utils.str_filter_out(f, str, sep)
 
 def machine_paths(d):
     """List any existing machine specific filespath directories"""
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 95daace..3e321fc 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -66,13 +66,19 @@ def prune_suffix(var, suffixes, d):
 
     return var
 
-def str_filter(f, str, d):
+def str_filter(f, str, sep = None):
     from re import match
-    return " ".join(filter(lambda x: match(f, x, 0), str.split()))
+    if sep is None or sep is '':
+	return " ".join(filter(lambda x: match(f, x, 0), str.split()))
+    else:
+	return sep.join(filter(lambda x: match(f, x, 0), str.split(sep)))
 
-def str_filter_out(f, str, d):
+def str_filter_out(f, str, sep = None):
     from re import match
-    return " ".join(filter(lambda x: not match(f, x, 0), str.split()))
+    if sep is None or sep is '':
+	return " ".join(filter(lambda x: not match(f, x, 0), str.split()))
+    else:
+	return sep.join(filter(lambda x: not match(f, x, 0), str.split(sep)))
 
 def param_bool(cfg, field, dflt = None):
     """Lookup <field> in <cfg> map and convert it to a boolean; take
diff --git a/meta/recipes-core/uclibc/uclibc.inc b/meta/recipes-core/uclibc/uclibc.inc
index 92157bd..5845519 100644
--- a/meta/recipes-core/uclibc/uclibc.inc
+++ b/meta/recipes-core/uclibc/uclibc.inc
@@ -112,9 +112,9 @@ export V="2"
 # -O<n> -fno-omit-frame-pointer ends up with GCC ICE on thumb as reported
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44860
 #
-CFLAGS_arm := "${@oe_filter_out('-fno-omit-frame-pointer', '${CFLAGS}', d)}"
-UCLIBC_EXTRA_CFLAGS  := "${@oe_filter_out('(-I\S+|-i\S+)', '${CFLAGS}', d)}"
-UCLIBC_EXTRA_LDFLAGS := "${@oe_filter_out('(-L\S+|-l\S+)', '${LDFLAGS}', d)}"
+CFLAGS_arm := "${@oe_filter_out('-fno-omit-frame-pointer', '${CFLAGS}')}"
+UCLIBC_EXTRA_CFLAGS  := "${@oe_filter_out('(-I\S+|-i\S+)', '${CFLAGS}')}"
+UCLIBC_EXTRA_LDFLAGS := "${@oe_filter_out('(-L\S+|-l\S+)', '${LDFLAGS}')}"
 do_compile_prepend () {
   unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
 }
diff --git a/meta/recipes-devtools/gcc/gcc-configure-runtime.inc b/meta/recipes-devtools/gcc/gcc-configure-runtime.inc
index 34bfaeb..5b19ec9 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-runtime.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-runtime.inc
@@ -1,6 +1,6 @@
 require gcc-configure-common.inc
 
-CXXFLAGS := "${@oe_filter_out('-fvisibility-inlines-hidden', '${CXXFLAGS}', d)}"
+CXXFLAGS := "${@oe_filter_out('-fvisibility-inlines-hidden', '${CXXFLAGS}')}"
 
 EXTRA_OECONF_PATHS = " \
     --with-local-prefix=${STAGING_DIR_TARGET}${prefix} \
-- 
1.7.5.4





More information about the Openembedded-core mailing list