From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1CFA45B3A; Mon, 14 Oct 2024 18:32:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CC944027F; Mon, 14 Oct 2024 18:32:43 +0200 (CEST) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 498EE40151 for ; Mon, 14 Oct 2024 18:32:42 +0200 (CEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-20cf3e36a76so9178265ad.0 for ; Mon, 14 Oct 2024 09:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1728923561; x=1729528361; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fcMLcT73FqPfNIHpMrpRw2r1z0TjQhzPzUiqyL24VfA=; b=JTDGh2rizHE7ZXVlwL1MLmV04m+ROU/7yfpdSbnVwefGj8mvtJAH2kB9HId4DVySlO dQTWc8VKRFzf1ON05E3cXEWGnLWZ5QvbrIoZApFWsp65W0NsIETKUXHZoe68o2hsqRTO bWwZdrIvKpWA6h88Oc8cSvERABonU3EzNx9cY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728923561; x=1729528361; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fcMLcT73FqPfNIHpMrpRw2r1z0TjQhzPzUiqyL24VfA=; b=uBx+ImS3o1i+cjcudkDp2N1YbftUn+QKXvI+nk8eB/cRg7+qfhiyJc15b27TAQBxS6 SivNve15ONBcLBpauJ7K9IKMDXiyT3rDuaM1lQS0iYZCHc65IsiyNJS1BHCJHyV2fPFW YKnfhC08EMRpL9vXXbJLU1fs5xW86VPOmbX/TlYqTEc6lLBFQVJ3WtWk7J8JJOynVCKA hPH7W8NzQqP+G8CynhYNgN2tMr2A7ps3FN/5ohdEwW2MHzh8d/4TJLxeHYDOTKs71xhG geZppB5jVJYm8B2H2lyQMBZMYwYHxVy57i2Twsm8jZ+N5B0w+Y0morCMd0wDATn60RM0 6J3w== X-Gm-Message-State: AOJu0Yxwsp7yGANXXfMu0SwXVXhT8EER6r0D9C9pyoeSIGT1UvydvADq 2GtJb5cOoG0mZaa9k5Bq3mDD6e3Ly7iGbiGnix4LRVi5itgThAyUt4tzlZALAcVht4UlR05eqmq WwI3XBywz0WjnJmwErQOa23m+ej3TKwHKXL/KHA== X-Google-Smtp-Source: AGHT+IGg/VJkX6+z4loMuD5jrPCAfXuRuxsikugw6gtTC2GJ9p5WMIsinqHb3yVfXIOGosyzxCcxg+RByHUqFISxwdw= X-Received: by 2002:a17:90a:c708:b0:2e2:b64e:f501 with SMTP id 98e67ed59e1d1-2e2f0d7f1fbmr14412594a91.30.1728923561363; Mon, 14 Oct 2024 09:32:41 -0700 (PDT) MIME-Version: 1.0 References: <20241009152417.4028297-1-bruce.richardson@intel.com> In-Reply-To: <20241009152417.4028297-1-bruce.richardson@intel.com> From: Patrick Robb Date: Mon, 14 Oct 2024 12:31:18 -0400 Message-ID: Subject: Re: [RFC PATCH] build: automatically report minimum meson version To: Bruce Richardson Cc: dev@dpdk.org, david.marchand@redhat.com Content-Type: multipart/alternative; boundary="000000000000b82ba10624726228" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --000000000000b82ba10624726228 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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. Reviewed-by: Patrick Robb On Wed, Oct 9, 2024 at 11:24=E2=80=AFAM Bruce Richardson wrote: > 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 > --- > .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 975bf32144..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)" !=3D '0' ] || alias sudo=3D > > +# determine minimum meson version > +ci_dir=3D$(dirname $(readlink -f $0)) > +meson_ver=3D$(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=3D=3D0.53.2' > +sudo python3 -m pip install --upgrade "meson=3D=3D$meson_ver" > > # setup hugepages. error ignored because having hugepage is not mandator= y. > 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 =3D dirname(realpath(__file__)) > +basedir =3D dirname(buildtools_path) > + > +with open(join(basedir, "meson.build")) as f: > + for ln in f.readlines(): > + if "meson_version" not in ln: > + continue > + > + ln =3D ln.strip() > + ver_match =3D re.search(r"meson_version:\s*'>=3D\s*([0-9\.]+)'",= ln) > + if not ver_match: > + print( > + f"Meson version specifier not in recognised format: > '{ln}'", > + file=3Dsys.stderr, > + ) > + sys.exit(1) > + print(ver_match.group(1), end=3D"") > diff --git a/buildtools/meson.build b/buildtools/meson.build > index 3adf34e1a8..8b20ac0dd0 100644 > --- a/buildtools/meson.build > +++ b/buildtools/meson.build > @@ -24,6 +24,11 @@ get_numa_count_cmd =3D py3 + files('get-numa-count.py'= ) > get_test_suites_cmd =3D py3 + files('get-test-suites.py') > has_hugepages_cmd =3D py3 + files('has-hugepages.py') > cmdline_gen_cmd =3D py3 + files('dpdk-cmdline-gen.py') > +get_min_meson_version_cmd =3D py3 + files('get-min-meson-version.py') > + > +# check that we can correctly report minimum meson version > +min_ver =3D 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.43.0 > > --000000000000b82ba10624726228 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It seems like a good addition that meson.build and /.ci/li= nux-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=C2=A0(increasin= g the meson version) when UNH's scripts are updated to always=C2=A0run = linux-setup.sh ahead of each testrun.

