From: Patrick Ohly <patrick.ohly@intel.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 2/2] utils.py: helper function for optional include files
Date: Thu, 08 Jun 2017 16:36:28 +0200 [thread overview]
Message-ID: <1496932588.30163.135.camel@intel.com> (raw)
In-Reply-To: <1496913653.6630.233.camel@linuxfoundation.org>
On Thu, 2017-06-08 at 10:20 +0100, Richard Purdie wrote:
> On Wed, 2017-06-07 at 17:31 +0200, Patrick Ohly wrote:
> > By using oe.utils.optional_includes(), developers can simplify the
> > code which selects which additional include files need to be included
> > in a .bbappend.
> >
> > In the simple case (one distro feature and one include file) the code
> > is not shorter, but the intent is clearer than corresponding code
> > using bb.utils.contains():
> >
> > require ${@ oe.utils.optional_includes(d, 'foo-feature:bar.inc') }
> >
> > More complex cases are also supported, in particular include files
> > that are required for one of several distro features or multiple
> > different include files.
> >
> > To keep the common use case simple, DISTRO_FEATURES are checked by
> > default. Checking IMAGE_FEATURES might also be useful.
> >
> > The DISTRO_FEATURES default and the intended usage make this more
> > suitable for OE-core than bitbake.
>
> I'm honestly not sure this actually aids readability.
Fair enough.
> Taking your example:
>
> require ${@oe.utils.optional_includes(d, "foo,bar:foo-or-bar.inc xyz:x.inc,y.inc,z.inc")}
>
> I think I actually prefer:
>
> require ${@oe.utils.optional_includes(d, "foo,bar:foo-or-bar.inc")}
> require ${@oe.utils.optional_includes(d, "xyz:x.inc,y.inc,z.inc")}
>
> since its more explict. Spelling this out with the existing syntax
> isn't so bad either, I probably still think that this is clearer too:
>
> require ${@bb.utils.contains(d, "DISTRO_FEATURES", "foo bar", "foo-or-bar.inc", "")}
That's the "foo and bar" case, not "foo or bar". It's an actual mistake
that people have made and that didn't get caught during code review.
> require ${@bb.utils.contains(d, "DISTRO_FEATURES", "xyz", "x.inc y.inc z.inc", "")}
>
> How about simply:
>
> require ${@oe.utils.distro_features(d, "foo bar", "foo-or-bar.inc")}
> require ${@bb.utils.distro_features(d, "xyz", "x.inc y.inc z.inc")}
That works for me, I just wonder about the exact semantic of listing
multiple features: "and" as in contains(), or "any"?
I'm leaning towards two functions where that is explicit:
oe.utils.all_distro_features(d, "foo bar", "foo-and-bar.inc")
oe.utils.any_distro_features(d, "foo bar", "foo-or-bar.inc")
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
next prev parent reply other threads:[~2017-06-08 14:36 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 15:31 [PATCH 0/2] Yocto Compatible 2.0 support code Patrick Ohly
2017-06-07 15:31 ` [PATCH 1/2] bitbake.conf: DISTRO_FEATURES as overrides Patrick Ohly
2017-06-07 16:11 ` Peter Kjellerstedt
2017-06-08 6:04 ` Patrick Ohly
2017-06-08 10:45 ` Richard Purdie
2017-06-08 13:16 ` Peter Kjellerstedt
2017-06-08 14:38 ` Patrick Ohly
2017-06-07 15:31 ` [PATCH 2/2] utils.py: helper function for optional include files Patrick Ohly
2017-06-08 9:20 ` Richard Purdie
2017-06-08 14:36 ` Patrick Ohly [this message]
2017-06-09 10:02 ` Richard Purdie
2017-06-07 15:43 ` [PATCH 0/2] Yocto Compatible 2.0 support code Joshua Watt
2017-06-08 8:56 ` Richard Purdie
2017-06-08 13:55 ` Joshua Watt
2017-06-08 14:33 ` Richard Purdie
2017-06-08 14:48 ` Patrick Ohly
2017-06-08 15:28 ` Joshua Watt
2017-06-08 19:31 ` Patrick Ohly
2017-06-09 8:12 ` Patrick Ohly
2017-06-09 13:47 ` Joshua Watt
2017-06-09 14:11 ` Patrick Ohly
2017-06-09 14:24 ` Patrick Ohly
2017-08-24 9:27 ` Patrick Ohly
2017-06-09 13:50 ` Joshua Watt
2017-06-09 14:04 ` Patrick Ohly
2017-06-09 13:04 ` [PATCH v2 " Patrick Ohly
2017-06-09 13:04 ` [PATCH v2 1/2] bitbake.conf: DISTRO_FEATURES as overrides Patrick Ohly
2017-06-12 19:46 ` Denys Dmytriyenko
2017-06-12 21:05 ` Patrick Ohly
2017-06-12 23:23 ` Denys Dmytriyenko
2017-06-13 7:14 ` Patrick Ohly
2017-06-13 8:06 ` Richard Purdie
2017-06-13 8:31 ` Patrick Ohly
2017-06-14 10:32 ` Patrick Ohly
2017-06-14 10:33 ` [PATCH 1/2] Revert "bitbake.conf: DISTRO_FEATURES as overrides" Patrick Ohly
2017-06-14 10:33 ` [PATCH 2/2] distrooverrides.bbclass: DISTRO_FEATURES as overrides Patrick Ohly
2017-06-09 13:04 ` [PATCH v2 2/2] utils.py: helper function for optional include files Patrick Ohly
2017-06-11 18:47 ` [PATCH v2 0/2] Yocto Compatible 2.0 support code Denys Dmytriyenko
2017-06-12 6:22 ` Patrick Ohly
2017-06-12 15:32 ` Denys Dmytriyenko
2017-06-14 11:01 ` ✗ patchtest: failure for "[v2] bitbake.conf: DISTRO_FEAT..." and 1 more (rev2) Patchwork
2017-06-14 11:01 ` ✗ patchtest: failure for "[v2] bitbake.conf: DISTRO_FEAT..." and 1 more (rev3) Patchwork
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=1496932588.30163.135.camel@intel.com \
--to=patrick.ohly@intel.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.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.