rust: Minor formatting fix on available Rust version.

Christian Kujau posted 1 patch 3 years ago
rust: Minor formatting fix on available Rust version.
Posted by Christian Kujau 3 years ago
In Fedora (and possibly other distributions too) rustc is versioned as:
    
$ rustc --version
rustc 1.67.1 (d5a82bbd2 2023-02-07) (Fedora 1.67.1-1.fc37)
    
This makes "make rustavailable" report the version twice:
    
*** Rust compiler 'rustc' is too new. This may or may not work.
***   Your version:     1.67.1
1.67.1
***   Expected version: 1.62.0
    
Fix that by only reporting the first version number.
    
Signed-off-by: Christian Kujau <lists@nerdbynature.de>
---
diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh
index aebbf1913970..6b5d25e36538 100755
--- a/scripts/rust_is_available.sh
+++ b/scripts/rust_is_available.sh
@@ -46,8 +46,8 @@ fi
 # Non-stable and distributions' versions may have a version suffix, e.g. `-dev`.
 rust_compiler_version=$( \
 	LC_ALL=C "$RUSTC" --version 2>/dev/null \
-		| head -n 1 \
 		| grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \
+		| head -n 1
 )
 rust_compiler_min_version=$($min_tool_version rustc)
 rust_compiler_cversion=$(get_canonical_version $rust_compiler_version)

-- 
BOFH excuse #398:

Data for intranet got routed through the extranet and landed on the internet.
Re: rust: Minor formatting fix on available Rust version.
Posted by Miguel Ojeda 3 years ago
Hi Christian,

On Wed, Mar 15, 2023 at 9:45 PM Christian Kujau <lists@nerdbynature.de> wrote:
>
> In Fedora (and possibly other distributions too) rustc is versioned as:
>
> $ rustc --version
> rustc 1.67.1 (d5a82bbd2 2023-02-07) (Fedora 1.67.1-1.fc37)
>
> This makes "make rustavailable" report the version twice:

Thanks for the patch! This one is getting fixed (along with a few
other improvements) in another patch series that is currently in
progress.

Cheers,
Miguel