From e1297f9a951b1dbafd0e211be63b348f06b1f3cd Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Tue, 14 Aug 2018 21:06:23 +0200 Subject: meson: Split validate-cpu.patch in three This makes it more suitable to work with, e.g., devtool. It also prepares for the update to 0.47.0 when the first patch will no longer be needed (as it is a backport). Signed-off-by: Peter Kjellerstedt Signed-off-by: Richard Purdie --- meta/recipes-devtools/meson/meson.inc | 4 +- .../meson/0001-Validate-cpu_family-3753.patch | 110 +++++++++++++++++++ .../0002-Make-CPU-family-warnings-fatal.patch | 36 +++++++ ...r-to-our-wiki-instead-of-Meson-bug-system.patch | 40 +++++++ .../meson/meson/validate-cpu.patch | 118 --------------------- 5 files changed, 189 insertions(+), 119 deletions(-) create mode 100644 meta/recipes-devtools/meson/meson/0001-Validate-cpu_family-3753.patch create mode 100644 meta/recipes-devtools/meson/meson/0002-Make-CPU-family-warnings-fatal.patch create mode 100644 meta/recipes-devtools/meson/meson/0003-Send-user-to-our-wiki-instead-of-Meson-bug-system.patch delete mode 100644 meta/recipes-devtools/meson/meson/validate-cpu.patch (limited to 'meta/recipes-devtools') diff --git a/meta/recipes-devtools/meson/meson.inc b/meta/recipes-devtools/meson/meson.inc index a650469e93..c9e1e051c6 100644 --- a/meta/recipes-devtools/meson/meson.inc +++ b/meta/recipes-devtools/meson/meson.inc @@ -11,7 +11,9 @@ 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 \ + file://0001-Validate-cpu_family-3753.patch \ + file://0002-Make-CPU-family-warnings-fatal.patch \ + file://0003-Send-user-to-our-wiki-instead-of-Meson-bug-system.patch \ file://0001-mesonbuild-Recognise-risc-v-architecture.patch \ " 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 new file mode 100644 index 0000000000..6b0d0ca588 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0001-Validate-cpu_family-3753.patch @@ -0,0 +1,110 @@ +From 12fe95b1943eb832a54ba09274fa02c60d04f6b0 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Wed, 20 Jun 2018 13:45:44 +0100 +Subject: [PATCH 1/3] 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 + +Upstream-Status: Backport +Signed-off-by: Ross Burton +--- + mesonbuild/environment.py | 24 ++++++++++++++++++++++++ + run_unittests.py | 18 ++++++++++++++++++ + 2 files changed, 42 insertions(+) + +diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py +index d02a837..678d009 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): +diff --git a/run_unittests.py b/run_unittests.py +index 3c215db..7185008 100755 +--- a/run_unittests.py ++++ b/run_unittests.py +@@ -2065,6 +2065,24 @@ recommended as it can lead to undefined behaviour on some platforms''') + self.wipe() + + ++ @unittest.skipIf(not os.path.isdir('docs'), 'Doc dir not found, presumably because this is a tarball release.') ++ def test_cpu_families_documented(self): ++ with open("docs/markdown/Reference-tables.md") as f: ++ md = f.read() ++ self.assertIsNotNone(md) ++ ++ sections = list(re.finditer(r"^## (.+)$", md, re.MULTILINE)) ++ for s1, s2 in zip(sections[::2], sections[1::2]): ++ if s1.group(1) == "CPU families": ++ # Extract the content for this section ++ content = md[s1.end():s2.start()] ++ # Find the list entries ++ arches = [m.group(1) for m in re.finditer(r"^\| (\w+) +\|", content, re.MULTILINE)] ++ # Drop the header ++ arches = set(arches[1:]) ++ self.assertEqual(arches, set(mesonbuild.environment.known_cpu_families)) ++ ++ + class FailureTests(BasePlatformTests): + ''' + Tests that test failure conditions. Build files here should be dynamically +-- +2.12.0 + diff --git a/meta/recipes-devtools/meson/meson/0002-Make-CPU-family-warnings-fatal.patch b/meta/recipes-devtools/meson/meson/0002-Make-CPU-family-warnings-fatal.patch new file mode 100644 index 0000000000..3b377351a2 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0002-Make-CPU-family-warnings-fatal.patch @@ -0,0 +1,36 @@ +From 9681c5bdea6a67abf014d94a392ef42eea7df0cd Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Tue, 3 Jul 2018 13:59:09 +0100 +Subject: [PATCH 2/3] Make CPU family warnings fatal + +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Ross Burton +--- + mesonbuild/environment.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py +index 678d009..8b32892 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' % trial) + + if self.ok_type(res): + self.config[s][entry] = res +-- +2.12.0 + diff --git a/meta/recipes-devtools/meson/meson/0003-Send-user-to-our-wiki-instead-of-Meson-bug-system.patch b/meta/recipes-devtools/meson/meson/0003-Send-user-to-our-wiki-instead-of-Meson-bug-system.patch new file mode 100644 index 0000000000..8f4603e767 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0003-Send-user-to-our-wiki-instead-of-Meson-bug-system.patch @@ -0,0 +1,40 @@ +From 62f4702a1d5076d0c225f899fe65cd3badfdd022 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Fri, 6 Jul 2018 15:51:15 +0100 +Subject: [PATCH 3/3] Send user to our wiki instead of Meson bug system + +If a CPU family isn't recognised the first step should be to verify the +mapping. Send the user to a wiki page explaining what to do, instead of +directly to the Meson bug tracker. + +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Ross Burton +--- + mesonbuild/environment.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py +index 8b32892..a0580a2 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: +- raise EnvironmentException('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: +- raise EnvironmentException('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.' % value) + + if self.ok_type(res): + self.config[s][entry] = res +-- +2.12.0 + diff --git a/meta/recipes-devtools/meson/meson/validate-cpu.patch b/meta/recipes-devtools/meson/meson/validate-cpu.patch deleted file mode 100644 index e7dad00d47..0000000000 --- a/meta/recipes-devtools/meson/meson/validate-cpu.patch +++ /dev/null @@ -1,118 +0,0 @@ -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 - -From 456f7ea48503731d50a2b7287a0f198b73b4fe61 Mon Sep 17 00:00:00 2001 -From: Ross Burton -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 -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 - -- cgit 1.2.3-korg