[oe-commits] [openembedded-core] 09/09: meson.bbclass: warn if cross property defaults are used

git at git.openembedded.org git at git.openembedded.org
Mon Jan 6 23:55:26 UTC 2020


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit ddd064679425ae06fc348f007290df8f008024b2
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Fri Jan 3 18:09:14 2020 +0000

    meson.bbclass: warn if cross property defaults are used
    
    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 at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/meson.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index 71f9de1..6a3c0c5 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -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}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list