[OE-core] [PATCH v2 1/1] classes/whitelist: add class to allow whitelisting recipes from a layer
Khem Raj
raj.khem at gmail.com
Fri Aug 28 06:07:44 UTC 2015
> On Aug 27, 2015, at 5:36 AM, Paul Eggleton <paul.eggleton at linux.intel.com> wrote:
>
> Allow restricting recipes brought from a layer to a specified list. This
> is similar in operation to blacklist.bbclass, but instead specifies a
> per-layer whitelist of recipes (matched by PN or BPN) that are able to
> be built from the layer - anything else is skipped. This is potentially
> useful where you want to bring in a select set of recipes from a larger
> layer e.g. meta-oe.
For the record, I am not in favor of such feature in OE, Distros can still use BBMASK if they wish to
>
> Implements [YOCTO #8150].
>
> Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
> ---
> meta/classes/whitelist.bbclass | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
> create mode 100644 meta/classes/whitelist.bbclass
>
> diff --git a/meta/classes/whitelist.bbclass b/meta/classes/whitelist.bbclass
> new file mode 100644
> index 0000000..ab6ac73
> --- /dev/null
> +++ b/meta/classes/whitelist.bbclass
> @@ -0,0 +1,34 @@
> +# Class that allows you to restrict the recipes brought from a layer to
> +# a specified list. This is similar in operation to blacklist.bbclass
> +# but note the difference in how PNWHITELIST is set - we don't use varflags
> +# here, the recipe name goes in the value and we use an override for the
> +# layer name (although this is not strictly required - you can have one
> +# PNWHITELIST value shared by all of the layers specified in
> +# PNWHITELIST_LAYERS). The layer name used here is actually the name that
> +# gets added to BBFILE_COLLECTIONS in the layer's layer.conf, which may
> +# differ from how the layer is otherwise known - e.g. meta-oe uses
> +# "openembedded-layer".
> +#
> +# INHERIT += "whitelist"
> +# PNWHITELIST_LAYERS = "layername"
> +# PNWHITELIST_layername = "recipe1 recipe2"
> +#
> +# If you would prefer to set a reason message other than the default, you
> +# can do so:
> +#
> +# PNWHITELIST_REASON_layername = "not supported by ${DISTRO}"
> +
> +python() {
> + layer = bb.utils.get_file_layer(d.getVar('FILE', True), d)
> + if layer:
> + layers = (d.getVar('PNWHITELIST_LAYERS', True) or '').split()
> + if layer in layers:
> + localdata = bb.data.createCopy(d)
> + localdata.setVar('OVERRIDES', layer)
> + whitelist = (localdata.getVar('PNWHITELIST', True) or '').split()
> + if not (d.getVar('PN', True) in whitelist or d.getVar('BPN', True) in whitelist):
> + reason = localdata.getVar('PNWHITELIST_REASON', True)
> + if not reason:
> + reason = 'not in PNWHITELIST for layer %s' % layer
> + raise bb.parse.SkipRecipe(reason)
> +}
> --
> 2.1.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20150827/24254c23/attachment-0002.sig>
More information about the Openembedded-core
mailing list