From patchwork Mon Jan 9 20:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 41100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2372793wrt; Mon, 9 Jan 2023 12:49:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXtUObgEtfqY1uT389s3PZOK4SFJ0JRd6RuVf8YQaIFcaKt3rH+DVbipz0qj85ZbKQMUu9Cb X-Received: by 2002:a17:90a:af85:b0:223:f385:bb72 with SMTP id w5-20020a17090aaf8500b00223f385bb72mr67499709pjq.49.1673297395594; Mon, 09 Jan 2023 12:49:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673297395; cv=none; d=google.com; s=arc-20160816; b=dzm+gprho7oDrY1Ya8iP6h4LYV/jSfRAW3svIFToT9hjyMWfk2KmVr9/X3bv0Bhqtu 9CQJ5scbaQddVsBCXJZ703oOdSJlD+OtUTucOUUFi338IWMaYKrBzxt6dW5sRweN99kx 4/Q3FbP1lHTNeMm0sIFpg5ImWIum8A2K97kK6+z487gCgTNmk+XGCcz0w9vQbHfakD35 +3gWDtUWabFMzpkzkoAX4bHWK77WKPCJsruEC/1/irO2zQNR0eZqyyjLAVH6nb896g7k 2186jR7oHAHlKAKwNYX4B0Z2h2aoBeZ3aQvNq9vbbhASl6HqPck/SqNCsGrkSXHqLJY0 NS/w== 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=9+W9jj4caIYbq0EH7wrqETCcuCmoDOwqCsIH3zHLq00=; b=oIrVH6u04YeZONabsG1ZQX6I0jyW/X2e4mLHfBq9gyoNh0ZpL5v5StVy3BRCTVZpmp uixEwKpmcODXjLck7Gbfis7gwi9C+XhNhkE7ahLsApLQODw+wKIC06ftY8dtGOubIOpW C7t/dvNtkktbTTOrDTzp1wVxWrOKQpG4QZhix8pHtFk5JBa+MqsvVpoRL7GvPoAsD07R gedNcIhioneIiCRhIe0TFLYoLpxE9d1j+4JxCw6rXiu3cKzePB6a5tpeK/zTy+F+yaQh kmvSSpTAk/CNZR4lQw4MCEpOkhTlTti/LozC1ZXuKWuYN53Nx1OvKBj5j2Ecc5edZvoM 64Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nU3KceGN; 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 s133-20020a632c8b000000b004ad1e82a3e6si8777677pgs.554.2023.01.09.12.49.43; Mon, 09 Jan 2023 12:49:55 -0800 (PST) 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=nU3KceGN; 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 S234593AbjAIUq0 (ORCPT + 99 others); Mon, 9 Jan 2023 15:46:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237666AbjAIUqL (ORCPT ); Mon, 9 Jan 2023 15:46:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A06573E3A; Mon, 9 Jan 2023 12:46:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2979DB80FE1; Mon, 9 Jan 2023 20:46:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F207FC433F0; Mon, 9 Jan 2023 20:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673297162; bh=v6aIwGe42UpqRaNoSLoyuLZZtQ4F5eJRx+9gWWQ/eO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nU3KceGNxWBQHIw4s9cYt/+dB4mBbRCcVDxEWhD97wuWQx1pW1cuVmiFxvPG9ovqa LxqUYYF5JfpArpnr/OW8MnFdtsjss8Ty3NY+79and96nOyJw7ZDi0QG1HW99e1fvst Gywb+jPHB/nGT9VLU29DM6/QAjgWK7ILl8TDVMoxnPgBccHuG757H4SivxGK2bBnEa 2WjPHnV4T1u27okoMT6T2s++THucuyYlW1KeKmoel2+tv4sTATR1t1zRIGjjBDDDAh Bzn8HdMYfZXbz6+btbSMvCHuYP3rH08v98r9FFecybgSZWb2IJU7KfqJ+0OynWfB7B ObscqPXnQLETw== From: Miguel Ojeda To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= Subject: [PATCH 5/6] kbuild: rust_is_available: fix confusion when a version appears in the path Date: Mon, 9 Jan 2023 21:45:19 +0100 Message-Id: <20230109204520.539080-5-ojeda@kernel.org> In-Reply-To: <20230109204520.539080-1-ojeda@kernel.org> References: <20230109204520.539080-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 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?1754579489520084990?= X-GMAIL-MSGID: =?utf-8?q?1754579489520084990?= `bindgen`'s output for `libclang`'s version check contains paths, which in turn may contain strings that look like version numbers [1]: .../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` [2]: .../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 (@jordanisaacs) Link: https://github.com/Rust-for-Linux/linux/issues/942 [1] Link: https://github.com/Rust-for-Linux/linux/pull/789 [2] Signed-off-by: Miguel Ojeda --- 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 0c082a248f15..a86659410e48 100755 --- a/scripts/rust_is_available.sh +++ b/scripts/rust_is_available.sh @@ -141,9 +141,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)