Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2988273rwd; Fri, 16 Jun 2023 10:40:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6HE4jLxQ9s+RJbPB2k+F62e7NA9DcrUeWCSg7IE2ba0Tj3bgV9nAfvomBgm04svYwrFM26 X-Received: by 2002:a05:6358:51d7:b0:12b:d2fa:c48b with SMTP id 23-20020a05635851d700b0012bd2fac48bmr1945929rwl.31.1686937209547; Fri, 16 Jun 2023 10:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686937209; cv=none; d=google.com; s=arc-20160816; b=gulGN9WXQ7RVxN4d9ntN1eWUHuhSNoDlh4usKQm0tbcasqkPPn5rn4b4z2YUHF1f1F 1nUNCFKonMcl4VUhIvLxTN1qGhgapWIhacwQRYyO8IHUpVU+hjKTGWhVkrwrRIjDn13V I+OLrkldS2tLYmxYtEzZcLZ0rz/Te3aOM7SPBYqmZNO5nMB3lt24Qv7W76yBcerQ5XFa wpzUKtil2qvuogMg8Q+kqKBDOX2mXjnk7FjI0wt8UmbtQgwFBN+DRWzoBz/kLkiRdAvj ouHh+PGo+vMHjPdOze9GNPJ4xyUJoozukvN6PQ5lp/7qR9Ls4bE8r3ja06hi1gaR0rji kyhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rkl1Fc4HrpA6qhzk/UqBJw4FCdRTGyQEAlupv8w24Hk=; b=fIx4WC7lZRLxXqyJ/pKKoEHhPbpgTXzsLGNMJfiWu9ladLbuLkYoJwwIXRduc7iXUg a6Yq9eVBFT24BGipY1GLXT779tntk6csT3PiRHbWF2bQT8JTetNTxZ46JuN/Q/bP1Ys1 NaMdRQDP5HPH7oFX7Fbgqi2rgDzTCEkq1nQOz2qfLQ/1ouNW+kRkHiYZHrVthmyMEpxo nBZUUFfoJQRbgOuerQvt45ac5iHUYXuw+INCA6RILgaM1fQO+99EPugA28VJdVNaSdCq CLuoAuBDs6EJy5SLBRKqxol450mjsF/X4kgDaxollMbPvvUEs9XlKgMnq3oibOaQgV27 4iTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SRX4YA2O; 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 a25-20020a637f19000000b0053fa2f589aesi3087472pgd.884.2023.06.16.10.39.56; Fri, 16 Jun 2023 10:40:09 -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=SRX4YA2O; 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 S1346079AbjFPRPH (ORCPT + 99 others); Fri, 16 Jun 2023 13:15:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346115AbjFPROm (ORCPT ); Fri, 16 Jun 2023 13:14:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E038A35AB; Fri, 16 Jun 2023 10:14:37 -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 78DA463702; Fri, 16 Jun 2023 17:14:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B502C433C8; Fri, 16 Jun 2023 17:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686935676; bh=qKxKYOgkzPTzgd9ZUdj6C8hJSgcy3ibMbk9V0xphn48=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SRX4YA2O751yHoSKKaP/tmeRHCFXNCnveUNGDQGAtfcFeq+qei5GO6PYrS5wAmHB4 ywFWKPfSDb+rh2qnNqt3V189flJ3dqO8dGOMStMERjYbTrGIR9VFJmdrGy67+BJDUB LS4BRWw44IhqkIW1GpIGzzDs5TTpfxfOyszjGG650YcUTTLoPlOjvLAuH9gjrEIsBL zcZTp3pSdnWXM+eHDaQc9tERaOTp64/vLnNMVBe5f6ETASbeXCEr7Pze4TTAoa9bLR N2o0kBe4KxpH6RfgdsABEIw3qgybaH3YCfXWbZcQiaSyJtl8bUnCg3VT0lQKXMXgNh uIx1xDEF5M7Aw== Date: Fri, 16 Jun 2023 10:14:34 -0700 From: Nathan Chancellor To: Miguel Ojeda Cc: Masahiro Yamada , Wedson Almeida Filho , Alex Gaynor , Nick Desaulniers , Nicolas Schier , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= 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 Subject: Re: [PATCH v2 08/11] kbuild: rust_is_available: normalize version matching Message-ID: <20230616171434.GG3474164@dev-arch.thelio-3990X> References: <20230616001631.463536-1-ojeda@kernel.org> <20230616001631.463536-9-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230616001631.463536-9-ojeda@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 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 Reviewed-by: Nathan Chancellor > --- > 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 >