<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 7 April 2017 at 11:28, Richard Purdie <span dir="ltr">&lt;<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Fri, 2017-04-07 at 09:09 +0300, Jussi Kukkonen wrote:<br>
&gt; There seems to be no advantage to letting distro features affect<br>
&gt; native builds. There is a significant disadvantage: a change to<br>
&gt; DISTRO_FEATURES will trigger a lot of unnecessary native tasks. In a<br>
&gt; test like this:<br>
&gt;   $ bitbake core-image-minimal<br>
&gt;   # append &quot; systemd&quot; to DISTRO_FEATURES<br>
&gt;   $ bitbake core-image-minimal<br>
&gt; The latter build takes 44 minutes (28%) of cpu-time less with this<br>
&gt; patch (skipping 135 native tasks). Sadly wall clock time was not<br>
&gt; affected as glibc remains the bottleneck.<br>
&gt;<br>
&gt; Set DISTRO_FEATURES to a fixed value for native recipes to avoid the<br>
&gt; unnecessary tasks: currently the default value is empty.<br>
&gt;<br>
&gt; Do the variable setting in native_virtclass_handler() because<br>
&gt; otherwise<br>
&gt; it could still be overridden by appends and the feature backfilling.<br>
&gt; Shuffle the early returns so DISTRO_FEATURES gets set as long as<br>
&gt; the packagename ends with &quot;-native&quot;.<br>
&gt;<br>
&gt; Signed-off-by: Jussi Kukkonen &lt;<a href="mailto:jussi.kukkonen@intel.com">jussi.kukkonen@intel.com</a>&gt;<br>
&gt; ---<br>
&gt;  meta/classes/native.bbclass | 12 ++++++++----<br>
&gt;  meta/conf/bitbake.conf      |<wbr>  2 ++<br>
&gt;  2 files changed, 10 insertions(+), 4 deletions(-)<br>
&gt;<br>
&gt; diff --git a/meta/classes/native.bbclass<br>
&gt; b/meta/classes/native.bbclass<br>
&gt; index 1919fbc..fbca4c6 100644<br>
&gt; --- a/meta/classes/native.bbclass<br>
&gt; +++ b/meta/classes/native.bbclass<br>
&gt; @@ -121,14 +121,18 @@ PATH_prepend = &quot;${COREBASE}/scripts/native-<br>
&gt; intercept:&quot;<br>
&gt;  SSTATE_SCAN_CMD ?= &quot;${SSTATE_SCAN_CMD_NATIVE}&quot;<br>
&gt;  <br>
&gt;  python native_virtclass_handler () {<br>
&gt; -    classextend = e.data.getVar(&#39;BBCLASSEXTEND&#39;) or &quot;&quot;<br>
&gt; -    if &quot;native&quot; not in classextend:<br>
&gt; -        return<br>
&gt; -<br>
&gt;      pn = e.data.getVar(&quot;PN&quot;)<br>
&gt;      if not pn.endswith(&quot;-native&quot;):<br>
&gt;          return<br>
&gt;  <br>
&gt; +    # Set features here to prevent appends and distro features<br>
&gt; backfill<br>
&gt; +    # from modifying native distro features<br>
&gt; +    d.setVar(&quot;DISTRO_<wbr>FEATURES&quot;, &quot;${NATIVE_DISTRO_FEATURES}&quot;)<br>
&gt; +<br>
&gt; +    classextend = e.data.getVar(&#39;BBCLASSEXTEND&#39;) or &quot;&quot;<br>
&gt; +    if &quot;native&quot; not in classextend:<br>
&gt; +        return<br>
&gt; +<br>
&gt;      def map_dependencies(varname, d, suffix = &quot;&quot;):<br>
&gt;          if suffix:<br>
&gt;              varname = varname + &quot;_&quot; + suffix<br>
&gt; diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf<br>
&gt; index 5e98d45..78a3470 100644<br>
&gt; --- a/meta/conf/bitbake.conf<br>
&gt; +++ b/meta/conf/bitbake.conf<br>
&gt; @@ -789,6 +789,8 @@ MACHINE_ESSENTIAL_EXTRA_<wbr>RRECOMMENDS ?= &quot;&quot;<br>
&gt;  EXTRA_IMAGE_FEATURES ??= &quot;&quot;<br>
&gt;  IMAGE_FEATURES += &quot;${EXTRA_IMAGE_FEATURES}&quot;<br>
&gt;  <br>
&gt; +NATIVE_DISTRO_FEATURES ?= &quot;&quot;<br>
&gt; +<br>
&gt;  DISTRO_FEATURES_BACKFILL = &quot;pulseaudio sysvinit bluez5 gobject-<br>
&gt; introspection-data ldconfig&quot;<br>
&gt;  MACHINE_FEATURES_BACKFILL = &quot;rtc qemu-usermode&quot;<br>
<br>
</div></div>Thanks for working on this, looks good.<br>
<br>
Most native variables are called XXX_NATIVE, not NATIVE_XXX so we might<br>
want to make this match?<br></blockquote><div><br></div><div>Will do.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Also, one question. Does this have any effect on qemu-native? Does<br>
qemu-native need/use x11 today?<br></blockquote><div><br></div><div>qemu itself does not use anything x11 since last year and the default native packageconfig is already not</div><div>dependent on distro features.</div><div><br></div><div>Now that you mentioned I had a closer look at qemu &amp; SDL:</div><div> * qemu-native doesn&#39;t build with &quot;sdl&quot; by default, but someone might change that of course </div><div> * If that happens (and libsdl-native is not in ASSUME_PROVIDED), libsdl is built and by default depends on libx11</div><div>I completely expected this to fail now (without x11 in distro features) but it actually builds just fine. It turns out that a clever Burton has tweaked </div><div>REQUIRED_DISTRO_FEATURES_class-native for some X libraries for exactly this purpose already.<br></div><div><br></div><div><br></div><div>Jussi<br></div></div></div></div>