Skip to contentSkip to conversation

insane.bbclass: Trigger unrecognzed configure option for meson

PATCH In review Andreas Müller 2 participants 4 messages Apr 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 insane.bbclass: Trigger unrecognzed configure option for meson

Tested with 'unknown-configure-option' in ERROR_QA:

For meson (glib-2.0-native):
1. add 'EXTRA_OEMESON_append = "-Dschnitzel=true -Dwurst=true"'
| ERROR: glib-2.0-native-1_2.58.3-r0 do_configure: QA Issue: glib-2.0-native: configure was passed unrecognised options: schnitzel wurst [unknown-configure-option]
2. add 'UNKNOWN_CONFIGURE_WHITELIST_append=" schnitzel"'
| ERROR: glib-2.0-native-1_2.58.3-r0 do_configure: QA Issue: glib-2.0-native: configure was passed unrecognised options: wurst [unknown-configure-option]
3. change to 'UNKNOWN_CONFIGURE_WHITELIST_append=" schnitzel wurst"'
=> builds without issues

For autotools (readline-native):
1. add 'EXTRA_OECONF = "--with-schnitzel --with-wurst"'
| ERROR: readline-native-8.0-r0 do_configure: QA Issue: readline-native: configure was passed unrecognised options: --with-wurst --with-schnitzel [unknown-configure-option]
2. add 'UNKNOWN_CONFIGURE_WHITELIST_append=" --with-schnitzel"'
| ERROR: readline-native-8.0-r0 do_configure: QA Issue: readline-native: configure was passed unrecognised options: --with-wurst [unknown-configure-option]
3. add 'UNKNOWN_CONFIGURE_WHITELIST_append=" --with-schnitzel --with-wurst"'
=> builds without issues

---
 meta/classes/insane.bbclass | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
meta/classes/insane.bbclass +8 -4
index 37b8bb0032..c8d18c07f5 100644
@@ -1093,12 +1093,16 @@ Rerun configure task after fixing this."""
     ###########################################################################
     # Check unrecognised configure options (with a white list)
     ###########################################################################
-    if bb.data.inherits_class("autotools", d):
+    if bb.data.inherits_class("autotools", d) or bb.data.inherits_class("meson", d):
         bb.note("Checking configure output for unrecognised options")
         try:
-            flag = "WARNING: unrecognized options:"
-            log = os.path.join(d.getVar('B'), 'config.log')
-            output = subprocess.check_output(['grep', '-F', flag, log]).decode("utf-8").replace(', ', ' ')
+            if bb.data.inherits_class("autotools", d):
+                flag = "WARNING: unrecognized options:"
+                log = os.path.join(d.getVar('B'), 'config.log')
+            if bb.data.inherits_class("meson", d):
+                flag = "WARNING: Unknown options:"
+                log = os.path.join(d.getVar('T'), 'log.do_configure')
+            output = subprocess.check_output(['grep', '-F', flag, log]).decode("utf-8").replace(', ', ' ').replace('"', '')
             options = set()
             for line in output.splitlines():
                 options |= set(line.partition(flag)[2].split())
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 gobject-introspection: auto-enable/-disable gobject-introspection for meson

---
 meta/classes/gobject-introspection.bbclass | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
meta/classes/gobject-introspection.bbclass +8 -1
index 4ceb0c68b1..968792c0b3 100644
@@ -6,14 +6,21 @@
 # This also sets up autoconf-based recipes to build introspection data (or not),
 # depending on distro and machine features (see gobject-introspection-data class).
 inherit python3native gobject-introspection-data
+
+# Auto enable/disable based on GI_DATA_ENABLED
 EXTRA_OECONF_prepend_class-target = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection', '--disable-introspection', d)} "
+EXTRA_OEMESON_prepend_class-target = "-Dintrospection=${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'true', 'false', d)} "
 
 # When building native recipes, disable introspection, as it is not necessary,
 # pulls in additional dependencies, and makes build times longer
 EXTRA_OECONF_prepend_class-native = "--disable-introspection "
 EXTRA_OECONF_prepend_class-nativesdk = "--disable-introspection "
+EXTRA_OEMESON_prepend_class-native = "-Dintrospection=False "
+EXTRA_OEMESON_prepend_class-nativesdk = "-Dintrospection=False "
 
-UNKNOWN_CONFIGURE_WHITELIST_append = " --enable-introspection --disable-introspection"
+# Avoid triggering configure QA
+UNKNOWN_CONFIGURE_WHITELIST_append = " ${@["", "--enable-introspection --disable-introspection"][(bb.data.inherits_class('autotools', d))]}"
+UNKNOWN_CONFIGURE_WHITELIST_append = " ${@["", "introspection"][(bb.data.inherits_class('meson', d))]}"
 
 # Generating introspection data depends on a combination of native and target
 # introspection tools, and qemu to run the target tools.
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH 2/2] gobject-introspection: auto-enable/-disable gobject-introspection for meson

meta/classes/gobject-introspection.bbclass line 19

Quoted 3 lines · Andreas Müller
meta/classes/gobject-introspection.bbclass +3 -0
+EXTRA_OEMESON_prepend_class-target = "-Dintrospection=${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'true', 'false', d)} "
+EXTRA_OEMESON_prepend_class-native = "-Dintrospection=False "
+EXTRA_OEMESON_prepend_class-nativesdk = "-Dintrospection=False "

Sadly, unlike autotools where the option name comes from a common m4 macro, this is not going to work with meson. There is no common ground between upstreams on how to name this option, and so you get 'gir', 'with_introspection' and anything in between.

A better approach would be to introduce a variable:

GIR_MESON_OPTION ?= 'introspection'

and override it in recipes as needed.

Alex

Alex

#3 lore raw

Re: [PATCH 2/2] gobject-introspection: auto-enable/-disable gobject-introspection for meson

Quoted 11 lines · Alexander Kanavin

meta/classes/gobject-introspection.bbclass line 19

Quoted 3 lines · Andreas Müller
meta/classes/gobject-introspection.bbclass +3 -0
+EXTRA_OEMESON_prepend_class-target = "-Dintrospection=${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'true', 'false', d)} "
+EXTRA_OEMESON_prepend_class-native = "-Dintrospection=False "
+EXTRA_OEMESON_prepend_class-nativesdk = "-Dintrospection=False "

Sadly, unlike autotools where the option name comes from a common m4 macro, this is not going to work with meson. There is no common ground between upstreams on how to name this option, and so you get 'gir', 'with_introspection' and anything in between.

Quoted 6 lines

A better approach would be to introduce a variable:

GIR_MESON_OPTION ?= 'introspection'

and override it in recipes as needed.

Had an initial version like this - but shelved (or lost) the idea somehow.

Agreed: V2 will follow.

Andreas