1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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@intel.com>
From 456f7ea48503731d50a2b7287a0f198b73b4fe61 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross@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@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, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % 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, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % value)
if self.ok_type(res):
self.config[s][entry] = res
--
2.11.0
|