> Thanks for the suggestion. As you mentioned already that you see
> potential to re-model and unify existing public layers with such a
> proposal, how about laying out how those would look like? Would make
> this discussion a bit more concrete, specifically for those of us not so
> long into OE like you are.
Greetings,
Thanks for all the replies to this, I appreciate the input. I'll start
by considering OE/Yocto's usage of features, options for how to
emphasize their use in isar, my personal recommendation for how to
proceed, and finally look into what the usage would look like in a
specific downstream example as suggested
To update the status on this, I've been working on a more concrete
proposal to follow-up on the email discussion, as was requested, but
it's not entirely clear as to the best approach. I feel like these are
likely the main options:
1. Do nothing, features can be implemented by downstream layers.
2. Ease use of features by downstream layers, potentially by
creating wrapper functions, or at the least default definitions of the
features variables, and specifically COMBINED_FEATURES.
3. Enforce more structure on features usage such as through
inclusion of .inc or .bbclass files the way we have for features in our
layer and cip has for image options.
OE/Yocto largely does the second, defining default values, and then
using features in multiple places within the layer. They also provide a
bbclass to require distro features for a given recipe, and an optional
bbclass to ease use of features through overrides, and the
packagegroup-base recipe which does not apply for us. Of course, we also
don't intend to leverage the features within isar itself at this time
the way oe-core does.
Wrapper functions tend to be avoided, in large part due to signature
generation. BitBake's checksum generation for task signatures involves
tracking variable dependencies and usage, and has special handling for
bb.utils.contains(), which allows a variable to depend on the presence
or absence of a feature from a features variable, without becoming
dependent on the entirety of the features variable. Wrapping this
function to ease calls would both be an added indirection that I feel
adds an unnecessary abstraction to gain that slight ease of use, it will
also prevent the signature generation from tracking feature usage fully.
I also feel that inclusion of a .inc or .bbclass for each feature is
rather indirect, and doesn't align with how isar uses rootfs_features
via a single bbclass extension for multiple features. I think this may
be done by some downstreams, but is a tad too indirect for isar as a
core layer.
To sum up, I feel that this proposal is largely to encourage the use of
features variables and to add to the isar documentation to encourage
their use, more than much direct implementation code. I'd think the
following would be a good start:
1. Add default DISTRO_FEATURES, MACHINE_FEATURES, COMBINED_FEATURES
values, even if the first two are empty by default, and the latter
should use inline python to ensure it's the intersection of the first two.
2. Add to the docs to encourage use of the features variables, and
specifically the use of bb.utils.contains, bb.utils.contains_any, and
bb.utils.filter, to do so.
3. Add a test using features to the test suite.
4. Consider adding a class to ease use of features with overrides,
as this can be helpful when defining many variables which are
conditional on a feature. This should reduce the perceived need for
feature-based file inclusion, I believe. distrooverrides.bbclass in
oe-core or featureoverrides in sokol-flex could be candidate options to
consider as a starting point.
As possible options for downstream layers to use features rather than
custom solutions, we can consider possibilities for CIP_IMAGE_OPTIONS.
Rather than isar-cip-core's CIP_IMAGE_OPTIONS listing .inc files to
include, it could add an image extension bbclass which directly defines
the variables based on ROOTFS_FEATURES or IMAGE_FEATURES, or it could
keep the .inc inclusion and do so based on the features rather than a
new variable. The main benefit there would be consistency rather than
any other concrete benefit, however.
The benefit of the use of distro and machine I believe would aid in
making the distro and machine less tightly bound, which should ease long
term maintenance of the downstream layers, but this is difficult to show
in a trivial example. I'll look into one of the public downstreams to
try a PR as a suggested example.