build: automatically report minimum meson version
RFC PATCH 1/1 build: automatically report minimum meson version
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the .ci/linux-setup.sh script, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.
--- .ci/linux-setup.sh | 6 +++++- buildtools/get-min-meson-version.py | 26 ++++++++++++++++++++++++++ buildtools/meson.build | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 buildtools/get-min-meson-version.py
.ci/linux-setup.sh +5 -1
@@ -3,8 +3,12 @@ # Builds are run as root in containers, no need for sudo [ "$(id -u)" != '0' ] || alias sudo= +# determine minimum meson version +ci_dir=$(dirname $(readlink -f $0)) +meson_ver=$(python3 $ci_dir/../buildtools/get-min-meson-version.py) + # need to install as 'root' since some of the unit tests won't run without it -sudo python3 -m pip install --upgrade 'meson==0.53.2' +sudo python3 -m pip install --upgrade "meson==$meson_ver" # setup hugepages. error ignored because having hugepage is not mandatory. cat /proc/meminfo
buildtools/get-min-meson-version.py new file +26 -0
@@ -0,0 +1,26 @@ +#! /usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 Intel Corporation + +import os +import re +import sys +from os.path import dirname, realpath, join + +buildtools_path = dirname(realpath(__file__)) +basedir = dirname(buildtools_path) + +with open(join(basedir, "meson.build")) as f: + for ln in f.readlines(): + if "meson_version" not in ln: + continue + + ln = ln.strip() + ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + if not ver_match: + print( + f"Meson version specifier not in recognised format: '{ln}'", + file=sys.stderr, + ) + sys.exit(1) + print(ver_match.group(1), end="")
buildtools/meson.build +5 -0
@@ -24,6 +24,11 @@ get_numa_count_cmd = py3 + files('get-numa-count.py') get_test_suites_cmd = py3 + files('get-test-suites.py') has_hugepages_cmd = py3 + files('has-hugepages.py') cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py') +get_min_meson_version_cmd = py3 + files('get-min-meson-version.py') + +# check that we can correctly report minimum meson version +min_ver = run_command(get_min_meson_version_cmd, check: true, capture: true) +message('Minimum meson required version is ' + min_ver.stdout()) # install any build tools that end-users might want also install_data([
Signature · 1 line
2.43.0
Quoted 10 lines · On Wed, 9 Oct 2024 16:24:01 +0100 Bruce Richardson…
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the
.ci/linux-setup.shscript, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.Signed-off-by Bruce Richardson <[email protected]>
Make sense, kind of annoying that it requires so many lines to do this but very understandable.
It seems like a good addition that meson.build and /.ci/linux-setup.sh are automatically in sync now. That's one less thing that someone has to "just remember" when increasing the meson minimum version.
I will flag on the other thread (increasing the meson version) when UNH's scripts are updated to always run linux-setup.sh ahead of each testrun.
Quoted 91 lines · Bruce Richardson
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the
.ci/linux-setup.shscript, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.Signed-off-by Bruce Richardson <[email protected]>--- .ci/linux-setup.sh | 6 +++++- buildtools/get-min-meson-version.py | 26 ++++++++++++++++++++++++++ buildtools/meson.build | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 buildtools/get-min-meson-version.py.ci/linux-setup.sh +4
-0@@ -3,8 +3,12 @@ # Builds are run as root in containers, no need for sudo [ "$(id -u)" != '0' ] || alias sudo= +# determine minimum meson version +ci_dir=$(dirname $(readlink -f $0)) +meson_ver=$(python3 $ci_dir/../buildtools/get-min-meson-version.py) + # need to install as 'root' since some of the unit tests won't runwithout it
.ci/linux-setup.sh +1
-1-sudo python3 -m pip install --upgrade 'meson==0.53.2' +sudo python3 -m pip install --upgrade "meson==$meson_ver" # setup hugepages. error ignored because having hugepage is not mandatory. cat /proc/meminfobuildtools/get-min-meson-version.py new file +22
-0@@ -0,0 +1,26 @@ +#! /usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 Intel Corporation + +import os +import re +import sys +from os.path import dirname, realpath, join + +buildtools_path = dirname(realpath(__file__)) +basedir = dirname(buildtools_path) + +with open(join(basedir, "meson.build")) as f: + for ln in f.readlines(): + if "meson_version" not in ln: + continue + + ln = ln.strip() + ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + if not ver_match: + print( + f"Meson version specifier not in recognised format:'{ln}'",
buildtools/get-min-meson-version.py new file +4
-0+ file=sys.stderr, + ) + sys.exit(1) + print(ver_match.group(1), end="")buildtools/meson.build +5
-0@@ -24,6 +24,11 @@ get_numa_count_cmd = py3 + files('get-numa-count.py') get_test_suites_cmd = py3 + files('get-test-suites.py') has_hugepages_cmd = py3 + files('has-hugepages.py') cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py') +get_min_meson_version_cmd = py3 + files('get-min-meson-version.py') + +# check that we can correctly report minimum meson version +min_ver = run_command(get_min_meson_version_cmd, check: true, capture: true) +message('Minimum meson required version is ' + min_ver.stdout()) # install any build tools that end-users might want alsoinstall_data([
--
2.43.0
PATCH v2 1/1 build: automatically report minimum meson version
In reply to Bruce RichardsonAdd a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the .ci/linux-setup.sh script, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.
---
v2: rebased to latest main
--- .ci/linux-setup.sh | 6 +++++- buildtools/get-min-meson-version.py | 26 ++++++++++++++++++++++++++ buildtools/meson.build | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 buildtools/get-min-meson-version.py
.ci/linux-setup.sh +5 -1
@@ -3,8 +3,12 @@ # Builds are run as root in containers, no need for sudo [ "$(id -u)" != '0' ] || alias sudo= +# determine minimum meson version +ci_dir=$(dirname $(readlink -f $0)) +meson_ver=$(python3 $ci_dir/../buildtools/get-min-meson-version.py) + # need to install as 'root' since some of the unit tests won't run without it -sudo python3 -m pip install --upgrade 'meson==0.57.2' +sudo python3 -m pip install --upgrade "meson==$meson_ver" # setup hugepages. error ignored because having hugepage is not mandatory. cat /proc/meminfo
buildtools/get-min-meson-version.py new file +26 -0
@@ -0,0 +1,26 @@ +#! /usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 Intel Corporation + +import os +import re +import sys +from os.path import dirname, realpath, join + +buildtools_path = dirname(realpath(__file__)) +basedir = dirname(buildtools_path) + +with open(join(basedir, "meson.build")) as f: + for ln in f.readlines(): + if "meson_version" not in ln: + continue + + ln = ln.strip() + ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + if not ver_match: + print( + f"Meson version specifier not in recognised format: '{ln}'", + file=sys.stderr, + ) + sys.exit(1) + print(ver_match.group(1), end="")
buildtools/meson.build +5 -0
@@ -26,6 +26,11 @@ header_gen_cmd = py3 + files('gen-header.py') has_hugepages_cmd = py3 + files('has-hugepages.py') cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py') check_dts_requirements = py3 + files('check-dts-requirements.py') +get_min_meson_version_cmd = py3 + files('get-min-meson-version.py') + +# check that we can correctly report minimum meson version +min_ver = run_command(get_min_meson_version_cmd, check: true, capture: true) +message('Minimum meson required version is ' + min_ver.stdout()) # install any build tools that end-users might want also install_data([
Signature · 1 line
2.45.2
Quoted 10 lines · Bruce Richardson
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the
.ci/linux-setup.shscript, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.
Quoted 5 lines
Signed-off-by Bruce Richardson <[email protected]>Reviewed-by Patrick Robb <[email protected]>---
v2: rebased to latest main
This patch is reverting dbcd72f3fba0 ("ci: fix unit tests with Fedora 37").
There were some strange errors raised by UNH, though I don't see the same python backtrace.
Let's try again:
Recheck-request: iol-unit-arm64-testing, iol-unit-amd64-testing
Signature · 1 line
David Marchand
Quoted 18 lines · David Marchand
Quoted 10 lines · Bruce Richardson
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the
.ci/linux-setup.shscript, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.Quoted 5 lines
Signed-off-by Bruce Richardson <[email protected]>Reviewed-by Patrick Robb <[email protected]>---
v2: rebased to latest main
Quoted 7 lines
This patch is reverting
dbcd72f3fba0("ci: fix unit tests with Fedora 37").There were some strange errors raised by UNH, though I don't see the same python backtrace.
Let's try again:
Recheck-request: iol-unit-arm64-testing, iol-unit-amd64-testing
If we have issues using 0.57, I don't see there being issues with us marking the min meson version to 0.57.2 rather than 0.57 alone. I can do that in a v3, or else we can abandon this patch, if you prefer.
/Bruce
Quoted 22 lines · Bruce Richardson
Quoted 20 lines · David Marchand
Quoted 10 lines · Bruce Richardson
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the
.ci/linux-setup.shscript, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.Quoted 5 lines
Signed-off-by Bruce Richardson <[email protected]>Reviewed-by Patrick Robb <[email protected]>---
v2: rebased to latest mainThis patch is reverting
dbcd72f3fba0("ci: fix unit tests with Fedora 37").
Quoted 8 lines
Quoted 5 lines
There were some strange errors raised by UNH, though I don't see the same python backtrace.
Let's try again:
Recheck-request: iol-unit-arm64-testing, iol-unit-amd64-testingIf we have issues using 0.57, I don't see there being issues with us marking the min meson version to 0.57.2 rather than 0.57 alone. I can do that in a v3, or else we can abandon this patch, if you prefer.
Retests show the same error, so I think we are hitting the issue fixed with dbcd72f3fba0.
Bumping the minimal version to 0.57.2 seems fine.
I looked and can't find a distrib that ships meson 0.57.
So either a user relies on the distrib version (with a version >= 0.58, from my quick search) or the distrib provided version is too old and then the user relies on pip.
Signature · 1 line
David Marchand
Quoted 12 lines · David Marchand
Retests show the same error, so I think we are hitting the issue fixed with
dbcd72f3fba0.Bumping the minimal version to 0.57.2 seems fine.
I looked and can't find a distrib that ships meson 0.57.
So either a user relies on the distrib version (with a version >= 0.58, from my quick search) or the distrib provided version is too old and then the user relies on pip.
FYI here's the stacktrace below which is not making it to the testlog on the dashboard (something for UNH people to look at). But yes it's the same issue fixed with dbcd72f3fba0babd2d801c2c63ee537df459df66
---------
Exception in callback TestHarness._run_tests.<locals>.test_done(<Task
finishe...explicitly.')>) at /usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py:1806
handle: <Handle TestHarness._run_tests.<locals>.test_done(<Task
finishe...explicitly.')>) at /usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py:1806>
Traceback (most recent call last):
File "/usr/lib64/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1808, in test_done
f.result()
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1803, in run_test
res = await test.run(self)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1349, in run
await self._run_cmd(harness, cmd)
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1415, in _run_cmd
returncode, result, additional_error = awaitp.wait(self.runobj.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1241, in wait
await try_wait_one(p.wait(), timeout=timeout)
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1132, in try_wait_one
await asyncio.wait(awaitables,
File "/usr/lib64/python3.12/asyncio/tasks.py", line 461, in wait
raise TypeError("Passing coroutines is forbidden, use tasks
explicitly.")
TypeError: Passing coroutines is forbidden, use tasks explicitly. /usr/lib64/python3.12/asyncio/events.py:88: RuntimeWarning: coroutine
'Process.wait' was never awaited
self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mesonmain.py",
line 132, in run
return options.run_func(options)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1953, in run
return th.doit()
^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1641, in doit
self.run_tests(runners)
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1780, in run_tests
loop.run_until_complete(self._run_tests(runners))
File "/usr/lib64/python3.12/asyncio/base_events.py", line 687, inrun_until_complete
return future.result()
^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1871, in _run_tests
await complete(future)
File "/usr/local/lib/python3.12/site-packages/mesonbuild/mtest.py", line
1148, in complete
await future
TypeError: Passing coroutines is forbidden, use tasks explicitly.
Ok: 0 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0
Quoted 33 lines · David Marchand
Quoted 22 lines · Bruce Richardson
Quoted 20 lines · David Marchand
Quoted 10 lines · Bruce Richardson
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the
.ci/linux-setup.shscript, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.Quoted 5 lines
Signed-off-by Bruce Richardson <[email protected]>Reviewed-by Patrick Robb <[email protected]>---
v2: rebased to latest mainThis patch is reverting
dbcd72f3fba0("ci: fix unit tests with Fedora 37").Quoted 8 lines
Quoted 5 lines
There were some strange errors raised by UNH, though I don't see the same python backtrace.
Let's try again:
Recheck-request: iol-unit-arm64-testing, iol-unit-amd64-testingIf we have issues using 0.57, I don't see there being issues with us marking the min meson version to 0.57.2 rather than 0.57 alone. I can do that in a v3, or else we can abandon this patch, if you prefer.
Quoted 9 lines
Retests show the same error, so I think we are hitting the issue fixed with
dbcd72f3fba0.Bumping the minimal version to 0.57.2 seems fine.
I looked and can't find a distrib that ships meson 0.57.
So either a user relies on the distrib version (with a version >= 0.58, from my quick search) or the distrib provided version is too old and then the user relies on pip.
Ok, will do a new revision with the version bump.
/Bruce
PATCH v3 1/1 build: automatically report minimum meson version
In reply to Bruce RichardsonAdd a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the .ci/linux-setup.sh script, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.
---
v3: update minimum meson to 0.57.2 (from 0.57.0) to fix CI errors
v2: rebase to latest main
--- .ci/linux-setup.sh | 6 +++++- buildtools/get-min-meson-version.py | 26 ++++++++++++++++++++++++++ buildtools/meson.build | 5 +++++ meson.build | 2 +- 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100755 buildtools/get-min-meson-version.py
.ci/linux-setup.sh +5 -1
@@ -3,8 +3,12 @@ # Builds are run as root in containers, no need for sudo [ "$(id -u)" != '0' ] || alias sudo= +# determine minimum meson version +ci_dir=$(dirname $(readlink -f $0)) +meson_ver=$(python3 $ci_dir/../buildtools/get-min-meson-version.py) + # need to install as 'root' since some of the unit tests won't run without it -sudo python3 -m pip install --upgrade 'meson==0.57.2' +sudo python3 -m pip install --upgrade "meson==$meson_ver" # setup hugepages. error ignored because having hugepage is not mandatory. cat /proc/meminfo
buildtools/get-min-meson-version.py new file +26 -0
@@ -0,0 +1,26 @@ +#! /usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 Intel Corporation + +import os +import re +import sys +from os.path import dirname, realpath, join + +buildtools_path = dirname(realpath(__file__)) +basedir = dirname(buildtools_path) + +with open(join(basedir, "meson.build")) as f: + for ln in f.readlines(): + if "meson_version" not in ln: + continue + + ln = ln.strip() + ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + if not ver_match: + print( + f"Meson version specifier not in recognised format: '{ln}'", + file=sys.stderr, + ) + sys.exit(1) + print(ver_match.group(1), end="")
buildtools/meson.build +5 -0
@@ -26,6 +26,11 @@ header_gen_cmd = py3 + files('gen-header.py') has_hugepages_cmd = py3 + files('has-hugepages.py') cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py') check_dts_requirements = py3 + files('check-dts-requirements.py') +get_min_meson_version_cmd = py3 + files('get-min-meson-version.py') + +# check that we can correctly report minimum meson version +min_ver = run_command(get_min_meson_version_cmd, check: true, capture: true) +message('Minimum meson required version is ' + min_ver.stdout()) # install any build tools that end-users might want also install_data([
meson.build +1 -1
@@ -10,7 +10,7 @@ project('DPDK', 'c', 'default_library=static', 'warning_level=2', ], - meson_version: '>= 0.57' + meson_version: '>= 0.57.2' ) fs = import('fs')
Signature · 1 line
2.48.1
Hello Min Zhou,
Quoted 10 lines · Bruce Richardson
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the
.ci/linux-setup.shscript, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.
Quoted 7 lines
Signed-off-by Bruce Richardson <[email protected]>Reviewed-by Patrick Robb <[email protected]>---
v3: update minimum meson to 0.57.2 (from 0.57.0) to fix CI errors
v2: rebase to latest main
The LoongArch CI reported an error on this patch, but I can't find out the reason:
https://mails.dpdk.org/archives/test-report/2025-May/877981.html
This is probably related to the meson version in the build env, since this patch increases the minimum version to 0.57.2.
Can you have a look please?
Signature · 1 line
David Marchand
Hello David Marchand,
Quoted 20 lines · David Marchand
Hello Min Zhou,
Quoted 9 lines · Bruce Richardson
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the
.ci/linux-setup.shscript, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.Quoted 7 lines
Signed-off-by Bruce Richardson <[email protected]>Reviewed-by Patrick Robb <[email protected]>---
v3: update minimum meson to 0.57.2 (from 0.57.0) to fix CI errors
v2: rebase to latest main
Quoted 8 lines
The LoongArch CI reported an error on this patch, but I can't find out the reason:
https://mails.dpdk.org/archives/test-report/2025-May/877981.htmlThis is probably related to the meson version in the build env, since this patch increases the minimum version to 0.57.2.
Can you have a look please?
Sure. The reason for this error is related to the meson version in the build environment. I will update the version of meson and retest this patch.
Quoted 1 line
Recheck-request: loongarch-compilation
Thomas Monjalon
Applied15/05/2025 15:46, Bruce Richardson:
Quoted 9 lines
Add a script to buildtools to report the minimum meson version given in our meson.build file. Then use this script in two ways:
1. in the
.ci/linux-setup.shscript, use the auto-determined minimum version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as a sanity check to ensure that any changes to meson.build file do not break the script.
Quoted 3 lines
Signed-off-by Bruce Richardson <[email protected]>Reviewed-by Patrick Robb <[email protected]>
Applied, thanks.