[OE-core] [wic][PATCH 04/20] wic: Refactor getting bitbake variables

Ed Bartosh ed.bartosh at linux.intel.com
Tue Jun 30 08:11:23 UTC 2015


Hi Cristopher,

On Mon, Jun 29, 2015 at 02:48:30PM -0700, Christopher Larson wrote:
> On Mon, Jun 29, 2015 at 12:10 PM, Ed Bartosh <ed.bartosh at linux.intel.com>
> wrote:
> 
> > +    global _BITBAKE_VARS
> > +
> > +    if image not in _BITBAKE_VARS:
> >
> 
> In general, I’d suggest using a cache class/object rather than globals,
> similar to how it’s handled in bb.checksum, or a transparent LRU. Whenever
> a cache is involved, it’s best to consider what its lifetime is.
> Admittedly, wic isn’t long-running, but best not to get into bad habits.

Thank you for your comment.

I thought about using a cache class and decided not to do it to keep the
code consistent with the rest of the module. As it was global variable
in the old code my implementation doesn't make the code worse I hope.

As far as I'm happy with test coverage I'll do more serious refactoring
and hopefully implement something better than that.

--
Regards,
Ed



More information about the Openembedded-core mailing list