Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1865352rwd; Thu, 15 Jun 2023 17:26:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7YSAWVMJCY/BMdtPKqa4MKj/8+qAOsi50gcHkrDV5ORhFgYn6n9Ev6qG3ADBG+vNgBZgda X-Received: by 2002:a17:903:1248:b0:1b0:75ef:ce3e with SMTP id u8-20020a170903124800b001b075efce3emr522981plh.25.1686875206649; Thu, 15 Jun 2023 17:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686875206; cv=none; d=google.com; s=arc-20160816; b=h5hu1ZuPfZqVcdqR0+ESx+fn3SKnxlR0QduwHRMpmDiA3OqDfEKFtZNPkqIbr0v6lF Beqw0uHKXKT1BzoAswfzpPINWxkFQmL388P+dEhUvEHHD5TZV8r5BIuhxtuKorHUU1VZ v2QxUc9ozJKtEejcaGADunzz6YlZFf0usQGZa3h21dU/bIim1kIbs6Hxo6Y7L4yCztzv 90gm0eJx4w8sin9tRW38a74vro9/B/RqsqL3Fh3lyGCJNHQOKdgqtaGcBT0ZrzzbCHQk RswNo7+4AsBLuUZN0OMIR9peBnwbCAwDYQ1Sbk6RyKQu+JUh6pfvbX6q1Qjw53UOHcp7 pDcg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=1R4ZnL/Cvnql9w1EO3Uo5HWPM4gk0XxM0sG/qC6uu48=; b=R/NYnBkA3c8MlKb5LwVea9yIZ3mEqP78RnnvK3pImIWujqRJEhqtY1Atwfa4iOnCfe CfEMml1hlVhaAMAtYjR9mcuE2UOOjsPUdgkdfZR88hUsckew6alNWpMYU+5GQI7y7zIZ 3vMGvZ9297mn9XK8R/tmBRbx+Y3FzSXTrqOSxHN9DykhQFQF1r3dOZYtRVs0frgvEJ2H vjudyWLpsK+PAxzA7BSPCoWIaPvkdXL9QBiYYL+9CxsONxHAwLg4B6yI3L0uGSUhivrT o06bR9z0kjdlGLzWqztRFUTzoDWY20rs9LFAppwaAdMlGpkn3gZ3rNq7EG71yDml0Pbp J9OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RdUlqeEe; 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 ay6-20020a1709028b8600b001aafec82436si10603509plb.204.2023.06.15.17.26.34; Thu, 15 Jun 2023 17:26:46 -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=RdUlqeEe; 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 S233252AbjFPAQ4 (ORCPT + 99 others); Thu, 15 Jun 2023 20:16:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjFPAQz (ORCPT ); Thu, 15 Jun 2023 20:16:55 -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 59A60B5; Thu, 15 Jun 2023 17:16: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 C435761C11; Fri, 16 Jun 2023 00:16:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6488C433C0; Fri, 16 Jun 2023 00:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686874612; bh=agYLlcXyXImEwHhAG9238V5StoEG6ffUqnfcPJUkDhY=; h=From:To:Cc:Subject:Date:From; b=RdUlqeEeIerwSxnIKM+oTlLgs9z1X/J8q/p1BsJUYzzYaSH6kzOyqyqvh/U/ZBaJc V5nall2wXJTd8/Zy6CsdPlTEJwxo9VY1IBIISxqB27eHTUD69Kiad0315t/8Cm1mEM Z7LwUJo/V+6bSTHPEO0dKUZBP4cTotj9f+8F07ZhLSoiJ2zY+9f0eXpLyHA8UemcMX /EgRWiYThKHdZKJj50EjQ2i8ePTfkTvg0g7hp3oZ2+Wj3n3nH0iMkb5IVvjMFFwTu5 lvR5GTzp09n2bvGXXdz2Za3u3PQ++8Sp9TzDgdiSHHiPm5EoB3pCKiqDXFRkg5pdKZ +UcHPJ8OvNM1Q== 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=20Roy=20Baron?= , 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: [PATCH v2 00/11] `scripts/rust_is_available.sh` improvements Date: Fri, 16 Jun 2023 02:16:20 +0200 Message-ID: <20230616001631.463536-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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: X-Mailing-List: linux-kernel@vger.kernel.org This is the patch series to improve `scripts/rust_is_available.sh`. The major addition in v2 is the test suite in the last commit. I added it because I wanted to have a proper way to test any further changes to it (such as the suggested `set --` idea to avoid forking by Masahiro), and so that adding new checks was easier to justify too (i.e. vs. the added complexity). In addition, there are also a few new checks in the script, to cover for even some more cases, which hopefully make problematic setups easier to identify and solve by users building the kernel. For instance, running the script externally gives: $ scripts/rust_is_available.sh *** *** Environment variable 'RUSTC' is not set. *** *** This script is intended to be called from Kbuild. *** Please use the 'rustavailable' target to call it instead. *** Otherwise, the results may not be meaningful. *** *** Please see Documentation/rust/quick-start.rst for details *** on how to set up the Rust support. *** I also changed it to avoid setting `-e` as Masahiro suggested. Similarly, I now check for `$RUSTC`, `$BINDGEN` and `$CC`, instead of `$MAKEFLAGS`, as he also suggested (but I gave it their own error message rather than use the `${CC?: is not set}` approach. This goes in line with the reasons outlined above, i.e. trying to give users a clear error of what step exactly failed). In the test suite I included previously problematic compiler version strings we got reports for. The test suite covers all current branches in the script, and we should keep it that way in the future. The patch series also include Masahiro's patch to remove the `-v` option, as well as Russell's patch for supporting multiple arguments in `$CC`. All in all, this should solve all the issues we got so far (unless I have missed something) and improve things further with the new checks plus the test suite to hopefully have an easier time in the future. Testers for this one are appreciated, especially if you have uncommon or custom setups for building the kernel. This could go through either the Kbuild or the Rust tree. Masahiro Yamada (1): kbuild: rust_is_available: remove -v option Miguel Ojeda (9): docs: rust: add paragraph about finding a suitable `libclang` kbuild: rust_is_available: print docs reference kbuild: rust_is_available: add check for `bindgen` invocation kbuild: rust_is_available: check that environment variables are set kbuild: rust_is_available: fix confusion when a version appears in the path kbuild: rust_is_available: normalize version matching kbuild: rust_is_available: handle failures calling `$RUSTC`/`$BINDGEN` kbuild: rust_is_available: check that output looks as expected kbuild: rust_is_available: add test suite Russell Currey (1): kbuild: rust_is_available: fix version check when CC has multiple arguments Documentation/rust/quick-start.rst | 17 ++ Makefile | 4 +- scripts/rust_is_available.sh | 233 +++++++++++++------ scripts/rust_is_available_test.py | 346 +++++++++++++++++++++++++++++ 4 files changed, 532 insertions(+), 68 deletions(-) create mode 100755 scripts/rust_is_available_test.py base-commit: 858fd168a95c5b9669aac8db6c14a9aeab446375 -- 2.41.0