[OE-core] [PATCH 1/2] gtk-directfb: add bbclass gtk-directfb

Richard Purdie richard.purdie at linuxfoundation.org
Thu Dec 15 11:51:58 UTC 2011


On Wed, 2011-12-14 at 20:18 +0800, Xiaofeng Yan wrote:
> From: Xiaofeng Yan <xiaofeng.yan at windriver.com>
> 
> This file remind user to add "gtk-directfb" to DISTRO_FEATURES and remove "x11" \
> when building core-image-gtk-directfb.
> 
> [YOCTO #1674]
> 
> Signed-off-by: Xiaofeng Yan <xiaofeng.yan at windriver.com>
> ---
>  meta/classes/gtk-directfb.bbclass |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
>  create mode 100644 meta/classes/gtk-directfb.bbclass
> 
> diff --git a/meta/classes/gtk-directfb.bbclass b/meta/classes/gtk-directfb.bbclass
> new file mode 100644
> index 0000000..b65b787
> --- /dev/null
> +++ b/meta/classes/gtk-directfb.bbclass
> @@ -0,0 +1,12 @@
> +# gtk can only run a backend at a time (directfb or x11) for gtk-2.x. 
> +# So if you want to get an image of gtk running directfb. 
> +# Please remove x11 from DISTRO_FEATURES
> +python () {
> +	import sys
> +	import logging
> +	logger = logging.getLogger('BitBake.Event')
> +	packages = d.getVar('DISTRO_FEATURES', 1).split()
> +	for pkg in packages:
> +		if pkg == "x11":
> +			bb.fatal("FEATURE \"x11\" is in DISTRO_FEATURES, Please remove x11 from DISTRO_FEATURES, use \"gtk-directfb\" instead of it\n")
> +}

Some improvements I'd like to suggest please:

* Put this in the image .bb file, we don't need a generic class for 
  this in the core, at least at this point
* Don't import things you don't need (logging, sys)
* Use something like 'if "x11" in packages' instead for that for loop
* Use SkipPackage instead of bb.fatal like I suggested (grep will show 
  some examples)
* Use True instead of 1
* Rename the variables to be meaningful (packages is confusing here)

Cheers,

Richard






More information about the Openembedded-core mailing list