Skip to contentSkip to conversation

Use fixed DISTRO_FEATURES for native

PATCH Superseded Jussi Kukkonen 2 participants 11 messages Apr 7, 2017 – Apr 8, 2017

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Use fixed DISTRO_FEATURES for native

Avoid signifant native task churn when DISTRO_FEATURES is changed by defining a fixed DISTRO_FEATURES value (default is "") for native recipes.

The xorg changes are all removals of x11 requirements (that were not real) from recipes that have native versions.

I added a configuration default in bitbake.conf, let me know if this is not a good place.

This seems to work fine (tested multiple different images) but I am not really sure how to test it further... Suggestions are welcome, as are results from autobuilder.

Thanks,
Jussi

The following changes since commit 633ad6c9f436f5d2b6ee1a005b697661a054a394:

oeqa/runtime/utils/targetbuildproject: use parent classes defaults tmpdir (2017-04-06 10:13:39 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib jku/native-distro-features
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=jku/native-distro-features

Jussi Kukkonen (4):
mkfontdir: Remove x11 requirement
mkfontscale: Remove x11 requirement
xorg-font-common.inc: Remove x11 requirement
native.bbclass: Use fixed DISTRO_FEATURES

 meta/classes/native.bbclass                          | 12 ++++++++----
 meta/conf/bitbake.conf                               |  2 ++
 meta/recipes-graphics/xorg-app/mkfontdir_1.0.7.bb    |  4 ++++
 meta/recipes-graphics/xorg-app/mkfontscale_1.1.2.bb  |  3 +++
 meta/recipes-graphics/xorg-font/xorg-font-common.inc |  3 ---
 5 files changed, 17 insertions(+), 7 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/4 mkfontdir: Remove x11 requirement

Build does not need libx11, so also does not need the distro feature.

---
 meta/recipes-graphics/xorg-app/mkfontdir_1.0.7.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-graphics/xorg-app/mkfontdir_1.0.7.bb +4 -0
index a453e24..371d9a1 100644
@@ -11,6 +11,10 @@ files."
 PE = "1"
 PR = "${INC_PR}.0"
 
+# We don't actually need x11 as xorg-app-common claims
+DEPENDS = "util-macros-native"
+REQUIRED_DISTRO_FEATURES = ""
+
 RDEPENDS_${PN} += "mkfontscale"
 RDEPENDS_${PN}_class-native += "mkfontscale-native"
 
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/4 mkfontscale: Remove x11 requirement

In reply to Jussi Kukkonen

Build does not need libx11, so also does not need the distro feature.

---
 meta/recipes-graphics/xorg-app/mkfontscale_1.1.2.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-graphics/xorg-app/mkfontscale_1.1.2.bb +3 -0
index 31cf186..066f4a7 100644
@@ -10,6 +10,9 @@ is used by the mkfontdir program."
 
 DEPENDS = "util-macros-native zlib libfontenc freetype xproto"
 
+# We don't actually need x11 as xorg-app-common claims
+REQUIRED_DISTRO_FEATURES = ""
+
 BBCLASSEXTEND = "native"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=2e0d129d05305176d1a790e0ac1acb7f"
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/4 xorg-font-common.inc: Remove x11 requirement

In reply to Jussi Kukkonen

Remove the fake news about mkfontscale-native needing x11.

---
 meta/recipes-graphics/xorg-font/xorg-font-common.inc | 3 ---
 1 file changed, 3 deletions(-)
meta/recipes-graphics/xorg-font/xorg-font-common.inc +0 -3
index cdbebcf..82a8487 100644
@@ -16,9 +16,6 @@ S = "${WORKDIR}/${XORG_PN}-${PV}"
 
 inherit autotools pkgconfig distro_features_check
 
-# The mkfontscale-native requires x11 in DISTRO_FEATURES
-REQUIRED_DISTRO_FEATURES = "x11"
-
 EXTRA_OEMAKE += "FCCACHE=/bin/true UTIL_DIR=${STAGING_DIR_TARGET}\$\(MAPFILES_PATH\)"
 
 do_install_append() {
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/4 native.bbclass: Use fixed DISTRO_FEATURES

In reply to Jussi Kukkonen

There seems to be no 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 DISTRO_FEATURES to a fixed value for native recipes to avoid the unnecessary tasks: currently the default value is empty.

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".

---
 meta/classes/native.bbclass | 12 ++++++++----
 meta/conf/bitbake.conf      |  2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)
meta/classes/native.bbclass +8 -4
index 1919fbc..fbca4c6 100644
@@ -121,14 +121,18 @@ 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
+    d.setVar("DISTRO_FEATURES", "${NATIVE_DISTRO_FEATURES}")
+
+    classextend = e.data.getVar('BBCLASSEXTEND') or ""
+    if "native" not in classextend:
+        return
+
     def map_dependencies(varname, d, suffix = ""):
         if suffix:
             varname = varname + "_" + suffix
meta/conf/bitbake.conf +2 -0
index 5e98d45..78a3470 100644
@@ -789,6 +789,8 @@ MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
 EXTRA_IMAGE_FEATURES ??= ""
 IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
 
+NATIVE_DISTRO_FEATURES ?= ""
+
 DISTRO_FEATURES_BACKFILL = "pulseaudio sysvinit bluez5 gobject-introspection-data ldconfig"
 MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode"
 
Signature · 1 line
2.1.4
#5 lore raw

Re: [PATCH 4/4] native.bbclass: Use fixed DISTRO_FEATURES

Quoted 66 lines · Jussi Kukkonen

There seems to be no 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 DISTRO_FEATURES to a fixed value for native recipes to avoid the unnecessary tasks: currently the default value is empty.

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".

---
 meta/classes/native.bbclass | 12 ++++++++----
 meta/conf/bitbake.conf      |  2 ++

 2 files changed, 10 insertions(+), 4 deletions(-)
meta/classes/native.bbclass +0 -0
index 1919fbc..fbca4c6 100644
@@ -121,14 +121,18 @@ 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
+    d.setVar("DISTRO_FEATURES", "${NATIVE_DISTRO_FEATURES}")

meta/classes/native.bbclass +5 -0
+
+    classextend = e.data.getVar('BBCLASSEXTEND') or ""
+    if "native" not in classextend:
+        return
+

     def map_dependencies(varname, d, suffix = ""):
         if suffix:
             varname = varname + "_" + suffix

meta/conf/bitbake.conf +0 -0
index 5e98d45..78a3470 100644
@@ -789,6 +789,8 @@ MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""

 EXTRA_IMAGE_FEATURES ??= ""
 IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"

meta/conf/bitbake.conf +2 -0
+NATIVE_DISTRO_FEATURES ?= ""
+
Quoted 3 lines

 DISTRO_FEATURES_BACKFILL = "pulseaudio sysvinit bluez5 gobject- introspection-data ldconfig"
 MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode"

Thanks for working on this, looks good.

Most native variables are called XXX_NATIVE, not NATIVE_XXX so we might want to make this match?

Also, one question. Does this have any effect on qemu-native? Does qemu-native need/use x11 today?

Cheers,

Richard

#6 lore raw

Re: [PATCH 4/4] native.bbclass: Use fixed DISTRO_FEATURES

On 7 April 2017 at 11:28, Richard Purdie <[email protected]

Quoted 75 lines

wrote:

Quoted 67 lines · Jussi Kukkonen

There seems to be no 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 DISTRO_FEATURES to a fixed value for native recipes to avoid the unnecessary tasks: currently the default value is empty.

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".

---
 meta/classes/native.bbclass | 12 ++++++++----
 meta/conf/bitbake.conf      |  2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)
