]> code.ossystems Code Review - openembedded-core.git/commitdiff
native/nativesdk: Use fixed DISTRO_FEATURES
authorJussi Kukkonen <jussi.kukkonen@intel.com>
Tue, 11 Apr 2017 14:35:40 +0000 (17:35 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 12 Apr 2017 14:02:13 +0000 (15:02 +0100)
There seems to be little advantage to letting distro features affect
native builds. There is a significant disadvantage: a change to
DISTRO_FEATURES will trigger a lot of unnecessary native tasks. In a
test like this:
  $ bitbake core-image-minimal
  # append " systemd" to DISTRO_FEATURES
  $ bitbake core-image-minimal
The latter build takes 44 minutes (28%) of cpu-time less with this
patch (skipping 135 native tasks). Sadly wall clock time was not
affected as glibc remains the bottleneck.

Set native distro features to DISTRO_FEATURES_NATIVE appended with
an intersection of DISTRO_FEATURES and DISTRO_FEATURES_FILTER_NATIVE.
Current default values (baitbake.conf) are
* DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation" (as gtk-doc-native
has much less dependencies when built without it)
* DISTRO_FEATURES_NATIVE ?= "x11" (to enable native UIs even if target
does not containe them)

Do the variable setting in native_virtclass_handler() because otherwise
it could still be overridden by appends and the feature backfilling.
Shuffle the early returns so DISTRO_FEATURES gets set as long as
the packagename ends with "-native".

Add similar variables for nativesdk.

To make nativesdk work we need to enable the locale options so
nativesdk-glibc-locales can build and to avoid the init manager check
in the nativesdk case so add those fixes.

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/native.bbclass
meta/classes/nativesdk.bbclass
meta/classes/packagegroup.bbclass
meta/conf/bitbake.conf

index 1919fbcdbdeecec8cabbdc5ae7528806766d1be4..aec1087af5d3ba9e012aa358629080d6b706c239 100644 (file)
@@ -121,14 +121,20 @@ PATH_prepend = "${COREBASE}/scripts/native-intercept:"
 SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"
 
 python native_virtclass_handler () {
-    classextend = e.data.getVar('BBCLASSEXTEND') or ""
-    if "native" not in classextend:
-        return
-
     pn = e.data.getVar("PN")
     if not pn.endswith("-native"):
         return
 
+    # Set features here to prevent appends and distro features backfill
+    # from modifying native distro features
+    features = set(d.getVar("DISTRO_FEATURES_NATIVE").split())
+    filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVE"), d).split())
+    d.setVar("DISTRO_FEATURES", " ".join(features | filtered))
+
+    classextend = e.data.getVar('BBCLASSEXTEND') or ""
+    if "native" not in classextend:
+        return
+
     def map_dependencies(varname, d, suffix = ""):
         if suffix:
             varname = varname + "_" + suffix
index ebcfb2df24d5ae43ed3924accfbe7f72727fa1bb..655b4560e7ccf4547beee8717ca04e1b58ad66ef 100644 (file)
@@ -70,6 +70,12 @@ python nativesdk_virtclass_handler () {
     if not (pn.endswith("-nativesdk") or pn.startswith("nativesdk-")):
         return
 
+    # Set features here to prevent appends and distro features backfill
+    # from modifying nativesdk distro features
+    features = set(d.getVar("DISTRO_FEATURES_NATIVESDK").split())
+    filtered = set(bb.utils.filter("DISTRO_FEATURES", d.getVar("DISTRO_FEATURES_FILTER_NATIVESDK"), d).split())
+    d.setVar("DISTRO_FEATURES", " ".join(features | filtered))
+
     e.data.setVar("MLPREFIX", "nativesdk-")
     e.data.setVar("PN", "nativesdk-" + e.data.getVar("PN").replace("-nativesdk", "").replace("nativesdk-", ""))
     e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-nativesdk")
index 4af4a014b0a7b08c18bed42c38412147906d474a..eea2e5b9fcfcc41a783782aeb8de5fcacec46bc9 100644 (file)
@@ -49,6 +49,8 @@ deltask do_install
 deltask do_populate_sysroot
 
 python () {
+    if bb.data.inherits_class('nativesdk', d):
+        return
     initman = d.getVar("VIRTUAL-RUNTIME_init_manager")
     if initman and initman in ['sysvinit', 'systemd'] and not bb.utils.contains('DISTRO_FEATURES', initman, True, False, d):
         bb.fatal("Please ensure that your setting of VIRTUAL-RUNTIME_init_manager (%s) matches the entries enabled in DISTRO_FEATURES" % initman)
index 5e98d4511f505ef6d95ed12f78752cf0d6bd6c57..af3937a48ece64483abbaf2a19d25340aa00935f 100644 (file)
@@ -789,6 +789,16 @@ MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
 EXTRA_IMAGE_FEATURES ??= ""
 IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
 
+# Native distro features (will always be used for -native, even if they
+# are not enabled for target)
+DISTRO_FEATURES_NATIVE ?= "x11"
+DISTRO_FEATURES_NATIVESDK ?= "x11 libc-charsets libc-locales libc-locale-code"
+
+# Normally target distro features will not be applied to native builds:
+# Native distro features on this list will use the target feature value
+DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation"
+DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation"
+
 DISTRO_FEATURES_BACKFILL = "pulseaudio sysvinit bluez5 gobject-introspection-data ldconfig"
 MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode"