From patchwork Fri Jun 16 00:16:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 108772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1001632vqr; Thu, 15 Jun 2023 17:31:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VK2pgiyS7NiSzPFWic4d2gsq6cT8D/zloz6HdM9S8YEZqcfho5BKcjVp3E7lI5PDwjxZ/ X-Received: by 2002:a05:6359:63a7:b0:129:c6d1:2176 with SMTP id sg39-20020a05635963a700b00129c6d12176mr235850rwb.15.1686875483274; Thu, 15 Jun 2023 17:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686875483; cv=none; d=google.com; s=arc-20160816; b=svYoNuG6A/HW/D3x0+NEXdvlGldbYuP0e/lheu/HZLNYZviNj/8So7TaUglNGjRvVN La5G5K+gOalEmJ/aW+1zD86Q7o+WTrNlrXL3VeIt5ORiDRY2gRtGC/6pItyp9fzvy8Fl /eF7hCi3JizExOdjofY+i6W0fRbSEoe9buoU6q9S8oqUKkmihohhUxpfm1WHTf8VqAnS UTsZzjqaxxLN7a+jTK6GuC4Qklsoo5zfpHw58k63HB9/uTM6WRgAK8XXiVMa0gInGRI1 MypCd1p4o/SpGeBueAVLvtJGXlrT8qFRTi5YmqXzEm1gngd+4wmwvlSq8dHADP0UbxjN RwOQ== 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=eRC6Jjp/XETjXZBw+sdrxc+zYNeCbZjRXXN6LACJX34=; b=1BKEOqKJpmrwFeIRxBdun/v8Mmyz+UwjXlBGA811NfVVBf7IuuJfhK9/8t/l3K3UAP 15/uH+Fxr4JA6nOaVAx5U+bCqx8OruCxX5TfHJW+XNeC3KXrS+Is+PtyL7b6OYDVEX3X paDRkka8WfmRedjeamGxHtPVknaMcpriocZpO3lhVqObGUz14r9k/y4fmEmRWpORDmC2 s+4T79LKr17tnOJrlHdWwT/bf3c0TeqMsjKTCYJ6kpuDSyUbJiG+FGUXVNXuYdQnnGxD xIUIa03fHveTVsTP5+M1kE7UhJtdOiOP7GSzIN/B2ju2+/ETyDQF7GkcPMhQX4VgcQHJ nT6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uy2ENEAr; 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 s198-20020a6377cf000000b0054ff3c2b9a9si2523396pgc.821.2023.06.15.17.31.09; Thu, 15 Jun 2023 17:31:23 -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=uy2ENEAr; 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 S240696AbjFPARW (ORCPT + 99 others); Thu, 15 Jun 2023 20:17:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbjFPARS (ORCPT ); Thu, 15 Jun 2023 20:17:18 -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 D17BC2D6D; Thu, 15 Jun 2023 17:17:12 -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 0ACEC61C11; Fri, 16 Jun 2023 00:17:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20220C433C9; Fri, 16 Jun 2023 00:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686874631; bh=cgdU9EGPRg6prCiiXBlnJGZt5RUNOs2rhZy64y+yRgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uy2ENEAr/f8o6ANqBrRm6AEU4+yZtU9A/j7+UT5Sff8RLmebqkp0vQSBp/eCF15pH s8aCj7Lb/siKDnQcXqOUVMYMZ34TOxSKP4Ym2WRFR7/jirD+RxVoXilgirqxD7/J50 519N1mXDhUGFqXTasW+85yF03Y68AQ4DABOrhWgJDxX2Te5l8AFKO6OR/2GS7q5BkD xwjRKGVE/obw9oQARJYlZPdA050EWfOse9LiMn/ORztl6jmTnbSu67EIV0Ye/nzrmV DXdD3uVIsUCusggpYa9EZ3KT5T6axCUYzxFVk7ICTXBtZKa0LMaBWlQMtnJF9N+wTp u8zjvh7D4hECQ== From: Miguel Ojeda To: Masahiro Yamada , Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor Cc: 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 Subject: [PATCH v2 04/11] kbuild: rust_is_available: print docs reference Date: Fri, 16 Jun 2023 02:16:24 +0200 Message-ID: <20230616001631.463536-5-ojeda@kernel.org> In-Reply-To: <20230616001631.463536-1-ojeda@kernel.org> References: <20230616001631.463536-1-ojeda@kernel.org> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768817146925006560?= X-GMAIL-MSGID: =?utf-8?q?1768817146925006560?= 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 Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Nathan Chancellor Reviewed-by: Masahiro Yamada --- 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 details" + 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=0 +trap 'if [ $? -ne 0 ] || [ $warning -ne 0 ]; then print_docs_reference; fi' EXIT + # 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=1 fi # Check that the Rust bindings generator is suitable. @@ -87,6 +102,7 @@ if [ "$rust_bindings_generator_cversion" -gt "$rust_bindings_generator_min_cvers echo >&2 "*** Your version: $rust_bindings_generator_version" echo >&2 "*** Expected version: $rust_bindings_generator_min_version" echo >&2 "***" + warning=1 fi # Check that the `libclang` used by the Rust bindings generator is suitable. @@ -126,6 +142,7 @@ if [ "$cc_name" = Clang ]; then echo >&2 "*** libclang version: $bindgen_libclang_version" echo >&2 "*** Clang version: $clang_version" echo >&2 "***" + warning=1 fi fi