| Submitter | Otavio Salvador |
|---|---|
| Date | Dec. 8, 2011, 3:40 p.m. |
| Message ID | <ce8ae4f8f6647b3b81e1346d43f0f785a9098425.1323358819.git.otavio@ossystems.com.br> |
| Download | mbox | patch |
| Permalink | /patch/16523/ |
| State | New |
| Headers | show |
Comments
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@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 > }
On Thu, Dec 8, 2011 at 20:09, Richard Purdie < richard.purdie@linuxfoundation.org> wrote: > > + 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. Fixed it. > + 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. > Right. I did it and will send an updated patch tomorrow after a from scratch build.
Patch
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")) + elif not dep.endswith("-cross"): + newdeps.append(dep + "-cross") + else: + newdeps.append(dep) + bb.data.setVar(varname, " ".join(newdeps), d) + + 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) + + bb.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-cross", e.data) +} + +addhandler cross_virtclass_handler + do_install () { oe_runmake 'DESTDIR=${D}' install }
Allow use of BBCLASSEXTEND with 'cross' and use of virtclass-cross in recipes. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> --- meta/classes/cross.bbclass | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-)