Reviewed-by:= Patrick Robb <probb@iol.unh.edu>

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
=C2=A0 =C2=A0version to set up the CI, rather than hard-coding it.
2. in meson.build call the script to report the version. This serves as
=C2=A0 =C2=A0a sanity check to ensure that any changes to meson.build file = do not
=C2=A0 =C2=A0break the script.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
=C2=A0.ci/linux-setup.sh=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 |=C2=A0 6 +++++-
=C2=A0buildtools/get-min-meson-version.py | 26 ++++++++++++++++++++++++++ =C2=A0buildtools/meson.build=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 |=C2=A0 5 +++++
=C2=A03 files changed, 36 insertions(+), 1 deletion(-)
=C2=A0create mode 100755 buildtools/get-min-meson-version.py

diff --git a/.ci/linux-setup.sh b/.ci/linux-setup.sh
index 975bf32144..e025ca0243 100755
--- a/.ci/linux-setup.sh
+++ b/.ci/linux-setup.sh
@@ -3,8 +3,12 @@
=C2=A0# Builds are run as root in containers, no need for sudo
=C2=A0[ "$(id -u)" !=3D '0' ] || alias sudo=3D

+# determine minimum meson version
+ci_dir=3D$(dirname $(readlink -f $0))
+meson_ver=3D$(python3 $ci_dir/../buildtools/get-min-meson-version.py)
+
=C2=A0# need to install as 'root' since some of the unit tests won&= #39;t run without it
-sudo python3 -m pip install --upgrade 'meson=3D=3D0.53.2'
+sudo python3 -m pip install --upgrade "meson=3D=3D$meson_ver"
=C2=A0# setup hugepages. error ignored because having hugepage is not manda= tory.
=C2=A0cat /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 =3D dirname(realpath(__file__))
+basedir =3D dirname(buildtools_path)
+
+with open(join(basedir, "meson.build")) as f:
+=C2=A0 =C2=A0 for ln in f.readlines():
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if "meson_version" not in ln:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ln =3D ln.strip()
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ver_match =3D re.search(r"meson_version:\= s*'>=3D\s*([0-9\.]+)'", ln)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if not ver_match:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 f"Meson versi= on specifier not in recognised format: '{ln}'",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 file=3Dsys.stderr,=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sys.exit(1)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 print(ver_match.group(1), end=3D"")<= br> diff --git a/buildtools/meson.build b/buildtools/meson.build
index 3adf34e1a8..8b20ac0dd0 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -24,6 +24,11 @@ get_numa_count_cmd =3D py3 + files('get-numa-count.p= y')
=C2=A0get_test_suites_cmd =3D py3 + files('get-test-suites.py')
=C2=A0has_hugepages_cmd =3D py3 + files('has-hugepages.py')
=C2=A0cmdline_gen_cmd =3D py3 + files('dpdk-cmdline-gen.py')
+get_min_meson_version_cmd =3D py3 + files('get-min-meson-version.py= 9;)
+
+# check that we can correctly report minimum meson version
+min_ver =3D run_command(get_min_meson_version_cmd, check: true, capture: t= rue)
+message('Minimum meson required version is ' + min_ver.stdout())
=C2=A0# install any build tools that end-users might want also
=C2=A0install_data([
--
2.43.0

--000000000000b82ba10624726228--