Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Phil Blundell <pb@pbcl.net>
To: Otavio Salvador <otavio@ossystems.com.br>
Cc: OpenEmbedded Core Mailing List
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] base.bbclass: Add COMPATIBLE_DISTRO_FEATURES support
Date: Tue, 28 May 2013 16:31:38 +0100	[thread overview]
Message-ID: <1369755098.8846.16.camel@phil-desktop.brightsign> (raw)
In-Reply-To: <CAP9ODKqkoXrrYSyQJzRxmDfBKnQWYMUoCV8dhRvHGm2Y-sXp7g@mail.gmail.com>

On Tue, 2013-05-28 at 12:18 -0300, Otavio Salvador wrote:

> +        need_distro_features = d.getVar('REQUIRED_DISTRO_FEATURES',
> True)
> +        if need_distro_features:
> +            need_distro_features = need_distro_features.split()
> +            distro_features = (d.getVar('DISTRO_FEATURES', True) or
> "").split()
> +            for f in need_distro_features:
> +                if f in distro_features:
> +                    break
> +            else:
> +                raise bb.parse.SkipPackage("missing required distro
> feature %s (not in DISTRO_FEATURES)" % need_distro_features)

This is still not quite right.  The error message says that the features
it mentions are "not in DISTRO_FEATURES", but it appears to still be
listing everything that's named in REQUIRED_DISTRO_FEATURES whether or
not it is actually in DISTRO_FEATURES.

Also you seem to be printing a Python list with %s, which will work but
the results aren't especially pretty.

Also also, on a stylistic point, the "for/if/break" construct is a bit
ugly.  You could perhaps consider something like:

need_distro_features = need_distro_features.split()
distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split()
missing_distro_features = filter(lambda x: x not in distro_features, need_distro_features)
if missing_distro_features:
  raise bb.parse.SkipPackage("missing required distro features: %s" % " ".join(missing_distro_features))

p.





  parent reply	other threads:[~2013-05-28 15:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 15:04 [PATCH] base.bbclass: Add COMPATIBLE_DISTRO_FEATURES support Otavio Salvador
2013-05-28 15:12 ` Phil Blundell
2013-05-28 15:18   ` Otavio Salvador
2013-05-28 15:21     ` Eric Bénard
2013-05-28 15:26       ` Otavio Salvador
2013-05-28 15:31     ` Phil Blundell [this message]
2013-05-28 16:08       ` Otavio Salvador
2013-05-28 16:28         ` Phil Blundell
2013-05-28 16:33           ` Otavio Salvador
2013-05-28 16:36             ` Phil Blundell
2013-05-28 16:39               ` 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=1369755098.8846.16.camel@phil-desktop.brightsign \
    --to=pb@pbcl.net \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=otavio@ossystems.com.br \
    /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