]> code.ossystems Code Review - openembedded-core.git/commitdiff
meson.bbclass: warn if cross property defaults are used
authorRoss Burton <ross.burton@intel.com>
Wed, 13 Mar 2019 00:37:33 +0000 (00:37 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 27 Jan 2020 16:38:54 +0000 (16:38 +0000)
The Meson idiom for checks which require running code on the target
(which isn't possible in cross compilation) is to use a cross property,
which the user can set in the cross file:

if cc_can_run
  rres = cc.run(test_foo_code)
  have_foo = rres.compiled() and rres.returncode() == 0
else
  have_foo = meson.get_cross_property('have_foo', false)
endif

The default value may be overly conservative so we should review every
property and explicitly set them as apppropriate.  oe-core 669ddaf added
a log message when the default value is used, so look for this message
and emit a warning that the user will see.

Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/meson.bbclass

index 1ef34a999c871168c7d0c8ca055ce20ec0bdb7b8..9c3673ea4215e6cdfc047463b47945530a4e3bd9 100644 (file)
@@ -158,6 +158,15 @@ meson_do_configure_prepend_class-native() {
     export PKG_CONFIG="pkg-config-native"
 }
 
+python meson_do_qa_configure() {
+    import re
+    warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value (.+)$", re.MULTILINE)
+    log = open(d.expand("${B}/meson-logs/meson-log.txt")).read()
+    for (prop, value) in warn_re.findall(log):
+        bb.warn("Meson cross property %s used without explicit assignment, defaulting to %s" % (prop, value))
+}
+do_configure[postfuncs] += "meson_do_qa_configure"
+
 do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
 meson_do_compile() {
     ninja -v ${PARALLEL_MAKE}