meta/classes/native.bbclass +0 -0
index 1919fbc..fbca4c6 100644
@@ -121,14 +121,18 @@ PATH_prepend = "${COREBASE}/scripts/native-

intercept:"
SSTATE_SCAN_CMD ?= "${SSTATE_SCAN_CMD_NATIVE}"

python native_virtclass_handler () {

meta/classes/native.bbclass +1 -4
-    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

meta/classes/native.bbclass +7 -0
+    # from modifying native distro features
+    d.setVar("DISTRO_FEATURES", "${NATIVE_DISTRO_FEATURES}")
+
+    classextend = e.data.getVar('BBCLASSEXTEND') or ""
+    if "native" not in classextend:
+        return
+
     def map_dependencies(varname, d, suffix = ""):
         if suffix:
             varname = varname + "_" + suffix
meta/conf/bitbake.conf +2 -0
index 5e98d45..78a3470 100644
@@ -789,6 +789,8 @@ MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
 EXTRA_IMAGE_FEATURES ??= ""
 IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
 
+NATIVE_DISTRO_FEATURES ?= ""
+
 DISTRO_FEATURES_BACKFILL = "pulseaudio sysvinit bluez5 gobject-
Quoted 2 lines

introspection-data ldconfig"
MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode"

Thanks for working on this, looks good.

Quoted 3 lines

Most native variables are called XXX_NATIVE, not NATIVE_XXX so we might want to make this match?

Will do.

Quoted 3 lines

Also, one question. Does this have any effect on qemu-native? Does qemu-native need/use x11 today?

qemu itself does not use anything x11 since last year and the default native packageconfig is already not
dependent on distro features.

Now that you mentioned I had a closer look at qemu & SDL:
* qemu-native doesn't build with "sdl" by default, but someone might
change that of course
* If that happens (and libsdl-native is not in ASSUME_PROVIDED), libsdl is
built and by default depends on libx11
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 REQUIRED_DISTRO_FEATURES_class-native for some X libraries for exactly this purpose already.

Jussi

#7 lore raw

Re: [PATCH 4/4] native.bbclass: Use fixed DISTRO_FEATURES

Quoted 90 lines · Jussi Kukkonen
Quoted 77 lines · Richard Purdie
Quoted 3 lines · Jussi Kukkonen

There seems to be no 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

Quoted 5 lines

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

Quoted 4 lines

patch (skipping 135 native tasks). Sadly wall clock time was not affected as glibc remains the bottleneck.

Set DISTRO_FEATURES to a fixed value for native recipes to avoid

the

Quoted 5 lines

unnecessary tasks: currently the default value is empty.

Do the variable setting in native_virtclass_handler() because otherwise
it could still be overridden by appends and the feature

backfilling.

Quoted 49 lines

Shuffle the early returns so DISTRO_FEATURES gets set as long as the packagename ends with "-native".

---
 meta/classes/native.bbclass | 12 ++++++++----
 meta/conf/bitbake.conf      |  2 ++

 2 files changed, 10 insertions(+), 4 deletions(-)
meta/classes/native.bbclass +0 -0
index 1919fbc..fbca4c6 100644
@@ -121,14 +121,18 @@ 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
+    d.setVar("DISTRO_FEATURES", "${NATIVE_DISTRO_FEATURES}")

meta/classes/native.bbclass +5 -0
+
+    classextend = e.data.getVar('BBCLASSEXTEND') or ""
+    if "native" not in classextend:
+        return
+

     def map_dependencies(varname, d, suffix = ""):
         if suffix:
             varname = varname + "_" + suffix

meta/conf/bitbake.conf +0 -0
index 5e98d45..78a3470 100644
@@ -789,6 +789,8 @@ MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""

 EXTRA_IMAGE_FEATURES ??= ""
 IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"

meta/conf/bitbake.conf +2 -0
+NATIVE_DISTRO_FEATURES ?= ""
+
Quoted 3 lines

 DISTRO_FEATURES_BACKFILL = "pulseaudio sysvinit bluez5 gobject- introspection-data ldconfig"
 MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode"

Thanks for working on this, looks good.

Quoted 3 lines

Most native variables are called XXX_NATIVE, not NATIVE_XXX so we might
want to make this match?

Will do.

Quoted 2 lines

Also, one question. Does this have any effect on qemu-native? Does qemu-native need/use x11 today?

qemu itself does not use anything x11 since last year and the default native packageconfig is already not
dependent on distro features.

Quoted 10 lines

Now that you mentioned I had a closer look at qemu & SDL:
 * qemu-native doesn't build with "sdl" by default, but someone might change that of course
 * If that happens (and libsdl-native is not in ASSUME_PROVIDED), libsdl is built and by default depends on libx11
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 REQUIRED_DISTRO_FEATURES_class-native for some X libraries for exactly this purpose already.

Right, we actually have a commented section for sdl and qemu in our local.conf.sample so we do need to test and figure this piece out.

Would we want to put x11 in the default native distro flags to avoid some of the other issues above?

Cheers,

Richard

#8 lore raw

Re: [PATCH 4/4] native.bbclass: Use fixed DISTRO_FEATURES

Quoted 17 lines · Richard Purdie
Quoted 6 lines
Quoted 2 lines

Also, one question. Does this have any effect on qemu-native? Does qemu-native need/use x11 today?

qemu itself does not use anything x11 since last year and the default native packageconfig is already not
dependent on distro features.

Quoted 10 lines

Now that you mentioned I had a closer look at qemu & SDL:
* qemu-native doesn't build with "sdl" by default, but someone might
change that of course
* If that happens (and libsdl-native is not in ASSUME_PROVIDED),
libsdl is built and by default depends on libx11
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 REQUIRED_DISTRO_FEATURES_class-native for some X libraries for exactly this purpose already.

Quoted 5 lines

Right, we actually have a commented section for sdl and qemu in our local.conf.sample so we do need to test and figure this piece out.

Would we want to put x11 in the default native distro flags to avoid some of the other issues above?

I don't see issues that need fixing right now: libx11-native and some other native X libraries build just fine without "x11" feature because of the tweaks I mentioned. So building libsdl-native with "x11" packageconfig works.

Did I miss something else?

Jussi

#9 lore raw
In reply to Jussi Kukkonen
Quoted 7 lines · Jussi Kukkonen

Avoid signifant native task churn when DISTRO_FEATURES is changed by defining a fixed DISTRO_FEATURES value (default is "") for native recipes.

The xorg changes are all removals of x11 requirements (that were not real) from recipes that have native versions.

Quoted 6 lines

I added a configuration default in bitbake.conf, let me know if this is not a good place.

This seems to work fine (tested multiple different images) but I am not really sure how to test it further... Suggestions are welcome, as are results from autobuilder.

Close, but:

https://autobuilder.yocto.io/builders/nightly-no-x11/builds/225/steps/BuildImages/logs/stdio

:/

Cheers,

Richard

#10 lore raw
Quoted 15 lines · Richard Purdie
Quoted 14 lines · Jussi Kukkonen

Avoid signifant native task churn when DISTRO_FEATURES is changed by defining a fixed DISTRO_FEATURES value (default is "") for native
recipes.

The xorg changes are all removals of x11 requirements (that were not
real) from recipes that have native versions.

I added a configuration default in bitbake.conf, let me know if this
is not a good place.

Quoted 8 lines
Quoted 4 lines

This seems to work fine (tested multiple different images) but I am not really sure how to test it further... Suggestions are welcome, as
are results from autobuilder.

Close, but:

https://autobuilder.yocto.io/builders/nightly-no-x11/builds/225/steps
/BuildImages/logs/stdio

and also https://autobuilder.yocto.io/builders/nightly-qa-extras/builds
/218 which I traced back to the api-documentation piece in gtk-doc- native (see PACKAGECONFIG).

Cheers,

Richard