Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/3] cross.bbclass: add virtclass handler
Date: Thu, 08 Dec 2011 22:09:28 +0000	[thread overview]
Message-ID: <1323382168.5309.71.camel@ted> (raw)
In-Reply-To: <ce8ae4f8f6647b3b81e1346d43f0f785a9098425.1323358819.git.otavio@ossystems.com.br>

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
>  }





  reply	other threads:[~2011-12-08 22:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08 15:40 [PATCH 0/3] Misc fixes/improvements Otavio Salvador
2011-12-08 15:40 ` [PATCH 1/3] cross.bbclass: add virtclass handler Otavio Salvador
2011-12-08 22:09   ` Richard Purdie [this message]
2012-02-07 19:28     ` Otavio Salvador
2011-12-08 15:40 ` [PATCH 2/3] dosfstools: update native to 2.11 Otavio Salvador
2011-12-09 19:08   ` Kamble, Nitin A
2011-12-09 19:15   ` Darren Hart
2011-12-09 19:17     ` Otavio Salvador
2011-12-09 19:21       ` Darren Hart
2011-12-09 19:35         ` Otavio Salvador
2011-12-09 19:42           ` Darren Hart
2011-12-12 23:15   ` Saul Wold
2011-12-13 15:49   ` Richard Purdie
2011-12-08 15:40 ` [PATCH 3/3] scripts/send-pull-request: allow sending of patches without a cover letter Otavio Salvador
2011-12-09 19:18   ` Darren Hart
2011-12-10  0:07     ` Richard Purdie
2011-12-10 15:51       ` Otavio Salvador
2011-12-09 19:34   ` Khem Raj
2011-12-09 19:36     ` Otavio Salvador
2011-12-09 19:45       ` Darren Hart
2011-12-09 19:48         ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323382168.5309.71.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox