From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Ke Liping <liping.ke@intel.com>
Cc: poky@yoctoproject.org
Subject: Re: [PATCH 3/4][Image Creator]Introduce new param caches_array into Cache impl.
Date: Thu, 26 May 2011 11:27:14 +0100 [thread overview]
Message-ID: <1306405634.27470.111.camel@rex> (raw)
In-Reply-To: <d43679c93e42683ef1e3d636fe9bacc7304d415e.1306376361.git.liping.ke@intel.com>
Hi Liping,
This looks good, just a couple more minor tweaks:
On Thu, 2011-05-26 at 10:53 +0800, Ke Liping wrote:
> diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
> index a1cd4d7..0dc895a 100644
> --- a/bitbake/lib/bb/cooker.py
> +++ b/bitbake/lib/bb/cooker.py
> @@ -72,6 +72,43 @@ class BBCooker:
>
> self.configuration = configuration
>
> + self.caches_array = []
> + # Currently, only Image Creator hob ui needs extra cache.
> + # So, we save Extra Cache class name and container file
> + # information into a extraCaches field in hob UI.
> + # In future, having a registration mechanism for extra cache
> + # fields in cache_extra is a better solution. Also, we may
> + # need to consider adding a user-hidden parameter 'CacheRequest'
> + # for bitbake command line. It will be filled by those sub
> + # command who need to have extra cache support.
> + caches_name_array = ['bb.cache:CoreRecipeInfo']
> + if configuration.ui:
> + try:
> + module = __import__('bb.ui', fromlist=[configuration.ui])
> + name_array = (getattr(module, configuration.ui)).extraCaches
> + for recipeInfoName in name_array:
> + caches_name_array.append(recipeInfoName)
> + except ImportError, exc:
> + # bb.ui.XXX is not defined and imported. It's an error!
> + logger.critical("Unable to import '%s' interface from bb.ui: %s" % (configuration.ui, exc))
> + sys.exit("FATAL: Failed to import '%s' interface." % configuration.ui)
> + except AttributeError:
> + # This is not an error. If the field is not defined in the ui,
> + # this interface might need no extra cache fields, so
> + # just skip this error!
> + logger.info("UI '%s' does not require extra cache!" % (configuration.ui))
This should be logger.debug as we don't need to show this to the user in
general.
Whilst this code block is better than what we had previously, I think
bin/bitbake should pass some kind of information into cooker about the
required caches rather than cooker poking around the ui variables. We
can leave that as is for now but its a cleanup we should really do when
we get time. There are various UI startup issues we should probably
address at the same time.
> + # At least CoreRecipeInfo will be loaded, so caches_array will never be empty!
> + # This is the entry point, no further check needed!
> + for var in caches_name_array:
> + try:
> + module_name, cache_name = var.split(':')
> + module = __import__(module_name, fromlist=(cache_name,))
> + self.caches_array.append(getattr(module, cache_name))
> + except ImportError, exc:
> + logger.critical("Unable to import extra RecipeInfo '%s' from bb.extra_cache: %s" % (cache_name, exc))
We should use module_name instead of bb.extra_cache here :)
I'm really happy with these changes in general though, looks good!
Cheers,
Richard
next prev parent reply other threads:[~2011-05-26 10:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 2:51 [PATCH 0/4][Image Creator]Add mulitple extra cache fields request support Ke Liping
2011-05-26 2:53 ` Ke Liping
2011-05-26 2:52 ` [PATCH 1/4][Image Creator]Refactory Current Cache implementation Ke Liping
2011-05-26 2:53 ` Ke Liping
2011-05-26 2:52 ` [PATCH 2/4][Image Creator]Introduce extra cache class for image creator Ke Liping
2011-05-26 2:53 ` Ke Liping
2011-05-26 2:52 ` [PATCH 3/4][Image Creator]Introduce new param caches_array into Cache impl Ke Liping
2011-05-26 2:53 ` Ke Liping
2011-05-26 10:27 ` Richard Purdie [this message]
2011-05-31 8:11 ` Ke, Liping
2011-05-26 2:52 ` [PATCH 4/4][Image Creator]Implement multiple extra cache fields request support Ke Liping
2011-05-26 2:53 ` Ke Liping
2011-05-26 3:11 ` [PATCH 0/4][Image Creator]Add mulitple " Ke, Liping
-- strict thread matches above, loose matches on Subject: below --
2011-05-31 8:15 Ke Liping
2011-05-31 8:15 ` [PATCH 3/4][Image Creator]Introduce new param caches_array into Cache impl Ke Liping
2011-06-03 1:06 [PATCH 0/4][Image Creator]Add mulitple extra cache fields request support Ke Liping
2011-06-03 1:06 ` [PATCH 3/4][Image Creator]Introduce new param caches_array into Cache impl Ke Liping
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=1306405634.27470.111.camel@rex \
--to=richard.purdie@linuxfoundation.org \
--cc=liping.ke@intel.com \
--cc=poky@yoctoproject.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 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.