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 1/2] gtk-directfb: add bbclass gtk-directfb
Date: Thu, 15 Dec 2011 11:51:58 +0000	[thread overview]
Message-ID: <1323949918.4568.12.camel@ted> (raw)
In-Reply-To: <006b4308dc652187daa0a84726b969a67eb6d6f0.1323864630.git.xiaofeng.yan@windriver.com>

On Wed, 2011-12-14 at 20:18 +0800, Xiaofeng Yan wrote:
> From: Xiaofeng Yan <xiaofeng.yan@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@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





  reply	other threads:[~2011-12-15 11:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 12:18 [PATCH 0/2] add a bb file to build an image for gtk over directfb Xiaofeng Yan
2011-12-14 12:18 ` [PATCH 1/2] gtk-directfb: add bbclass gtk-directfb Xiaofeng Yan
2011-12-15 11:51   ` Richard Purdie [this message]
2011-12-14 12:18 ` [PATCH 2/2] core-image-gtk-directfb: add a bb file to build an image for gtk over directfb Xiaofeng Yan

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