<div dir="ltr">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.<div><br></div><div>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.</div><div><br></div><div>Reviewed-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 9, 2024 at 11:24 AM Bruce Richardson <<a href="mailto:bruce.richardson@intel.com">bruce.richardson@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Add a script to buildtools to report the minimum meson version given in<br>
our meson.build file. Then use this script in two ways:<br>
<br>
1. in the .ci/linux-setup.sh script, use the auto-determined minimum<br>
version to set up the CI, rather than hard-coding it.<br>
2. in meson.build call the script to report the version. This serves as<br>
a sanity check to ensure that any changes to meson.build file do not<br>
break the script.<br>
<br>
Signed-off-by: Bruce Richardson <<a href="mailto:bruce.richardson@intel.com" target="_blank">bruce.richardson@intel.com</a>><br>
---<br>
.ci/linux-setup.sh | 6 +++++-<br>
buildtools/get-min-meson-version.py | 26 ++++++++++++++++++++++++++<br>
buildtools/meson.build | 5 +++++<br>
3 files changed, 36 insertions(+), 1 deletion(-)<br>
create mode 100755 buildtools/get-min-meson-version.py<br>
<br>
diff --git a/.ci/linux-setup.sh b/.ci/linux-setup.sh<br>
index 975bf32144..e025ca0243 100755<br>
--- a/.ci/linux-setup.sh<br>
+++ b/.ci/linux-setup.sh<br>
@@ -3,8 +3,12 @@<br>
# Builds are run as root in containers, no need for sudo<br>
[ "$(id -u)" != '0' ] || alias sudo=<br>
<br>
+# determine minimum meson version<br>
+ci_dir=$(dirname $(readlink -f $0))<br>
+meson_ver=$(python3 $ci_dir/../buildtools/get-min-meson-version.py)<br>
+<br>
# need to install as 'root' since some of the unit tests won't run without it<br>
-sudo python3 -m pip install --upgrade 'meson==0.53.2'<br>
+sudo python3 -m pip install --upgrade "meson==$meson_ver"<br>
<br>
# setup hugepages. error ignored because having hugepage is not mandatory.<br>
cat /proc/meminfo<br>
diff --git a/buildtools/get-min-meson-version.py b/buildtools/get-min-meson-version.py<br>
new file mode 100755<br>
index 0000000000..f0de8fdf2b<br>
--- /dev/null<br>
+++ b/buildtools/get-min-meson-version.py<br>
@@ -0,0 +1,26 @@<br>
+#! /usr/bin/env python3<br>
+# SPDX-License-Identifier: BSD-3-Clause<br>
+# Copyright(c) 2024 Intel Corporation<br>
+<br>
+import os<br>
+import re<br>
+import sys<br>
+from os.path import dirname, realpath, join<br>
+<br>
+buildtools_path = dirname(realpath(__file__))<br>
+basedir = dirname(buildtools_path)<br>
+<br>
+with open(join(basedir, "meson.build")) as f:<br>
+ for ln in f.readlines():<br>
+ if "meson_version" not in ln:<br>
+ continue<br>
+<br>
+ ln = ln.strip()<br>
+ ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln)<br>
+ if not ver_match:<br>
+ print(<br>
+ f"Meson version specifier not in recognised format: '{ln}'",<br>
+ file=sys.stderr,<br>
+ )<br>
+ sys.exit(1)<br>
+ print(ver_match.group(1), end="")<br>
diff --git a/buildtools/meson.build b/buildtools/meson.build<br>
index 3adf34e1a8..8b20ac0dd0 100644<br>
--- a/buildtools/meson.build<br>
+++ b/buildtools/meson.build<br>
@@ -24,6 +24,11 @@ get_numa_count_cmd = py3 + files('get-numa-count.py')<br>
get_test_suites_cmd = py3 + files('get-test-suites.py')<br>
has_hugepages_cmd = py3 + files('has-hugepages.py')<br>
cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py')<br>
+get_min_meson_version_cmd = py3 + files('get-min-meson-version.py')<br>
+<br>
+# check that we can correctly report minimum meson version<br>
+min_ver = run_command(get_min_meson_version_cmd, check: true, capture: true)<br>
+message('Minimum meson required version is ' + min_ver.stdout())<br>
<br>
# install any build tools that end-users might want also<br>
install_data([<br>
-- <br>
2.43.0<br>
<br>
</blockquote></div>