All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Dongxiao Xu <dongxiao.xu@intel.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH 1/3] command.py: Add a hook for config parsing
Date: Fri, 13 Apr 2012 11:54:46 +0100	[thread overview]
Message-ID: <1334314486.7309.68.camel@ted> (raw)
In-Reply-To: <7cacaa562688f1b5bd78f7dc12b1c1d1a70196e2.1334245432.git.dongxiao.xu@intel.com>

On Thu, 2012-04-12 at 23:46 +0800, Dongxiao Xu wrote:
> To make the UI settings take effect, we need to hook at the end of each
> config file parsing and set UI specific values.
> 
> Signed-off-by: Richar Purdie <richard.purdie@linuxfoundation.org>
> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> ---
>  lib/bb/command.py                    |    7 +++++++
>  lib/bb/parse/parse_py/ConfHandler.py |    5 +++++
>  2 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/bb/command.py b/lib/bb/command.py
> index 73aaca0..fd8912a 100644
> --- a/lib/bb/command.py
> +++ b/lib/bb/command.py
> @@ -179,6 +179,13 @@ class CommandsSync:
>          """
>          return bb.utils.cpu_count()
>  
> +    def setConfFilter(self, command, params):
> +        """
> +        Set the configuration file parsing filter
> +        """
> +        filterfunc = params[0]
> +        bb.parse.parse_py.ConfHandler.confFilters.append(filterfunc)
> +
>  class CommandsAsync:
>      """
>      A class of asynchronous commands
> diff --git a/lib/bb/parse/parse_py/ConfHandler.py b/lib/bb/parse/parse_py/ConfHandler.py
> index fa811f3..f108c24 100644
> --- a/lib/bb/parse/parse_py/ConfHandler.py
> +++ b/lib/bb/parse/parse_py/ConfHandler.py
> @@ -71,6 +71,8 @@ def include(oldfn, fn, lineno, data, error_out):
>              raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
>          logger.debug(2, "CONF file '%s' not found", fn)
>  
> +confFilters = []
> +
>  def handle(fn, data, include):
>      init(data)
>  
> @@ -107,6 +109,9 @@ def handle(fn, data, include):
>      if oldfile:
>          data.setVar('FILE', oldfile)
>  
> +    for f in confFilters:
> +        f(fn, data)
> +
>      return data
>  
>  def feeder(lineno, s, fn, statements):


I've merged this but I added in a comment block about why we need to do
this since its not immediately clear why we need to do something quite
this nasty.

Cheers,

Richard





  reply	other threads:[~2012-04-13 11:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12 15:46 [PATCH 0/3][PULL] Hob: Bug fixes Dongxiao Xu
2012-04-12 15:46 ` [PATCH 1/3] command.py: Add a hook for config parsing Dongxiao Xu
2012-04-13 10:54   ` Richard Purdie [this message]
2012-04-12 15:46 ` [PATCH 2/3] Hob: Implement Hob config parse hook Dongxiao Xu
2012-04-12 15:46 ` [PATCH 3/3] Hob: A minor fix on tooltip Dongxiao Xu
2012-04-13 10:44   ` Richard Purdie

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=1334314486.7309.68.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=dongxiao.xu@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.