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 3/4] cross.bbclass: add virtclass handler
Date: Wed, 08 Feb 2012 10:52:28 +0000	[thread overview]
Message-ID: <1328698348.29471.13.camel@ted> (raw)
In-Reply-To: <3aaae21268883e5ebcc5373f99517045613ad102.1328648562.git.otavio@ossystems.com.br>

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





  reply	other threads:[~2012-02-08 11:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 21:09 [PATCH 0/4] Pending patches at O.S. Systems' tree Otavio Salvador
2012-02-07 21:09 ` [PATCH 1/4] dhcp: move dhcp leases files handling to postinst/postrm Otavio Salvador
2012-02-07 21:09 ` [PATCH 2/4] udev: stop providing cache support by default Otavio Salvador
2012-02-07 21:09 ` [PATCH 3/4] cross.bbclass: add virtclass handler Otavio Salvador
2012-02-08 10:52   ` Richard Purdie [this message]
2012-02-08 11:04     ` Otavio Salvador
2012-02-07 21:09 ` [PATCH 4/4] useradd.bbclass: skip processing on virtclass-cross extended packages Otavio Salvador

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=1328698348.29471.13.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