Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7315805rwd; Mon, 19 Jun 2023 22:45:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6sIPtRvWDTARQUoRFSHxY37uM6D8BrzPeVTIe9pcM3s2wiPZ77ggIApIV4fYcA1CD61nt0 X-Received: by 2002:a92:b08:0:b0:340:917c:41b2 with SMTP id b8-20020a920b08000000b00340917c41b2mr11280245ilf.14.1687239917663; Mon, 19 Jun 2023 22:45:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687239917; cv=none; d=google.com; s=arc-20160816; b=OD7Gm+sbd/0cfxu5ifsCjr9lLsIB6NMqcmnHKqi2j/gkAbDz6G0SWKK8btzwYwAIYs HU8eFgO13pwTSDbz3CmXtii4JXHwCdwvHD2SZF05WsmieJt7y8FNMtoRliqVPLNODTfT kwBUnSCXYzuvocAKRT6CswU4GA65s0GDTm5Yfrj0HFv897tc1bJ1sXYj5o3xtJNS6WMJ VztoV1Bent/XpvLjpKEr5k5ZLugK9JX4yWIgZ7jDjbzV8ixkbQ9LHz6hNxeCZzSpm7tf +S4G+p0lbb+DEHkKCowJIK4FtoAWNS/FtTB8qj4O1CmDLjD3/SUW+w30nR3Dc28RJ66Q Lcew== 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=wyNg9rKyF56VANYE7OH1/YFqvEfrbd1TWA1bvoIvjdA=; b=eq8R+V/UkYLQIIeoD7mwoNw4jnICXubreaLGjpCq2v8JzdnjtnoYkQHhmw33EfK3KU BfpLsr0qE21gqlDQbtZZPogv94wsQyAK1j19Kxu6wctNIBNZdrKfUCOwfovRzHy49gsy /8v3pFmawhtWAMdniZePYqyXscbzpTATE+9MREi3dh6OxVQtSFwYCeoPbWmCW5v+9Kax 35ya7wwi7l6zKCrRxJZx+gehbU24VqeiLFsWRjnc3GLAb5KeQT4qK0IIQx51KPMprgTl wucVr9Ql4CQ0m5c1BgJ+DEYXJ9giy/8x8BxxDWYBUDAd0qqZ4SWNNJwBCLreK4vawfjp /P8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jo5XT1eH; 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 x5-20020a654145000000b00553a50c5d85si953422pgp.510.2023.06.19.22.45.05; Mon, 19 Jun 2023 22:45:17 -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=Jo5XT1eH; 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 S230399AbjFTF1Q (ORCPT + 99 others); Tue, 20 Jun 2023 01:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbjFTF1M (ORCPT ); Tue, 20 Jun 2023 01:27:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC2EA185; Mon, 19 Jun 2023 22:27:11 -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 47FD260F38; Tue, 20 Jun 2023 05:27:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E00FC433D9; Tue, 20 Jun 2023 05:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687238830; bh=tiI3VGfsL8gKc/bRU3EleHUPx2M61lfNJEcBUuB9vq0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Jo5XT1eH8P9E1q9rMYFPNxTTfxBO4FO181LfsG6wKE2KIzeB7qiTR0zzqL9Y5aZZm HA0uqEnlC1U/j8swQtMPARhkivxwBykY1b3ee5cv4tkgZFaZK9Rve2CSGuXNtCcc4g WmP+TaGYaI2kF2ZsWJNfzMvgUKo3mcCeK6rxRVAisO5tL+wrQI3oH4SYTG+0mToZkl jx7yZIYQpHlhjn3rZuTrBiP2b4fOUK4KXNQ0Se+GAar/zA5TXDlPt6FQyC4kQrt41F lgwwpT9CTp+PsZHgolTIDizdyVv5FuHjy7eMZzBSzWdQu2qoaVjVVHygE+jGaQ+SeY bRxVyTL3iYOiQ== Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-558a79941c6so2874463eaf.3; Mon, 19 Jun 2023 22:27:10 -0700 (PDT) X-Gm-Message-State: AC+VfDwgFS0n1na18gAvvg+ha1EYlAU4bc/nMejaDkVicyEmKDIpxDkw NQP/VID3HAUwypsBzsXkcbRpcTAjQmVHsFuNlTg= X-Received: by 2002:a4a:a7cd:0:b0:55e:54db:c453 with SMTP id n13-20020a4aa7cd000000b0055e54dbc453mr3955562oom.7.1687238829822; Mon, 19 Jun 2023 22:27:09 -0700 (PDT) MIME-Version: 1.0 References: <20230616001631.463536-1-ojeda@kernel.org> <20230616001631.463536-5-ojeda@kernel.org> In-Reply-To: <20230616001631.463536-5-ojeda@kernel.org> From: Masahiro Yamada Date: Tue, 20 Jun 2023 14:26:33 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 04/11] kbuild: rust_is_available: print docs reference 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, Finn Behrens Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 9:17=E2=80=AFAM Miguel Ojeda wro= te: > > People trying out the Rust support in the kernel may get > warnings and errors from `scripts/rust_is_available.sh` > from the `rustavailable` target or the build step. > > Some of those users may be following the Quick Start guide, > but others may not (likely those getting warnings from > the build step instead of the target). > > While the messages are fairly clear on what the problem is, > it may not be clear how to solve the particular issue, > especially for those not aware of the documentation. > > We could add all sorts of details on the script for each one, > but it is better to point users to the documentation instead, > where it is easily readable in different formats. It also > avoids duplication. > > Thus add a reference to the documentation whenever the script > fails or there is at least a warning. > > Reviewed-by: Finn Behrens > Signed-off-by: Miguel Ojeda > --- > scripts/rust_is_available.sh | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh > index 0c9be438e4cd..6b8131d5b547 100755 > --- a/scripts/rust_is_available.sh > +++ b/scripts/rust_is_available.sh > @@ -19,6 +19,20 @@ get_canonical_version() > echo $((100000 * $1 + 100 * $2 + $3)) > } > > +# Print a reference to the Quick Start guide in the documentation. > +print_docs_reference() > +{ > + echo >&2 "***" > + echo >&2 "*** Please see Documentation/rust/quick-start.rst for d= etails" > + echo >&2 "*** on how to set up the Rust support." > + echo >&2 "***" > +} > + > +# If the script fails for any reason, or if there was any warning, then > +# print a reference to the documentation on exit. > +warning=3D0 > +trap 'if [ $? -ne 0 ] || [ $warning -ne 0 ]; then print_docs_reference; = fi' EXIT I confirmed that pressing Ctrl-C while rust_is_available.sh is running does not invoke print_docs_reference(). (and I believe that is the right behavior). I also checked bash and dash work in the same way. (I usually test both because the POSIX does not define the exact condition when the EXIT handler is invoked.) Reviewed-by: Masahiro Yamada > + > # Check that the Rust compiler exists. > if ! command -v "$RUSTC" >/dev/null; then > echo >&2 "***" > @@ -60,6 +74,7 @@ if [ "$rust_compiler_cversion" -gt "$rust_compiler_min_= cversion" ]; then > echo >&2 "*** Your version: $rust_compiler_version" > echo >&2 "*** Expected version: $rust_compiler_min_version" > echo >&2 "***" > + warning=3D1 > fi > > # Check that the Rust bindings generator is suitable. > @@ -87,6 +102,7 @@ if [ "$rust_bindings_generator_cversion" -gt "$rust_bi= ndings_generator_min_cvers > echo >&2 "*** Your version: $rust_bindings_generator_versio= n" > echo >&2 "*** Expected version: $rust_bindings_generator_min_ve= rsion" > echo >&2 "***" > + warning=3D1 > fi > > # Check that the `libclang` used by the Rust bindings generator is suita= ble. > @@ -126,6 +142,7 @@ if [ "$cc_name" =3D Clang ]; then > echo >&2 "*** libclang version: $bindgen_libclang_versi= on" > echo >&2 "*** Clang version: $clang_version" > echo >&2 "***" > + warning=3D1 > fi > fi > > -- > 2.41.0 > -- Best Regards Masahiro Yamada