Message ID | 20230616001631.463536-8-ojeda@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | `scripts/rust_is_available.sh` improvements | expand |
On 6/15/23 21:16, Miguel Ojeda wrote: > `bindgen`'s output for `libclang`'s version check contains paths, which > in turn may contain strings that look like version numbers [1][2]: > > .../6.1.0-dev/.../rust_is_available_bindgen_libclang.h:2:9: warning: clang version 11.1.0 [-W#pragma-messages], err: false > > which the script will pick up as the version instead of the latter. > > It is also the case that versions may appear after the actual version > (e.g. distribution's version text), which was the reason behind `head` [3]: > > .../rust-is-available-bindgen-libclang.h:2:9: warning: clang version 13.0.0 (Fedora 13.0.0-3.fc35) [-W#pragma-messages], err: false > > Thus instead ask for a match after the `clang version` string. > > Reported-by: Jordan Isaacs <mail@jdisaacs.com> > Closes: https://github.com/Rust-for-Linux/linux/issues/942 [1] > Reported-by: Ethan D. Twardy <ethan.twardy@gmail.com> > Closes: https://lore.kernel.org/rust-for-linux/20230528131802.6390-2-ethan.twardy@gmail.com/ [2] > Reported-by: Tiago Lam <tiagolam@gmail.com> > Closes: https://github.com/Rust-for-Linux/linux/pull/789 [3] > Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> > --- > [...] Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
On Fri, Jun 16, 2023 at 02:16:27AM +0200, Miguel Ojeda wrote: > `bindgen`'s output for `libclang`'s version check contains paths, which > in turn may contain strings that look like version numbers [1][2]: > > .../6.1.0-dev/.../rust_is_available_bindgen_libclang.h:2:9: warning: clang version 11.1.0 [-W#pragma-messages], err: false > > which the script will pick up as the version instead of the latter. > > It is also the case that versions may appear after the actual version > (e.g. distribution's version text), which was the reason behind `head` [3]: > > .../rust-is-available-bindgen-libclang.h:2:9: warning: clang version 13.0.0 (Fedora 13.0.0-3.fc35) [-W#pragma-messages], err: false > > Thus instead ask for a match after the `clang version` string. > > Reported-by: Jordan Isaacs <mail@jdisaacs.com> > Closes: https://github.com/Rust-for-Linux/linux/issues/942 [1] > Reported-by: Ethan D. Twardy <ethan.twardy@gmail.com> > Closes: https://lore.kernel.org/rust-for-linux/20230528131802.6390-2-ethan.twardy@gmail.com/ [2] > Reported-by: Tiago Lam <tiagolam@gmail.com> > Closes: https://github.com/Rust-for-Linux/linux/pull/789 [3] > Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> > --- > scripts/rust_is_available.sh | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh > index 7e0368babe64..810691af66eb 100755 > --- a/scripts/rust_is_available.sh > +++ b/scripts/rust_is_available.sh > @@ -157,9 +157,7 @@ fi > # of the `libclang` found by the Rust bindings generator is suitable. > bindgen_libclang_version=$( \ > echo "$bindgen_libclang_output" \ > - | grep -F 'clang version ' \ > - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ > - | head -n 1 \ > + | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' > ) > bindgen_libclang_min_version=$($min_tool_version llvm) > bindgen_libclang_cversion=$(get_canonical_version $bindgen_libclang_version) > -- > 2.41.0 >
On Thu Jun 15, 2023 at 7:16 PM CDT, Miguel Ojeda wrote: > --- > scripts/rust_is_available.sh | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh > index 7e0368babe64..810691af66eb 100755 > --- a/scripts/rust_is_available.sh > +++ b/scripts/rust_is_available.sh > @@ -157,9 +157,7 @@ fi > # of the `libclang` found by the Rust bindings generator is suitable. > bindgen_libclang_version=$( \ > echo "$bindgen_libclang_output" \ > - | grep -F 'clang version ' \ > - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ > - | head -n 1 \ > + | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' > ) > bindgen_libclang_min_version=$($min_tool_version llvm) > bindgen_libclang_cversion=$(get_canonical_version $bindgen_libclang_version) Reviewed-By: Ethan Twardy <ethan.twardy@gmail.com> Tested-By: Ethan Twardy <ethan.twardy@gmail.com>
diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh index 7e0368babe64..810691af66eb 100755 --- a/scripts/rust_is_available.sh +++ b/scripts/rust_is_available.sh @@ -157,9 +157,7 @@ fi # of the `libclang` found by the Rust bindings generator is suitable. bindgen_libclang_version=$( \ echo "$bindgen_libclang_output" \ - | grep -F 'clang version ' \ - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ - | head -n 1 \ + | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' ) bindgen_libclang_min_version=$($min_tool_version llvm) bindgen_libclang_cversion=$(get_canonical_version $bindgen_libclang_version)
`bindgen`'s output for `libclang`'s version check contains paths, which in turn may contain strings that look like version numbers [1][2]: .../6.1.0-dev/.../rust_is_available_bindgen_libclang.h:2:9: warning: clang version 11.1.0 [-W#pragma-messages], err: false which the script will pick up as the version instead of the latter. It is also the case that versions may appear after the actual version (e.g. distribution's version text), which was the reason behind `head` [3]: .../rust-is-available-bindgen-libclang.h:2:9: warning: clang version 13.0.0 (Fedora 13.0.0-3.fc35) [-W#pragma-messages], err: false Thus instead ask for a match after the `clang version` string. Reported-by: Jordan Isaacs <mail@jdisaacs.com> Closes: https://github.com/Rust-for-Linux/linux/issues/942 [1] Reported-by: Ethan D. Twardy <ethan.twardy@gmail.com> Closes: https://lore.kernel.org/rust-for-linux/20230528131802.6390-2-ethan.twardy@gmail.com/ [2] Reported-by: Tiago Lam <tiagolam@gmail.com> Closes: https://github.com/Rust-for-Linux/linux/pull/789 [3] Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") Signed-off-by: Miguel Ojeda <ojeda@kernel.org> --- scripts/rust_is_available.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)