summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-07-03 14:04:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-05 00:22:08 +0100
commite03660f46effd31fe61af28cb26a016b49ee58db (patch)
tree1f61b40a3d8fd0fbaf165561074f4ba84e782904 /meta/recipes-devtools
parent5193aedb458d4db1e851906087ac890fd1abfbd7 (diff)
downloadpoky-e03660f46effd31fe61af28cb26a016b49ee58db.tar.gz
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. (From OE-Core rev: be194a459944dfcc41bae7315643a5d284683efc) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/meson/meson.inc1
-rw-r--r--meta/recipes-devtools/meson/meson/validate-cpu.patch118
2 files changed, 119 insertions, 0 deletions
diff --git a/meta/recipes-devtools/meson/meson.inc b/meta/recipes-devtools/meson/meson.inc
index 4c113dcaf7..b278d33b72 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
11 file://0003-native_bindir.patch \ 11 file://0003-native_bindir.patch \
12 file://0004-Prettifying-some-output-with-pathlib.patch \ 12 file://0004-Prettifying-some-output-with-pathlib.patch \
13 file://0005-Set-the-meson-command-to-use-when-we-know-what-it-is.patch \ 13 file://0005-Set-the-meson-command-to-use-when-we-know-what-it-is.patch \
14 file://validate-cpu.patch \
14 " 15 "
15 16
16SRC_URI[md5sum] = "1698f6526574839de5dcdc45e3f7d582" 17SRC_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 0000000000..8bdb204ab0
--- /dev/null
+++ b/meta/recipes-devtools/meson/meson/validate-cpu.patch
@@ -0,0 +1,118 @@
1Validate the passed CPU family (US: backport) and turn the upstream warning to
2an error (US: inappropriate).
3
4Upstream-Status: Backport
5Signed-off-by: Ross Burton <ross.burton@intel.com>
6
7From 456f7ea48503731d50a2b7287a0f198b73b4fe61 Mon Sep 17 00:00:00 2001
8From: Ross Burton <ross@burtonini.com>
9Date: Wed, 20 Jun 2018 13:45:44 +0100
10Subject: [PATCH 1/2] Validate cpu_family (#3753)
11
12* environment: validate cpu_family in cross file
13
14* run_unittests: add unittest to ensure CPU family list in docs and environment matches
15
16* run_unittests: skip compiler options test if not in a git repository
17
18* environment: validate the detected cpu_family
19
20* docs: add 32-bit PowerPC and 32/64-bit MIPS to CPU Families table
21
22Names gathered by booting Linux in Qemu and running:
23
24$ python3
25import platform; platform.machine()
26
27Partial fix for #3751
28---
29 mesonbuild/environment.py | 24 ++++++++++++++++++++++++
30 1 file changed, 24 insertions(+)
31
32diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
33index 6920b8d6..091d92dc 100644
34--- a/mesonbuild/environment.py
35+++ b/mesonbuild/environment.py
36@@ -72,6 +72,22 @@ from .compilers import (
37
38 build_filename = 'meson.build'
39
40+known_cpu_families = (
41+ 'aarch64',
42+ 'arm',
43+ 'e2k',
44+ 'ia64',
45+ 'mips',
46+ 'mips64',
47+ 'parisc',
48+ 'ppc',
49+ 'ppc64',
50+ 'ppc64le',
51+ 'sparc64',
52+ 'x86',
53+ 'x86_64'
54+)
55+
56 # Environment variables that each lang uses.
57 cflags_mapping = {'c': 'CFLAGS',
58 'cpp': 'CXXFLAGS',
59@@ -210,6 +226,10 @@ def detect_cpu_family(compilers):
60 pass
61 return 'x86_64'
62 # Add fixes here as bugs are reported.
63+
64+ if trial not in known_cpu_families:
65+ mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
66+
67 return trial
68
69 def detect_cpu(compilers):
70@@ -1021,6 +1041,10 @@ class CrossBuildInfo:
71 res = eval(value, {'__builtins__': None}, {'true': True, 'false': False})
72 except Exception:
73 raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
74+
75+ if entry == 'cpu_family' and res not in known_cpu_families:
76+ mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value)
77+
78 if self.ok_type(res):
79 self.config[s][entry] = res
80 elif isinstance(res, list):
81--
822.11.0
83
84
85From 202e0199d3ffd2637f4dbee08f8351520f7dde3b Mon Sep 17 00:00:00 2001
86From: Ross Burton <ross.burton@intel.com>
87Date: Tue, 3 Jul 2018 13:59:09 +0100
88Subject: [PATCH 2/2] Make CPU family warnings fatal
89
90---
91 mesonbuild/environment.py | 4 ++--
92 1 file changed, 2 insertions(+), 2 deletions(-)
93
94diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
95index 091d92dc..67177c1f 100644
96--- a/mesonbuild/environment.py
97+++ b/mesonbuild/environment.py
98@@ -228,7 +228,7 @@ def detect_cpu_family(compilers):
99 # Add fixes here as bugs are reported.
100
101 if trial not in known_cpu_families:
102- mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
103+ raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
104
105 return trial
106
107@@ -1043,7 +1043,7 @@ class CrossBuildInfo:
108 raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
109
110 if entry == 'cpu_family' and res not in known_cpu_families:
111- mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value)
112+ raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value)
113
114 if self.ok_type(res):
115 self.config[s][entry] = res
116--
1172.11.0
118