[OE-core] [PATCH] base.bbclass: Add COMPATIBLE_DISTRO_FEATURES support

Phil Blundell pb at pbcl.net
Tue May 28 15:31:38 UTC 2013


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.






More information about the Openembedded-core mailing list