[oe-commits] [openembedded-core] 03/14: meson: validate cpu_family

git at git.openembedded.org git at git.openembedded.org
Tue Jul 3 23:06:02 UTC 2018


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 967de57de4f0fd853463ea24963aef8516e3bce0
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Tue Jul 3 14:04:11 2018 +0100

    meson: validate cpu_family
    
    Meson has a defined list of known CPU families but these are not currently
    validated, so mistakes in cross files or new architectures are not noticed.
    
    Backport a patch from upstream which warns on unknown architectures, but tweak
    it to fatally error instead.  When we upgrade to Meson 0.47 the first half of
    this patch can be dropped.
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/recipes-devtools/meson/meson.inc              |   1 +
 .../meson/meson/validate-cpu.patch                 | 118 +++++++++++++++++++++
 2 files changed, 119 insertions(+)

diff --git a/meta/recipes-devtools/meson/meson.inc b/meta/recipes-devtools/meson/meson.inc
index 4c113dc..b278d33 100644
--- a/meta/recipes-devtools/meson/meson.inc
+++ b/meta/recipes-devtools/meson/meson.inc
@@ -11,6 +11,7 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P
            file://0003-native_bindir.patch \
            file://0004-Prettifying-some-output-with-pathlib.patch \
            file://0005-Set-the-meson-command-to-use-when-we-know-what-it-is.patch \
+           file://validate-cpu.patch \
            "
 
 SRC_URI[md5sum] = "1698f6526574839de5dcdc45e3f7d582"
diff --git a/meta/recipes-devtools/meson/meson/validate-cpu.patch b/meta/recipes-devtools/meson/meson/validate-cpu.patch
new file mode 100644
index 0000000..8bdb204
--- /dev/null
+++ b/meta/recipes-devtools/meson/meson/validate-cpu.patch
@@ -0,0 +1,118 @@
+Validate the passed CPU family (US: backport) and turn the upstream warning to
+an error (US: inappropriate).
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton at intel.com>
+
+From 456f7ea48503731d50a2b7287a0f198b73b4fe61 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross at burtonini.com>
+Date: Wed, 20 Jun 2018 13:45:44 +0100
+Subject: [PATCH 1/2] Validate cpu_family (#3753)
+
+* environment: validate cpu_family in cross file
+
+* run_unittests: add unittest to ensure CPU family list in docs and environment matches
+
+* run_unittests: skip compiler options test if not in a git repository
+
+* environment: validate the detected cpu_family
+
+* docs: add 32-bit PowerPC and 32/64-bit MIPS to CPU Families table
+
+Names gathered by booting Linux in Qemu and running:
+
+$ python3
+import platform; platform.machine()
+
+Partial fix for #3751
+---
+ mesonbuild/environment.py | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
+index 6920b8d6..091d92dc 100644
+--- a/mesonbuild/environment.py
++++ b/mesonbuild/environment.py
+@@ -72,6 +72,22 @@ from .compilers import (
+ 
+ build_filename = 'meson.build'
+ 
++known_cpu_families = (
++    'aarch64',
++    'arm',
++    'e2k',
++    'ia64',
++    'mips',
++    'mips64',
++    'parisc',
++    'ppc',
++    'ppc64',
++    'ppc64le',
++    'sparc64',
++    'x86',
++    'x86_64'
++)
++
+ # Environment variables that each lang uses.
+ cflags_mapping = {'c': 'CFLAGS',
+                   'cpp': 'CXXFLAGS',
+@@ -210,6 +226,10 @@ def detect_cpu_family(compilers):
+                 pass
+         return 'x86_64'
+     # Add fixes here as bugs are reported.
++
++    if trial not in known_cpu_families:
++        mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
++
+     return trial
+ 
+ def detect_cpu(compilers):
+@@ -1021,6 +1041,10 @@ class CrossBuildInfo:
+                     res = eval(value, {'__builtins__': None}, {'true': True, 'false': False})
+                 except Exception:
+                     raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
++
++                if entry == 'cpu_family' and res not in known_cpu_families:
++                    mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value)
++
+                 if self.ok_type(res):
+                     self.config[s][entry] = res
+                 elif isinstance(res, list):
+-- 
+2.11.0
+
+
+From 202e0199d3ffd2637f4dbee08f8351520f7dde3b Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton at intel.com>
+Date: Tue, 3 Jul 2018 13:59:09 +0100
+Subject: [PATCH 2/2] Make CPU family warnings fatal
+
+---
+ mesonbuild/environment.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
+index 091d92dc..67177c1f 100644
+--- a/mesonbuild/environment.py
++++ b/mesonbuild/environment.py
+@@ -228,7 +228,7 @@ def detect_cpu_family(compilers):
+     # Add fixes here as bugs are reported.
+ 
+     if trial not in known_cpu_families:
+-        mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
++        raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
+ 
+     return trial
+ 
+@@ -1043,7 +1043,7 @@ class CrossBuildInfo:
+                     raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
+ 
+                 if entry == 'cpu_family' and res not in known_cpu_families:
+-                    mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value)
++                    raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value)
+ 
+                 if self.ok_type(res):
+                     self.config[s][entry] = res
+-- 
+2.11.0
+

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


More information about the Openembedded-commits mailing list