From patchwork Fri Jun 16 00:16:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 10859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1002002vqr; Thu, 15 Jun 2023 17:32:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ43eeFU7TlDmZTe7n1LtpQ4447LdrfsJC6TJs5Hlhxfo6a2YbLfbyb99sXNw6yNl9l9OP9L X-Received: by 2002:a17:902:da84:b0:1b5:1c68:c82f with SMTP id j4-20020a170902da8400b001b51c68c82fmr584462plx.23.1686875538186; Thu, 15 Jun 2023 17:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686875538; cv=none; d=google.com; s=arc-20160816; b=uANu/Y8B+INFwwwW1SFCOmKSNU/rn9vZrCTKuHO8GjlQDuiCn52FXzyWgKq92m0UoW 9dGRszKo+gwYII6voXauJj1qgpThMHcULxebqwC0d7kpYqsDVEKUdAd3l5W6ntvxZH0d rSAe6ZefBFxFYkpn8Kmp5vqp4O8Cf3I8ZPzysHLyioxgYqrJ3HNLTXVfOJIIa+4Y5uK5 6ojTd+Ktwah+3Wu5cbU5PVdEDzIMGDUrflFqntIUoKpHG1k1dk2X9kYqg192HyG2+ish 1QVglJaqQKljj5h8p9HG7UVVtH0aWo92Oa+xbYmWGbIEwFI2/87KaQXr3VUQEDu/u+9C DYkg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c2-20020a170903234200b001b515b0b7dasi2692862plh.31.2023.06.15.17.31.59; Thu, 15 Jun 2023 17:32:18 -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 S238043AbjFPAQ4 (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_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: [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 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?1768817204311939899?= X-GMAIL-MSGID: =?utf-8?q?1768817204311939899?= 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