[OE-core] [PATCH 3/4] cross.bbclass: add virtclass handler
Richard Purdie
richard.purdie at linuxfoundation.org
Wed Feb 8 10:52:28 UTC 2012
On Tue, 2012-02-07 at 21:09 +0000, Otavio Salvador wrote:
> Allow use of BBCLASSEXTEND with 'cross' and use of virtclass-cross in
> recipes.
>
> Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
> ---
> meta/classes/cross.bbclass | 39 +++++++++++++++++++++++++++++++++++++++
> 1 files changed, 39 insertions(+), 0 deletions(-)
>
> diff --git a/meta/classes/cross.bbclass b/meta/classes/cross.bbclass
> index 5681ab9..a764902 100644
> --- a/meta/classes/cross.bbclass
> +++ b/meta/classes/cross.bbclass
> @@ -55,6 +55,45 @@ libexecdir = "${exec_prefix}/libexec/${CROSS_TARGET_SYS_DIR}"
>
> do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}"
>
> +python cross_virtclass_handler () {
> + if not isinstance(e, bb.event.RecipePreFinalise):
> + return
> +
> + classextend = e.data.getVar('BBCLASSEXTEND', True) or ""
> + if "cross" not in classextend:
> + return
> +
> + pn = e.data.getVar("PN", True)
> + if not pn.endswith("-cross"):
> + return
> +
> + def map_dependencies(varname, d, suffix = ""):
> + if suffix:
> + varname = varname + "_" + suffix
> + deps = d.getVar(varname, True)
> + if not deps:
> + return
> + deps = bb.utils.explode_deps(deps)
> + newdeps = []
> + for dep in deps:
> + if dep.endswith("-cross"):
> + newdeps.append(dep)
> + else:
> + newdeps.append(dep + "-cross")
> + bb.data.setVar(varname, " ".join(newdeps), d)
> +
> + for pkg in (e.data.getVar("PACKAGES", True).split() + [""]):
> + map_dependencies("RDEPENDS", e.data, pkg)
> + map_dependencies("RRECOMMENDS", e.data, pkg)
> + map_dependencies("RSUGGESTS", e.data, pkg)
> + map_dependencies("RPROVIDES", e.data, pkg)
> + map_dependencies("RREPLACES", e.data, pkg)
I want to highlight what this code does and I don't understand when it
would do something that makes sense. If for example we have a recipe
which:
RDEPENDS = "libc zlib"
it will now:
RDEPENDS = "lib-cross zlib-cross"
or a native recipe which had:
RDEPENDS = "pkgconfig-native"
will now:
RDEPENDS = "pkgconfig-native-cross"
Can you point me at the recipe you're using this in? I suspect we should
just remove the map_dependencies() pieces from this class entirely and
handle dependency issues with the override manually. I think at this
point all the BBCLASSEXTEND is going to give you is the removal of the
need to add a separate .bb file with "inherit cross" in it and enable an
override for your to use. I'm not sure we can write generic dependency
mapping code that would work for -cross.
Cheers,
Richard
More information about the Openembedded-core
mailing list