From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Patrick Robb <probb@iol.unh.edu>
Subject: [PATCH v2] build: automatically report minimum meson version
Date: Tue, 13 May 2025 09:59:42 +0100 [thread overview]
Message-ID: <20250513085956.1670288-1-bruce.richardson@intel.com> (raw)
In-Reply-To: <20241009152417.4028297-1-bruce.richardson@intel.com>
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.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Patrick Robb <probb@iol.unh.edu>
---
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
diff --git a/.ci/linux-setup.sh b/.ci/linux-setup.sh
index 938d492cbb..e025ca0243 100755
--- a/.ci/linux-setup.sh
+++ b/.ci/linux-setup.sh
@@ -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
diff --git a/buildtools/get-min-meson-version.py b/buildtools/get-min-meson-version.py
new file mode 100755
index 0000000000..f0de8fdf2b
--- /dev/null
+++ b/buildtools/get-min-meson-version.py
@@ -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="")
diff --git a/buildtools/meson.build b/buildtools/meson.build
index 1cd1ce02fd..cc0198081d 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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([
--
2.45.2
prev parent reply other threads:[~2025-05-13 9:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 15:24 [RFC PATCH] " Bruce Richardson
2024-10-09 16:40 ` Stephen Hemminger
2024-10-14 16:31 ` Patrick Robb
2025-05-13 8:59 ` Bruce Richardson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250513085956.1670288-1-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=probb@iol.unh.edu \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).