buildtools: allow a different minimum meson version for Windows
PATCH 1/1 buildtools: allow a different minimum meson version for Windows
There is a minimum meson version specified in the DPDK meson project section, which has been documented. This string is parsed by buildtools\get-min-meson-version.py and this information is used by lab automation to install the corresponding meson package on the build machine.
Turns out that the meson version specified on the DPDK project (0.57.x) is buggy on Windows: it has issues related to path manipulation, and these issues are causing failures. Therefore, a newer meson is required on Windows.
To avoid bringing the minimum requirements up for all operating systems before a more appropriate release, this patch implements a mechanism allowing a different version to be specified for Windows.
--- buildtools/get-min-meson-version.py | 12 ++++++++++-- meson.build | 9 +++++++++ 2 files changed, 19 insertions(+), 2 deletions(-)
buildtools/get-min-meson-version.py +10 -2
@@ -11,12 +11,19 @@ basedir = dirname(buildtools_path) with open(join(basedir, "meson.build")) as f: + if os.name == "nt": + keyword = "windows_meson_version" + pattern = r"windows_meson_version:\s*'>=\s*([0-9\.]+)'" + else: + keyword = "meson_version" + pattern = r"meson_version:\s*'>=\s*([0-9\.]+)'" + for ln in f.readlines(): - if "meson_version" not in ln: + if keyword not in ln: continue ln = ln.strip() - ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + ver_match = re.search(pattern, ln) if not ver_match: print( f"Meson version specifier not in recognised format: '{ln}'",
@@ -24,3 +31,4 @@ ) sys.exit(1) print(ver_match.group(1), end="") + break
meson.build +9 -0
@@ -13,6 +13,15 @@ project('DPDK', 'c', meson_version: '>= 0.57.2' ) +# Meson does not support dynamic/conditional values for meson_version in +# the project section. +# The line below contains the minimum meson version required on Windows, +# which gets parsed by get-min-meson-version.py. +# It is important to keep this line below the "project" section, so that +# the script can make the correct determination according to the operating +# system. +# windows_meson_version: '>= 1.5.2' + fs = import('fs') # check for developer mode
Signature · 1 line
2.49.0.vfs.0.3
Quoted 11 lines · Andre Muezerie
There is a minimum meson version specified in the DPDK meson project section, which has been documented. This string is parsed by buildtools\get-min-meson-version.py and this information is used by lab automation to install the corresponding meson package on the build machine.
Turns out that the meson version specified on the DPDK project (0.57.x) is buggy on Windows: it has issues related to path manipulation, and these issues are causing failures. Therefore, a newer meson is required on Windows.
Quoted 5 lines
To avoid bringing the minimum requirements up for all operating systems before a more appropriate release, this patch implements a mechanism allowing a different version to be specified for Windows.
Signed-off-by Andre Muezerie <[email protected]>
I am fine with the principle, few comments inline below just on the specific implementation.
/Bruce
Quoted 10 lines
--- buildtools/get-min-meson-version.py | 12 ++++++++++-- meson.build | 9 +++++++++ 2 files changed, 19 insertions(+), 2 deletions(-)buildtools/get-min-meson-version.py +0
-0
buildtools/get-min-meson-version.py line 20
Quoted 10 lines
buildtools/get-min-meson-version.py +7
-0@@ -11,12 +11,19 @@ basedir = dirname(buildtools_path) with open(join(basedir, "meson.build")) as f: + if os.name == "nt": + keyword = "windows_meson_version" + pattern = r"windows_meson_version:\s*'>=\s*([0-9\.]+)'" + else: + keyword = "meson_version" + pattern = r"meson_version:\s*'>=\s*([0-9\.]+)'" +
Minor nit, but I'd suggest shortening this a little to:
keyword = "meson_version"
if os.name == "nt":
keyword = "windows_" + keyword
pattern = fr"{keyword}:\s*'>=\s*([0-9\.]+)'"
or even further shortening gives:
keyword = "windows_meson_version" if os.name == "nt" else "meson_version"
pattern = fr"{keyword}:\s*'>=\s*([0-9\.]+)'"Quoted 23 lines
buildtools/get-min-meson-version.py +3
-2for ln in f.readlines(): - if "meson_version" not in ln: + if keyword not in ln: continue ln = ln.strip() - ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + ver_match = re.search(pattern, ln) if not ver_match: print( f"Meson version specifier not in recognised format: '{ln}'",@@ -24,3 +31,4 @@ ) sys.exit(1) print(ver_match.group(1), end="") + breakmeson.build +0
-0@@ -13,6 +13,15 @@ project('DPDK', 'c', meson_version: '>= 0.57.2' )
meson.build project('DPDK', 'c', · line 24
Quoted 10 lines
meson.build +9
-0+# Meson does not support dynamic/conditional values for meson_version in +# the project section. +# The line below contains the minimum meson version required on Windows, +# which gets parsed by get-min-meson-version.py. +# It is important to keep this line below the "project" section, so that +# the script can make the correct determination according to the operating +# system. +# windows_meson_version: '>= 1.5.2' +
Why not pick a string that is not a superset of the general meson_version one? That would avoid the need to position it below the project one, and save you having to document that in a long comment. (also avoid the need to add the "break" into the python script, not that that is a big deal!) For example, how about using:
* windows_min_meson
* windows_meson_ver
* windows meson_min_ver
/Bruce
Quoted 96 lines · Bruce Richardson
Quoted 11 lines · Andre Muezerie
There is a minimum meson version specified in the DPDK meson project section, which has been documented. This string is parsed by buildtools\get-min-meson-version.py and this information is used by lab automation to install the corresponding meson package on the build machine.
Turns out that the meson version specified on the DPDK project (0.57.x) is buggy on Windows: it has issues related to path manipulation, and these issues are causing failures. Therefore, a newer meson is required on Windows.
Quoted 5 lines
To avoid bringing the minimum requirements up for all operating systems before a more appropriate release, this patch implements a mechanism allowing a different version to be specified for Windows.
Signed-off-by Andre Muezerie <[email protected]>I am fine with the principle, few comments inline below just on the specific implementation.
/Bruce
Quoted 10 lines
--- buildtools/get-min-meson-version.py | 12 ++++++++++-- meson.build | 9 +++++++++ 2 files changed, 19 insertions(+), 2 deletions(-)buildtools/get-min-meson-version.py +0
-0buildtools/get-min-meson-version.py line 20
Quoted 10 lines
buildtools/get-min-meson-version.py +7
-0@@ -11,12 +11,19 @@ basedir = dirname(buildtools_path) with open(join(basedir, "meson.build")) as f: + if os.name == "nt": + keyword = "windows_meson_version" + pattern = r"windows_meson_version:\s*'>=\s*([0-9\.]+)'" + else: + keyword = "meson_version" + pattern = r"meson_version:\s*'>=\s*([0-9\.]+)'" +Minor nit, but I'd suggest shortening this a little to:
keyword = "
meson_version"
if os.name == "nt":
keyword = "windows_" + keyword
pattern = fr"{keyword}:\s*'>=\s*([0-9\.]+)'"or even further shortening gives:
keyword = "windows_meson_version" if os.name == "nt" else "meson_version" pattern = fr"{keyword}:\s*'>=\s*([0-9\.]+)'"Quoted 23 lines
buildtools/get-min-meson-version.py +3
-2for ln in f.readlines(): - if "meson_version" not in ln: + if keyword not in ln: continue ln = ln.strip() - ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + ver_match = re.search(pattern, ln) if not ver_match: print( f"Meson version specifier not in recognised format: '{ln}'",@@ -24,3 +31,4 @@ ) sys.exit(1) print(ver_match.group(1), end="") + breakmeson.build +0
-0@@ -13,6 +13,15 @@ project('DPDK', 'c', meson_version: '>= 0.57.2' )meson.build project('DPDK', 'c', · line 24
Quoted 10 lines
meson.build +9
-0+# Meson does not support dynamic/conditional values for meson_version in +# the project section. +# The line below contains the minimum meson version required on Windows, +# which gets parsed by get-min-meson-version.py. +# It is important to keep this line below the "project" section, so that +# the script can make the correct determination according to the operating +# system. +# windows_meson_version: '>= 1.5.2' +Why not pick a string that is not a superset of the general
meson_versionone? That would avoid the need to position it below the project one, and save you having to document that in a long comment. (also avoid the need to add the "break" into the python script, not that that is a big deal!) For example, how about using:
Quoted 4 lines
*
windows_min_meson
*windows_meson_ver
* windowsmeson_min_ver
Or even: "meson_version_windows", since the rest of the pattern we look for occurs after this string.
Quoted 97 lines · Bruce Richardson
Quoted 96 lines · Bruce Richardson
Quoted 11 lines · Andre Muezerie
There is a minimum meson version specified in the DPDK meson project section, which has been documented. This string is parsed by buildtools\get-min-meson-version.py and this information is used by lab automation to install the corresponding meson package on the build machine.
Turns out that the meson version specified on the DPDK project (0.57.x) is buggy on Windows: it has issues related to path manipulation, and these issues are causing failures. Therefore, a newer meson is required on Windows.
Quoted 5 lines
To avoid bringing the minimum requirements up for all operating systems before a more appropriate release, this patch implements a mechanism allowing a different version to be specified for Windows.
Signed-off-by Andre Muezerie <[email protected]>I am fine with the principle, few comments inline below just on the specific implementation.
/Bruce
Quoted 10 lines
--- buildtools/get-min-meson-version.py | 12 ++++++++++-- meson.build | 9 +++++++++ 2 files changed, 19 insertions(+), 2 deletions(-)buildtools/get-min-meson-version.py +0
-0buildtools/get-min-meson-version.py line 20
Quoted 10 lines
buildtools/get-min-meson-version.py +7
-0@@ -11,12 +11,19 @@ basedir = dirname(buildtools_path) with open(join(basedir, "meson.build")) as f: + if os.name == "nt": + keyword = "windows_meson_version" + pattern = r"windows_meson_version:\s*'>=\s*([0-9\.]+)'" + else: + keyword = "meson_version" + pattern = r"meson_version:\s*'>=\s*([0-9\.]+)'" +Minor nit, but I'd suggest shortening this a little to:
keyword = "
meson_version"
if os.name == "nt":
keyword = "windows_" + keyword
pattern = fr"{keyword}:\s*'>=\s*([0-9\.]+)'"or even further shortening gives:
keyword = "windows_meson_version" if os.name == "nt" else "meson_version" pattern = fr"{keyword}:\s*'>=\s*([0-9\.]+)'"Quoted 23 lines
buildtools/get-min-meson-version.py +3
-2for ln in f.readlines(): - if "meson_version" not in ln: + if keyword not in ln: continue ln = ln.strip() - ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + ver_match = re.search(pattern, ln) if not ver_match: print( f"Meson version specifier not in recognised format: '{ln}'",@@ -24,3 +31,4 @@ ) sys.exit(1) print(ver_match.group(1), end="") + breakmeson.build +0
-0@@ -13,6 +13,15 @@ project('DPDK', 'c', meson_version: '>= 0.57.2' )meson.build project('DPDK', 'c', · line 24
Quoted 10 lines
meson.build +9
-0+# Meson does not support dynamic/conditional values for meson_version in +# the project section. +# The line below contains the minimum meson version required on Windows, +# which gets parsed by get-min-meson-version.py. +# It is important to keep this line below the "project" section, so that +# the script can make the correct determination according to the operating +# system. +# windows_meson_version: '>= 1.5.2' +Why not pick a string that is not a superset of the general
meson_versionone? That would avoid the need to position it below the project one, and save you having to document that in a long comment. (also avoid the need to add the "break" into the python script, not that that is a big deal!) For example, how about using:
Quoted 6 lines
Quoted 4 lines
*
windows_min_meson
*windows_meson_ver
* windowsmeson_min_verOr even: "
meson_version_windows", since the rest of the pattern we look for occurs after this string.
I like the 'meson_version_windows' suggested and will send out an updated patch along with the shorter syntax.
I'll keep the "break" though at it will still be needed to avoid a match on Linux when "if keyword not in ln" encounters "meson_version_windows". That break makes sense as there's no point in parsing the rest of the file once the line we're looking for is found.
Quoted 105 lines · Andre Muezerie
Quoted 97 lines · Bruce Richardson
Quoted 96 lines · Bruce Richardson
Quoted 11 lines · Andre Muezerie
There is a minimum meson version specified in the DPDK meson project section, which has been documented. This string is parsed by buildtools\get-min-meson-version.py and this information is used by lab automation to install the corresponding meson package on the build machine.
Turns out that the meson version specified on the DPDK project (0.57.x) is buggy on Windows: it has issues related to path manipulation, and these issues are causing failures. Therefore, a newer meson is required on Windows.
Quoted 5 lines
To avoid bringing the minimum requirements up for all operating systems before a more appropriate release, this patch implements a mechanism allowing a different version to be specified for Windows.
Signed-off-by Andre Muezerie <[email protected]>I am fine with the principle, few comments inline below just on the specific implementation.
/Bruce
Quoted 10 lines
--- buildtools/get-min-meson-version.py | 12 ++++++++++-- meson.build | 9 +++++++++ 2 files changed, 19 insertions(+), 2 deletions(-)buildtools/get-min-meson-version.py +0
-0buildtools/get-min-meson-version.py line 20
Quoted 10 lines
buildtools/get-min-meson-version.py +7
-0@@ -11,12 +11,19 @@ basedir = dirname(buildtools_path) with open(join(basedir, "meson.build")) as f: + if os.name == "nt": + keyword = "windows_meson_version" + pattern = r"windows_meson_version:\s*'>=\s*([0-9\.]+)'" + else: + keyword = "meson_version" + pattern = r"meson_version:\s*'>=\s*([0-9\.]+)'" +Minor nit, but I'd suggest shortening this a little to:
keyword = "
meson_version"
if os.name == "nt":
keyword = "windows_" + keyword
pattern = fr"{keyword}:\s*'>=\s*([0-9\.]+)'"or even further shortening gives:
keyword = "windows_meson_version" if os.name == "nt" else "meson_version" pattern = fr"{keyword}:\s*'>=\s*([0-9\.]+)'"Quoted 23 lines
buildtools/get-min-meson-version.py +3
-2for ln in f.readlines(): - if "meson_version" not in ln: + if keyword not in ln: continue ln = ln.strip() - ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + ver_match = re.search(pattern, ln) if not ver_match: print( f"Meson version specifier not in recognised format: '{ln}'",@@ -24,3 +31,4 @@ ) sys.exit(1) print(ver_match.group(1), end="") + breakmeson.build +0
-0@@ -13,6 +13,15 @@ project('DPDK', 'c', meson_version: '>= 0.57.2' )meson.build project('DPDK', 'c', · line 24
Quoted 10 lines
meson.build +9
-0+# Meson does not support dynamic/conditional values for meson_version in +# the project section. +# The line below contains the minimum meson version required on Windows, +# which gets parsed by get-min-meson-version.py. +# It is important to keep this line below the "project" section, so that +# the script can make the correct determination according to the operating +# system. +# windows_meson_version: '>= 1.5.2' +Why not pick a string that is not a superset of the general
meson_versionone? That would avoid the need to position it below the project one, and save you having to document that in a long comment. (also avoid the need to add the "break" into the python script, not that that is a big deal!) For example, how about using:Quoted 6 lines
Quoted 4 lines
*
windows_min_meson
*windows_meson_ver
* windowsmeson_min_verOr even: "
meson_version_windows", since the rest of the pattern we look for occurs after this string.
Quoted 7 lines
I like the '
meson_version_windows' suggested and will send out an updated patch along with the shorter syntax.
I'll keep the "break" though at it will still be needed to avoid a match on Linux when "if keyword not in ln" encounters "meson_version_windows". That break makes sense as there's no point in parsing the rest of the file once the line we're looking for is found.
Agreed. No prob with keeping it.
If using meson_version_windows, maybe have the comment specifying that immediately on the next line after the regular meson_version statement. It would be good to keep the two specifiers together.
/Bruce
PATCH v2 1/1 buildtools: allow a different minimum meson version for Windows
In reply to Andre MuezerieThere is a minimum meson version specified in the DPDK meson project section, which has been documented. This string is parsed by buildtools\get-min-meson-version.py and this information is used by lab automation to install the corresponding meson package on the build machine.
Turns out that the meson version specified on the DPDK project (0.57.x) is buggy on Windows: it has issues related to path manipulation, and these issues are causing failures. Therefore, a newer meson is required on Windows.
To avoid bringing the minimum requirements up for all operating systems before a more appropriate release, this patch implements a mechanism allowing a different version to be specified for Windows.
--- buildtools/get-min-meson-version.py | 8 ++++++-- meson.build | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
buildtools/get-min-meson-version.py +6 -2
@@ -11,12 +11,15 @@ basedir = dirname(buildtools_path) with open(join(basedir, "meson.build")) as f: + keyword = "meson_version_windows" if os.name == "nt" else "meson_version" + pattern = fr"{keyword}:\s*'>=\s*([0-9\.]+)'" + for ln in f.readlines(): - if "meson_version" not in ln: + if keyword not in ln: continue ln = ln.strip() - ver_match = re.search(r"meson_version:\s*'>=\s*([0-9\.]+)'", ln) + ver_match = re.search(pattern, ln) if not ver_match: print( f"Meson version specifier not in recognised format: '{ln}'",
@@ -24,3 +27,4 @@ ) sys.exit(1) print(ver_match.group(1), end="") + break
meson.build +1 -0
@@ -11,6 +11,7 @@ project('DPDK', 'c', 'warning_level=2', ], meson_version: '>= 0.57.2' + # meson_version_windows: '>= 1.5.2' ) fs = import('fs')
Signature · 1 line
2.49.0.vfs.0.3
Quoted 15 lines · Andre Muezerie
There is a minimum meson version specified in the DPDK meson project section, which has been documented. This string is parsed by buildtools\get-min-meson-version.py and this information is used by lab automation to install the corresponding meson package on the build machine.
Turns out that the meson version specified on the DPDK project (0.57.x) is buggy on Windows: it has issues related to path manipulation, and these issues are causing failures. Therefore, a newer meson is required on Windows.
To avoid bringing the minimum requirements up for all operating systems before a more appropriate release, this patch implements a mechanism allowing a different version to be specified for Windows.
Quoted 6 lines
Signed-off-by Andre Muezerie <[email protected]>--- buildtools/get-min-meson-version.py | 8 ++++++-- meson.build | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
Seems a reasonable, simple workaround to me.
David Marchand
AppliedQuoted 13 lines · Bruce Richardson
Quoted 11 lines · Andre Muezerie
There is a minimum meson version specified in the DPDK meson project section, which has been documented. This string is parsed by buildtools\get-min-meson-version.py and this information is used by lab automation to install the corresponding meson package on the build machine.
Turns out that the meson version specified on the DPDK project (0.57.x) is buggy on Windows: it has issues related to path manipulation, and these issues are causing failures. Therefore, a newer meson is required on Windows.
Quoted 6 lines
Quoted 5 lines
To avoid bringing the minimum requirements up for all operating systems before a more appropriate release, this patch implements a mechanism allowing a different version to be specified for Windows.
Signed-off-by Andre Muezerie <[email protected]>Acked-by Bruce Richardson <[email protected]>
Applied, thanks.
Two (non blocking) comments on this patch:
- could you send a followup patch for using this with the MSVC target in GHA (see .github/workflows/build.yml) ?
- there is nothing really checking whether the minimum version is correct on Windows.
Would it make sense to have a "runtime" check in meson out of theproject() declaration?
Something like (untested, probably broken):
meson.build +5 -1
@@ -11,9 +11,13 @@ project('DPDK', 'c', 'warning_level=2', ], meson_version: '>= 0.57.2' - # meson_version_windows: '>= 1.5.2' ) +meson_version_windows='1.5.2' +if is_windows and meson.version() < meson_version_windows + error('Minimum meson version on Windows is ' + meson_version_windows) +endif + fs = import('fs') # check for developer mode
Signature · 1 line
David Marchand