Currently a change in DISTRO_FEATURES means we end up rebuilding a bunch native recipes. So far I have not found a single feature where this would be useful: maybe we can just define a constant set of features that will always be used for -native? I'm looking at this next week, filing now as reminder. For background, here's a list of distro features we refer to in oe-core (possibly not 100% exhaustive). Most of the libc- ones should probably be removed: none of our libcs respect those. --- 3g acl alsa api-documentation argp bluetooth bluez5 bssplt cramfs directfb efi ext2 gobject-introspection-data ipsec ipv4 ipv6 irda largefile ldconfig ld-is-gold libc-backtrace libc-big-macros libc-bsd libc-catgets libc-charsets libc-crypt libc-crypt-ufc libc-cxx-tests libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse libc-getlogin libc-idn libc-inet libc-inet-anl libc-libm libc-locale-code libc-locales libc-memusage libc-nis libc-nsswitch libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc libc-posix-wchar-io libc-rcmd libc-rtld-debug libc-spawn libc-streams libc-sunrpc libc-utmp libc-utmpx libc-wordexp mplt multiarch nfc nfs nls opengl pam pci pcmcia ppp ptest pulseaudio selinux smbfs systemd sysvinit usbgadget usbhost wayland wifi x11 xattr zeroconf
I think the main one we might care about in the native case is largefile which we'd always want turn on and we're likely deprecating anyway (in favour of always enabled). I can't see much of a case for not fixing the native list of features. I also agree that the libc ones are pretty much dead now.
This really stretches my understanding of bitbake variables... documenting some details: My initial approach is just to modify DISTRO_FEATURES (and if needed other variables) in native.bbclass. This turned out to be tricky: * DISTRO_FEATURES = "<features we want for native>" This will be overriden by at least DISTRO_FEATURES_append in any configuration as well as DISTRO_FEATURES_BACKFILL. This makes sense to me. * DISTRO_FEATURES_forcevariable = "<features we want for native>" Same results -- appends and backfill still get added to the list. I don't really understand why. * anonymous python with d.setVar("DISTRO_FEATURES", "<features we want for native>") This is so ugly but does ensure DISTRO_FEATURES is correct when tasks run. Unfortunately there are other anonymous python functions that do d.getVar("DISTRO_FEATURES") and end up getting the wrong value and modifying the build based on that.
On Richards suggestion I tried d.SetVar() in native_virtclass_handler(): this seems to work. My test case was: $ bitbake core-image-minimal # append " systemd" to DISTRO_FEATURES $ bitbake core-image-minimal With a native_virtclass_handler patch the second build had 135 tasks less to do. Sadly this doesn't show up in wallclock time: all the native tasks are done while glibc is still bottlenecking everything else. I'm sure there is a effect on cpu-time, I just didn't take note of it.
I redid the tests with timing: $ bitbake core-image-minimal # append " systemd" to DISTRO_FEATURES $ bitbake core-image-minimal With master the second build was: real 15m23.533s user 135m19.244s sys 16m55.816s After patching: real 14m48.574s user 94m31.776s sys 13m54.560s user+sys difference is -44 minutes or -28% so definitely worth it.
oe-core 731744d5538e315702be828e6f2bd556309dee07 solves this for DISTRO_FEATURES. oe-core 96c20c9df714cdf3f0e9461ec566c4f5d3bdb5f1 solves the native case for MACHINE_FEATURES.
I *think* we're done with this. Closing!