diff options
Diffstat (limited to 'meta/recipes-devtools/meson/meson/0001-Validate-cpu_family-3753.patch')
-rw-r--r-- | meta/recipes-devtools/meson/meson/0001-Validate-cpu_family-3753.patch | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/meta/recipes-devtools/meson/meson/0001-Validate-cpu_family-3753.patch b/meta/recipes-devtools/meson/meson/0001-Validate-cpu_family-3753.patch deleted file mode 100644 index 6b0d0ca588..0000000000 --- a/meta/recipes-devtools/meson/meson/0001-Validate-cpu_family-3753.patch +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | From 12fe95b1943eb832a54ba09274fa02c60d04f6b0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ross Burton <ross@burtonini.com> | ||
3 | Date: Wed, 20 Jun 2018 13:45:44 +0100 | ||
4 | Subject: [PATCH 1/3] Validate cpu_family (#3753) | ||
5 | |||
6 | * environment: validate cpu_family in cross file | ||
7 | |||
8 | * run_unittests: add unittest to ensure CPU family list in docs and environment matches | ||
9 | |||
10 | * run_unittests: skip compiler options test if not in a git repository | ||
11 | |||
12 | * environment: validate the detected cpu_family | ||
13 | |||
14 | * docs: add 32-bit PowerPC and 32/64-bit MIPS to CPU Families table | ||
15 | |||
16 | Names gathered by booting Linux in Qemu and running: | ||
17 | |||
18 | $ python3 | ||
19 | import platform; platform.machine() | ||
20 | |||
21 | Partial fix for #3751 | ||
22 | |||
23 | Upstream-Status: Backport | ||
24 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
25 | --- | ||
26 | mesonbuild/environment.py | 24 ++++++++++++++++++++++++ | ||
27 | run_unittests.py | 18 ++++++++++++++++++ | ||
28 | 2 files changed, 42 insertions(+) | ||
29 | |||
30 | diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py | ||
31 | index d02a837..678d009 100644 | ||
32 | --- a/mesonbuild/environment.py | ||
33 | +++ b/mesonbuild/environment.py | ||
34 | @@ -72,6 +72,22 @@ from .compilers import ( | ||
35 | |||
36 | build_filename = 'meson.build' | ||
37 | |||
38 | +known_cpu_families = ( | ||
39 | + 'aarch64', | ||
40 | + 'arm', | ||
41 | + 'e2k', | ||
42 | + 'ia64', | ||
43 | + 'mips', | ||
44 | + 'mips64', | ||
45 | + 'parisc', | ||
46 | + 'ppc', | ||
47 | + 'ppc64', | ||
48 | + 'ppc64le', | ||
49 | + 'sparc64', | ||
50 | + 'x86', | ||
51 | + 'x86_64' | ||
52 | +) | ||
53 | + | ||
54 | # Environment variables that each lang uses. | ||
55 | cflags_mapping = {'c': 'CFLAGS', | ||
56 | 'cpp': 'CXXFLAGS', | ||
57 | @@ -210,6 +226,10 @@ def detect_cpu_family(compilers): | ||
58 | pass | ||
59 | return 'x86_64' | ||
60 | # Add fixes here as bugs are reported. | ||
61 | + | ||
62 | + if trial not in known_cpu_families: | ||
63 | + mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial) | ||
64 | + | ||
65 | return trial | ||
66 | |||
67 | def detect_cpu(compilers): | ||
68 | @@ -1021,6 +1041,10 @@ class CrossBuildInfo: | ||
69 | res = eval(value, {'__builtins__': None}, {'true': True, 'false': False}) | ||
70 | except Exception: | ||
71 | raise EnvironmentException('Malformed value in cross file variable %s.' % entry) | ||
72 | + | ||
73 | + if entry == 'cpu_family' and res not in known_cpu_families: | ||
74 | + mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value) | ||
75 | + | ||
76 | if self.ok_type(res): | ||
77 | self.config[s][entry] = res | ||
78 | elif isinstance(res, list): | ||
79 | diff --git a/run_unittests.py b/run_unittests.py | ||
80 | index 3c215db..7185008 100755 | ||
81 | --- a/run_unittests.py | ||
82 | +++ b/run_unittests.py | ||
83 | @@ -2065,6 +2065,24 @@ recommended as it can lead to undefined behaviour on some platforms''') | ||
84 | self.wipe() | ||
85 | |||
86 | |||
87 | + @unittest.skipIf(not os.path.isdir('docs'), 'Doc dir not found, presumably because this is a tarball release.') | ||
88 | + def test_cpu_families_documented(self): | ||
89 | + with open("docs/markdown/Reference-tables.md") as f: | ||
90 | + md = f.read() | ||
91 | + self.assertIsNotNone(md) | ||
92 | + | ||
93 | + sections = list(re.finditer(r"^## (.+)$", md, re.MULTILINE)) | ||
94 | + for s1, s2 in zip(sections[::2], sections[1::2]): | ||
95 | + if s1.group(1) == "CPU families": | ||
96 | + # Extract the content for this section | ||
97 | + content = md[s1.end():s2.start()] | ||
98 | + # Find the list entries | ||
99 | + arches = [m.group(1) for m in re.finditer(r"^\| (\w+) +\|", content, re.MULTILINE)] | ||
100 | + # Drop the header | ||
101 | + arches = set(arches[1:]) | ||
102 | + self.assertEqual(arches, set(mesonbuild.environment.known_cpu_families)) | ||
103 | + | ||
104 | + | ||
105 | class FailureTests(BasePlatformTests): | ||
106 | ''' | ||
107 | Tests that test failure conditions. Build files here should be dynamically | ||
108 | -- | ||
109 | 2.12.0 | ||
110 | |||