Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7309248rwd; Mon, 19 Jun 2023 22:37:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ABrP/gb2uKV/jg+WSfvpZ8yyv3zKQjA6bosklLAMan/x5CgHuFNNxivzgnwbQxUD3EOUS X-Received: by 2002:ac8:5989:0:b0:3f9:cbf0:40c7 with SMTP id e9-20020ac85989000000b003f9cbf040c7mr3759948qte.12.1687239440160; Mon, 19 Jun 2023 22:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687239440; cv=none; d=google.com; s=arc-20160816; b=L6RSQ6NEFcVYt6cfVNnObBxchEPNAI0nkKECUIe+U9OGOPSg1iL9tyeqA0Di4xU7NG K3coM/yv+FJ5nUt4FXSB3+KuQHObppmrDdGEf25SRNuCHbgE1QwNxqOkwe7SaIr/Ui8S 3bdVj1Ixb17d6ym7pG1Hk8jMytPzZwJ4tbuHI2BHsbEHk+aPWWKTxHIqm9/8U2Bqm2xr csgKtbz2Mfh5RjgLFlwPPLrODRtx9jzEOtVwmrh83wN48IkW76KnKU+5Eu03x10KnMil CmCCDtBktIoFZJtEFoLM1DggQP25kiLIZzdDs2Ecx9/n/u2R83gwjvhEk1t1YpwYwuOV HIdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6SFUvH+zA9zQpTehjZOxcbE2Hj5rbIRO/uzgu7rr+kM=; b=xN95I4XQ0bM8mohkWl61ir8w0rgz9f/kUm45fuk5xh43bObe68Ggf2Ppql50ArvdND C0sYMqpI3MdMqGBpgQ619vAd41tq+LkYlA3bROXyyMQ/5vUIdA0hDHwtb77QFNj899UU n5UYhQJKJKTySocMbtLQoMvKZQpcdwqBa1nLyfimjzcCp7pql9sR5B8KQwsbUAoNkqon NhjSxFD9rRsFSTj73sxsI6maU1s0nr+jpSWk3/UZNm/g/1rXRX0Vh0u/4vcoJySSSDwC 67YFOZD9sTRR86aRZpnghec5CzgyrWVOmj2pXJPUgWHTIrFG2bf7+p5fMbbOe3CzRu2N hXZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="OQx/8INO"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h187-20020a6253c4000000b00668724d0816si995327pfb.38.2023.06.19.22.37.08; Mon, 19 Jun 2023 22:37:20 -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="OQx/8INO"; 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 S230341AbjFTFQp (ORCPT + 99 others); Tue, 20 Jun 2023 01:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjFTFQo (ORCPT ); Tue, 20 Jun 2023 01:16:44 -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 DD08110D7; Mon, 19 Jun 2023 22:16:42 -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 7121960FBB; Tue, 20 Jun 2023 05:16:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBC1EC433C0; Tue, 20 Jun 2023 05:16:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687238201; bh=hzpaa3iGkGe9xtkcsnYk+Um0tqxkVjDTyjZm8EOU0Os=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OQx/8INO9GEPdUH3BI8erf6zQ9q4FihvaiEzWpSyC6i//qpAbEAYcW5jze8qcuSIo cReVt2JMp8KbSAlKMT7vzYzat8HB61aqay4Ei4Ft4o++q9oIyaIEt0mCeGC1LlmXCL g9AqkfPJdpGqYQcUJEPMJD8RTn6py4/BOr6bwPSh0YF28we0KZWAODkuEmQSNjMUhS VohJkux7BF2mEpBj8yK71BVkGdZ1vbObE2jy/pI51DNkUMJpkaAl+UOsfG7teYJJuh OlYa3/aIPSNurQ3eurJezaMmkkeofnLbxhnpiuo4wtNx/LFpm3WEweIQ+/6RyQn9kf Hudmn8djwc6Sg== Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5607a462bb7so849930eaf.3; Mon, 19 Jun 2023 22:16:41 -0700 (PDT) X-Gm-Message-State: AC+VfDzmKuQanDWECRyfrF8JcAi/pA/qu87u9mNfE2ceWMsPn6za0ckc SGrU6rc+9yPvnAy6q+5jm7jiqvkPHRCcAOkntb4= X-Received: by 2002:a4a:ba1a:0:b0:560:8d95:55f4 with SMTP id b26-20020a4aba1a000000b005608d9555f4mr790814oop.4.1687238201141; Mon, 19 Jun 2023 22:16:41 -0700 (PDT) MIME-Version: 1.0 References: <20230616001631.463536-1-ojeda@kernel.org> <20230616001631.463536-9-ojeda@kernel.org> In-Reply-To: <20230616001631.463536-9-ojeda@kernel.org> From: Masahiro Yamada Date: Tue, 20 Jun 2023 14:16:05 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 08/11] kbuild: rust_is_available: normalize version matching To: Miguel Ojeda Cc: Wedson Almeida Filho , Alex Gaynor , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Andreas Hindborg , linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 16, 2023 at 9:17=E2=80=AFAM Miguel Ojeda wro= te: > > 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 Reviewed-by: Masahiro Yamada > --- > 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=3D$( \ > LC_ALL=3DC "$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=3D$($min_tool_version rustc) > rust_compiler_cversion=3D$(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=3D$( \ > LC_ALL=3DC "$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=3D$($min_tool_version bindgen) > rust_bindings_generator_cversion=3D$(get_canonical_version $rust_binding= s_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 a= ppear > +# in the first line of the output, thus no `sed` address is provided. > bindgen_libclang_version=3D$( \ > echo "$bindgen_libclang_output" \ > | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\= 1:p' > -- > 2.41.0 > --=20 Best Regards Masahiro Yamada