[OE-core] [PATCH 1/3] cross.bbclass: add virtclass handler
Richard Purdie
richard.purdie at linuxfoundation.org
Thu Dec 8 22:09:28 UTC 2011
On Thu, 2011-12-08 at 15:40 +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 | 50 ++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 50 insertions(+), 0 deletions(-)
>
> diff --git a/meta/classes/cross.bbclass b/meta/classes/cross.bbclass
> index 5681ab9..a3b8e10 100644
> --- a/meta/classes/cross.bbclass
> +++ b/meta/classes/cross.bbclass
> @@ -55,6 +55,56 @@ 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.replace("-cross", "-cross"))
I know you did a copy, search, replace and paste from native.bbclass but
you could at least sanity check the result :)
> + elif not dep.endswith("-cross"):
> + newdeps.append(dep + "-cross")
> + else:
> + newdeps.append(dep)
> + bb.data.setVar(varname, " ".join(newdeps), d)
The logic here is just totally wrong. You can't ever hit the else case
and the paths you do hit are nonsensical.
> +
> + map_dependencies("DEPENDS", e.data)
> + 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)
> +
> + provides = e.data.getVar("PROVIDES", True)
> + for prov in provides.split():
> + if prov.find(pn) != -1:
> + continue
> + if not prov.endswith("-cross"):
> + provides = provides.replace(prov, prov + "-cross")
> + e.data.setVar("PROVIDES", provides)
My suggestion is that you should just remove the DEPENDS and PROVIDES
mapping code above and do it manually using the virtclass-cross override
in the recipe. The above code can't have been doing much that is
sensible anyway.
Cheers,
Richard
> + bb.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-cross", e.data)
> +}
> +
> +addhandler cross_virtclass_handler
> +
> do_install () {
> oe_runmake 'DESTDIR=${D}' install
> }
More information about the Openembedded-core
mailing list