classes: Apply libc-${LIBC} overrides to target recipes only
PATCH 1/1 classes: Apply libc-${LIBC} overrides to target recipes only
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.
--- 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(-)
meta/classes/native.bbclass +3 -2
@@ -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
meta/classes/nativesdk.bbclass +3 -2
@@ -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 () {
meta/classes/utils.bbclass +4 -4
@@ -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"""
meta/lib/oe/utils.py +10 -4
@@ -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
meta/recipes-core/uclibc/uclibc.inc +3 -3
@@ -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 }
meta/recipes-devtools/gcc/gcc-configure-runtime.inc +1 -1
@@ -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} \
Signature · 1 line
1.7.5.4
Quoted 5 lines · Khem Raj
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.
Quoted 8 lines
oe_filter_outandoe_filterfunctions 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.
This last piece worries me a lot. It requires a flag day where everyone changes, particularly layers. I don't think that is something that is acceptable.
I'd like to think simpler. How about we change tclibc*.inc to do something like:
LIBCOVERRIDE = ":libc-glibc"
OVERRIDES .= "${LIBCOVERRIDE}"
and then native.bbclass can just do:
LIBCOVERRIDE = ""
Cheers,
Richard
Quoted 9 lines · Richard Purdie
I'd like to think simpler. How about we change tclibc*.inc to do something like:
LIBCOVERRIDE = ":libc-glibc"
OVERRIDES .= "${LIBCOVERRIDE}"and then native.bbclass can just do:
LIBCOVERRIDE = ""
OK let me experiment with this.