From patchwork Fri Jun 16 00:16:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 108767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp997484vqr; Thu, 15 Jun 2023 17:20:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UeB4oGiHD0bkHnXwT2BfVwQ+SH0i/RbHOjMMgOwAP+0Q8DRXLUcQ5bbCdKF+vAM5aCS+Y X-Received: by 2002:a05:6808:201f:b0:389:4f86:205e with SMTP id q31-20020a056808201f00b003894f86205emr858414oiw.9.1686874823456; Thu, 15 Jun 2023 17:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686874823; cv=none; d=google.com; s=arc-20160816; b=NpDH/1rdcwxPYvB8lMzuVgbzL52JdmR1AkKRVBoGxc/Xk5lxIRANoVbDNu71G/t2VJ tbmyncKx4VV+yM2NJZUd9NV3zQPn8H8G+VbKn4w/LEkWYdNqfW9QztvQIa3Xo0+U0K/5 xpPRieRWEakEyrwIP6KD4evpwOGngNZ8KhtxLiz5yhwqOilr8zMmM/DJ9cP0DTTGVqfl 672q/hunZLzOm22QlildUvqTkdfwxLgltlGkpAmEWX5/K3MXzIqOa49aXh787LpHp4RB 4Dg98y5anevxgu96b6gpCzwjmnBt9HZEWbmrYYzTELgb0b5FJVtabfnVKBvJTikTcCXp vdrQ== 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=NdtpJtYFCTu/84JIYYvMCTFbbiCu0IdBQTnOe3VRi58=; b=SWPulmV84uEVsSS/bBn+e70VqBi2JhZUokp0ZS9VjHr7enSefsk6gD95hNxUiHNGoV y5vN5Z4Z9o6igODecdCrxVylLzAAVzUxUl5YxCEVyuw60T6rzfX0/IW1baY8Z6j9EK4A 1DQPgWCey5NBME1et2GwyNl9spZTLLK1jHv1s0Z2rRE4u0OnQEVvyp8R1PrH/jaoQKWk xRJDEOkgBTDQuta5rGLRQfIPXsm7olgk4rETsmzLWTgUCmozx3F+i07oPH383U4Ir5hm 5RCqOo3FlJYXnqmDjPZmOo7YOv2ecdYJootVnUWSNNoEwYZRjQzafg1eJtGn+yhNEv8I cg8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="L6/+ClNP"; 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 p12-20020a17090a348c00b0025ea380f868si487962pjb.2.2023.06.15.17.20.10; Thu, 15 Jun 2023 17:20: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="L6/+ClNP"; 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 S240269AbjFPASZ (ORCPT + 99 others); Thu, 15 Jun 2023 20:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240813AbjFPAR7 (ORCPT ); Thu, 15 Jun 2023 20:17:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97F882D42; Thu, 15 Jun 2023 17:17:29 -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 BF672625AC; Fri, 16 Jun 2023 00:17:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 642A7C433CC; Fri, 16 Jun 2023 00:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686874646; bh=nRivV3zrCLYT47fKlzn6TTMrDbuRNBwLfZj2lP+tctE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L6/+ClNPTjQGAFtca0C1JEL2tzhvY36Ml/gV0PQp/e6aZGgVXadUjX/adcFLlq3Ya RX5p03CQEwY06y1FIlRj0MFG1HtVJ4427ppqq9bscXtvMKQ2YnETnBebAX0QjLDliV ySY3hvsxDKTXJ6rM/Wc37aqXnwi43VVUZuGdaQUgWwWGCv+RX2ITV+nNxlyLjygRhz fqk7IZWBevcdIgF9Y7f9z+l/6qZWxuDlWMopaMaxExeyxL35sAHFd8JZOTzzaZX+IT to/zrLflCo50kkIqx6ZQuZ7azDdY4QUyQgxUFfvCL2vrbk01TTdyhmnjUsgUPMNN4S jy1g13fpMqmKA== 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, Jordan Isaacs , "Ethan D . Twardy" , Tiago Lam Subject: [PATCH v2 07/11] kbuild: rust_is_available: fix confusion when a version appears in the path Date: Fri, 16 Jun 2023 02:16:27 +0200 Message-ID: <20230616001631.463536-8-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=-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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768816455107829283?= X-GMAIL-MSGID: =?utf-8?q?1768816455107829283?= `bindgen`'s output for `libclang`'s version check contains paths, which in turn may contain strings that look like version numbers [1][2]: .../6.1.0-dev/.../rust_is_available_bindgen_libclang.h:2:9: warning: clang version 11.1.0 [-W#pragma-messages], err: false which the script will pick up as the version instead of the latter. It is also the case that versions may appear after the actual version (e.g. distribution's version text), which was the reason behind `head` [3]: .../rust-is-available-bindgen-libclang.h:2:9: warning: clang version 13.0.0 (Fedora 13.0.0-3.fc35) [-W#pragma-messages], err: false Thus instead ask for a match after the `clang version` string. Reported-by: Jordan Isaacs Closes: https://github.com/Rust-for-Linux/linux/issues/942 [1] Reported-by: Ethan D. Twardy Closes: https://lore.kernel.org/rust-for-linux/20230528131802.6390-2-ethan.twardy@gmail.com/ [2] Reported-by: Tiago Lam Closes: https://github.com/Rust-for-Linux/linux/pull/789 [3] Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") Signed-off-by: Miguel Ojeda Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Nathan Chancellor Reviewed-By: Ethan Twardy Tested-By: Ethan Twardy --- scripts/rust_is_available.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh index 7e0368babe64..810691af66eb 100755 --- a/scripts/rust_is_available.sh +++ b/scripts/rust_is_available.sh @@ -157,9 +157,7 @@ fi # of the `libclang` found by the Rust bindings generator is suitable. bindgen_libclang_version=$( \ echo "$bindgen_libclang_output" \ - | grep -F 'clang version ' \ - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ - | head -n 1 \ + | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' ) bindgen_libclang_min_version=$($min_tool_version llvm) bindgen_libclang_cversion=$(get_canonical_version $bindgen_libclang_version)