Message ID | 20230616001631.463536-9-ojeda@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp997708vqr; Thu, 15 Jun 2023 17:20:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4aDcyzDx9AKnRqjNkBpVpI8TvTHnl5mc/M7QUUjdhXo7PEtlnK4N616sj7Oq+ABpkLPLE6 X-Received: by 2002:a05:6a00:398f:b0:64f:aea5:7b49 with SMTP id fi15-20020a056a00398f00b0064faea57b49mr609680pfb.17.1686874854544; Thu, 15 Jun 2023 17:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686874854; cv=none; d=google.com; s=arc-20160816; b=Dlu5p56TyK4O3omRV9tLtJxFh9j2vV0bPh0hQxu3+foecSAn/4uz1nIqdSn4h6uv2n nH7ATetzwxrRIwPcawX+OBnx4Pwi3UX9oq+qRuVZt+dgHBnlns+G0CzfZl8PCIA9rICp ZnS9g711TPOkUGXDa2EgK1XKAkC8TcFOVXABSl7OrWTBJGtT78Mn5cSHQbR4JcqNl46i 59e3Uxp716p21QocoSEOcLWg6CZQ61RtjASQxyoFw9ssmbkjwQ5HboLLaN6oSiQO4djC Cfc8QTGw2BziVOaSow4DoP/3dK0KcsbdqLyv+c2bBCAf2OiXgLUYBxARiVGPLBNsORB0 Fh/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MfRyuQ32BoUJRgW35m44bHQZNmbc1lA7wKNEsVFmKCc=; b=zLKYakCcwPhsfLw6lMXnTd1qnVak6YEFXgR+mtnZo46yzWQfVblT7HVoa1hC7yDLip QFY2GmQGdMLVdBQEPSTpm7O16Oi/pjjR08qpWyKNgTjeL46CELUc/UucvWZVe5zNP5hv r0QC2XvmYceUV/0rZt/28RjTtz4ydCcdPjIJMA6U6jSREvxdyCR6M3ix4YKzM1iE0wxj 3L88yL1oHQWSqcXShWp6CwB+jmfLAf19G2SQ1bqc0TsjHnAgKuERkTKUPJR/hwjxn/Jo SyRZjbuwGRmjHz1VZ5nZLVY92mpmaMCCTyn5JzbznHysRbzIPU2qqMrHsVSRpVWgVpcf 3K/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U4pjlbre; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o25-20020a637e59000000b0054fef4ea777si2867250pgn.853.2023.06.15.17.20.40; Thu, 15 Jun 2023 17:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U4pjlbre; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239085AbjFPATB (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Thu, 15 Jun 2023 20:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240744AbjFPAS3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 15 Jun 2023 20:18:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB83F30E2; Thu, 15 Jun 2023 17:17:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2DB1361C41; Fri, 16 Jun 2023 00:17:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87B9EC433CD; Fri, 16 Jun 2023 00:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686874650; bh=cWinNtrRNqE72MtzHUXpxkJuCIniJrJ/uXuToYRgE8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U4pjlbreSJh9xy6s1BVW1nZNWwe/mqd4ae8t1KeqbwB3Ysvqq1EGaav9keNOgmjsP ovdjamLawMDqyYPc60zbyVGqeE6ksaaCP0+QsqurNC3ln7zmMY3453C1HjzVqF6jg7 4Dn/mw1QLIjnJ52Xp9kyOq15f6CPoYYu///mZ7jnEP+8Jf42Y78bqCwJ6YIDcCDr9Q V64YSPbKv0IeJLlbaqJxfbXUknmCoGJ0CtfQlCn1y86nX7FobYO2NgY21J5VBtbrEp Sj/WTRvG7JKTfCXw06IkuhgXSJf1K3J4coLC6kmuh4qwjKcL2atUexEQ3Wif7z7ydl 50hQVfO2T/qEg== From: Miguel Ojeda <ojeda@kernel.org> To: Masahiro Yamada <masahiroy@kernel.org>, Miguel Ojeda <ojeda@kernel.org>, Wedson Almeida Filho <wedsonaf@gmail.com>, Alex Gaynor <alex.gaynor@gmail.com> Cc: Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Nicolas Schier <nicolas@fjasle.eu>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, Benno Lossin <benno.lossin@proton.me>, Alice Ryhl <aliceryhl@google.com>, Andreas Hindborg <nmi@metaspace.dk>, linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: [PATCH v2 08/11] kbuild: rust_is_available: normalize version matching Date: Fri, 16 Jun 2023 02:16:28 +0200 Message-ID: <20230616001631.463536-9-ojeda@kernel.org> In-Reply-To: <20230616001631.463536-1-ojeda@kernel.org> References: <20230616001631.463536-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768816487782050276?= X-GMAIL-MSGID: =?utf-8?q?1768816487782050276?= |
Series |
`scripts/rust_is_available.sh` improvements
|
|
Commit Message
Miguel Ojeda
June 16, 2023, 12:16 a.m. UTC
In order to match the version string, `sed` is used in a couple
cases, and `grep` and `head` in a couple others.
Make the script more consistent and easier to understand by
using the same method, `sed`, for all of them.
This makes the version matching also a bit more strict for
the changed cases, since the strings `rustc ` and `bindgen `
will now be required, which should be fine since `rustc`
complains if one attempts to call it with another program
name, and `bindgen` uses a hardcoded string.
In addition, clarify why one of the existing `sed` commands
does not provide an address like the others.
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
scripts/rust_is_available.sh | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Comments
On 6/15/23 21:16, Miguel Ojeda wrote: > In order to match the version string, `sed` is used in a couple > cases, and `grep` and `head` in a couple others. > > Make the script more consistent and easier to understand by > using the same method, `sed`, for all of them. > > This makes the version matching also a bit more strict for > the changed cases, since the strings `rustc ` and `bindgen ` > will now be required, which should be fine since `rustc` > complains if one attempts to call it with another program > name, and `bindgen` uses a hardcoded string. > > In addition, clarify why one of the existing `sed` commands > does not provide an address like the others. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> > --- > [...] Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
On Fri, Jun 16, 2023 at 02:16:28AM +0200, Miguel Ojeda wrote: > In order to match the version string, `sed` is used in a couple > cases, and `grep` and `head` in a couple others. > > Make the script more consistent and easier to understand by > using the same method, `sed`, for all of them. > > This makes the version matching also a bit more strict for > the changed cases, since the strings `rustc ` and `bindgen ` > will now be required, which should be fine since `rustc` > complains if one attempts to call it with another program > name, and `bindgen` uses a hardcoded string. > > In addition, clarify why one of the existing `sed` commands > does not provide an address like the others. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> > --- > scripts/rust_is_available.sh | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh > index 810691af66eb..b7e0781fdea9 100755 > --- a/scripts/rust_is_available.sh > +++ b/scripts/rust_is_available.sh > @@ -83,8 +83,7 @@ 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]+' \ > + | sed -nE '1s:.*rustc ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' > ) > rust_compiler_min_version=$($min_tool_version rustc) > rust_compiler_cversion=$(get_canonical_version $rust_compiler_version) > @@ -111,8 +110,7 @@ fi > # Non-stable and distributions' versions may have a version suffix, e.g. `-dev`. > rust_bindings_generator_version=$( \ > LC_ALL=C "$BINDGEN" --version 2>/dev/null \ > - | head -n 1 \ > - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ > + | sed -nE '1s:.*bindgen ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' > ) > rust_bindings_generator_min_version=$($min_tool_version bindgen) > rust_bindings_generator_cversion=$(get_canonical_version $rust_bindings_generator_version) > @@ -155,6 +153,9 @@ fi > > # `bindgen` returned successfully, thus use the output to check that the version > # of the `libclang` found by the Rust bindings generator is suitable. > +# > +# Unlike other version checks, note that this one does not necessarily appear > +# in the first line of the output, thus no `sed` address is provided. > bindgen_libclang_version=$( \ > echo "$bindgen_libclang_output" \ > | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' > -- > 2.41.0 >
On Fri, Jun 16, 2023 at 9:17 AM Miguel Ojeda <ojeda@kernel.org> wrote: > > In order to match the version string, `sed` is used in a couple > cases, and `grep` and `head` in a couple others. > > Make the script more consistent and easier to understand by > using the same method, `sed`, for all of them. > > This makes the version matching also a bit more strict for > the changed cases, since the strings `rustc ` and `bindgen ` > will now be required, which should be fine since `rustc` > complains if one attempts to call it with another program > name, and `bindgen` uses a hardcoded string. > > In addition, clarify why one of the existing `sed` commands > does not provide an address like the others. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Masahiro Yamada <masahiroy@kernel.org> > --- > scripts/rust_is_available.sh | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh > index 810691af66eb..b7e0781fdea9 100755 > --- a/scripts/rust_is_available.sh > +++ b/scripts/rust_is_available.sh > @@ -83,8 +83,7 @@ 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]+' \ > + | sed -nE '1s:.*rustc ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' > ) > rust_compiler_min_version=$($min_tool_version rustc) > rust_compiler_cversion=$(get_canonical_version $rust_compiler_version) > @@ -111,8 +110,7 @@ fi > # Non-stable and distributions' versions may have a version suffix, e.g. `-dev`. > rust_bindings_generator_version=$( \ > LC_ALL=C "$BINDGEN" --version 2>/dev/null \ > - | head -n 1 \ > - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ > + | sed -nE '1s:.*bindgen ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' > ) > rust_bindings_generator_min_version=$($min_tool_version bindgen) > rust_bindings_generator_cversion=$(get_canonical_version $rust_bindings_generator_version) > @@ -155,6 +153,9 @@ fi > > # `bindgen` returned successfully, thus use the output to check that the version > # of the `libclang` found by the Rust bindings generator is suitable. > +# > +# Unlike other version checks, note that this one does not necessarily appear > +# in the first line of the output, thus no `sed` address is provided. > bindgen_libclang_version=$( \ > echo "$bindgen_libclang_output" \ > | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' > -- > 2.41.0 >
diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh index 810691af66eb..b7e0781fdea9 100755 --- a/scripts/rust_is_available.sh +++ b/scripts/rust_is_available.sh @@ -83,8 +83,7 @@ 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]+' \ + | sed -nE '1s:.*rustc ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' ) rust_compiler_min_version=$($min_tool_version rustc) rust_compiler_cversion=$(get_canonical_version $rust_compiler_version) @@ -111,8 +110,7 @@ fi # Non-stable and distributions' versions may have a version suffix, e.g. `-dev`. rust_bindings_generator_version=$( \ LC_ALL=C "$BINDGEN" --version 2>/dev/null \ - | head -n 1 \ - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ + | sed -nE '1s:.*bindgen ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' ) rust_bindings_generator_min_version=$($min_tool_version bindgen) rust_bindings_generator_cversion=$(get_canonical_version $rust_bindings_generator_version) @@ -155,6 +153,9 @@ fi # `bindgen` returned successfully, thus use the output to check that the version # of the `libclang` found by the Rust bindings generator is suitable. +# +# Unlike other version checks, note that this one does not necessarily appear +# in the first line of the output, thus no `sed` address is provided. bindgen_libclang_version=$( \ echo "$bindgen_libclang_output" \ | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p'