[bitbake-devel] [Openembedded-architecture] [PATCH] data_smart: Drop default expand=False to getVar [API change]

Christopher Larson clarson at kergoth.com
Wed Feb 3 16:29:54 UTC 2016


On Wed, Feb 3, 2016 at 9:22 AM, Richard Purdie <
richard.purdie at linuxfoundation.org> wrote:

> On Wed, 2016-02-03 at 16:06 +0100, Martin Jansa wrote:
> > On Wed, Feb 03, 2016 at 11:22:36AM +0000, Richard Purdie wrote:
> > > On Wed, 2016-02-03 at 08:11 -0200, Otavio Salvador wrote:
> > > > I am in favor of making it mandatory but I fail to see what we
> > > > gain
> > > > in making it expand by default in future.
> > >
> > > Less ugly syntax, in 99.9% of usages, you would want expand=True
> > > and
> > > getVar("X") is neater than getVar("X", True).
> >
> > Consistent indentation is also neater than mixing tabs and spaces,
> > but
> > you were refusing to take such cosmetic change and now you're
> > proposing
> > neater getVar syntax which is (in some cases silently) breaking
> > existing
> > metadata and make backporting changes more difficult?
> >
> > I'm not opposing the change, just don't understand why the same
> > arguments work here and not for indentation.
>
> If we go through the full transition, its possible something might
> silently break, if they skip the release where we require a value. We
> haven't reached that point yet and I'm honestly not sure how long we
> should wait, I'm open to suggestions. The aim is to minimise any silent
> failures though.
>
> I'd also add that in many cases, it likely won't break at all, it might
> potentially fix something. If there are concerns about this, there are
> extra things we could consider such as requiring layers to mark they've
> been validated for the change. That adds extra complexity, I'm less
> sure about whether we need to do that.
>
> As for your other point, whitespace in shell functions doesn't seem to
> cause real world usability issues in that most people can read a tab
> indented or space indented function equally well. OE-Core is pretty
> consistent about what it uses and always has been, you personally just
> don't like the particular choice made and meta-oe deciding to do
> something else, contra to the TSC doesn't exactly help consistency. You
> could argue meta-oe is more of the problem here.
>

For what it's worth, I use consistent indentation deviating from oe-core in
every layer I maintain as well. Anything else is more hassle than its worth.


> The actual getVar syntax on the other handy is more than cosmetic,
> people don't understand what this "True" they keep adding means, or why
> they need it. You tend to know when you don't want expansion on the
> other hand. So a cleaner syntax which does what the user most likely
> needs is more than cosmetic.


I'd agree with that, passing booleans as arguments sucks all around, since
it loses context. *If* someone is going to do it, it's best to pass it with
the argument name in keyword form in the caller, and obviously we don't
want to do that here.

That said, I'm rather inclined toward thinking about alternative DataSmart
APIs in general, in the long term. For example, it's a MutableMapping, so
it acts dict-like, so we should be able to use .get() and get an expanded
value, and then the case would line up with PEP8 (CamelCase for functions
is frowned upon). I.e. we could have get() and get_unexpanded().
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20160203/159bbc9f/attachment-0002.html>


More information about the bitbake-devel mailing list