From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id SPUpNGAmvWQWGwEASxT56A (envelope-from ) for ; Sun, 23 Jul 2023 15:08:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id uF3eM2AmvWTiOQAAauVa8A (envelope-from ) for ; Sun, 23 Jul 2023 15:08:48 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5C65D4EA15 for ; Sun, 23 Jul 2023 15:08:48 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=A4AeHWG+; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1690117728; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=k57i6xZtAI4iYRjxGcTa/3jK2fhmvvIfWXuutdIILtg=; b=K7BwYPxHvt2NFGq/8oxHsXnra52au7oIwLsrfBDB7Jb89rdt1ghMguDS+8cbqA+Be5sDDp REsemAw6jpXR8NsfN0QxhmwUdZfl66VW9wbHoPHjQPCOIu4oVN3auCmIWi44C13Whbasq4 6UOEZlZqziGErcsPqbK9GuJyNm6WH/BUuw3jq24HhZMhC+a6YNSgpDg/UiLq90+ewiuj2g hqEWIlhaggT9UADM5bGaamsXrD7WP8fUu1g80b2w2zmf+gbtF4DDAmBFrjreq2Z9feYCxv lvnBEKJrwMsBomKFucEjEMVcFEnm+wi/t+4J+jy2vbR6vpJuWzTNtRBLQsTxYg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1690117728; a=rsa-sha256; cv=none; b=r3CnmJpRcAzBRs0cabR1jou94MFruahs41e5NrtzZl+ISiH0yqyzJVabYlHAhnxqCmTu6T CdgBg7gEJsnlNdap3NK8lOX6AxxgW/zgCoSw1w45UAU30VC9Q9AKJmmXq+1lodjxInOHUt ip5Vb4z+cixoDPG7l7q1Qup9jhb1LMViEsAJUJo+SebmnQMp3CobzRO4astqJSL4CmJysi Fzu6MfrpwNjWfpPrlMSof5ZOSw90dOPD8pKHJbJtoqVJHvaw9+cGg6hmF6b1mup2d9oAdG HJqD+RMM8/4ulQvL2xsVZYjM83PYc4WsnfxixofJtB/u/ohAl+EOowFiACbspA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=A4AeHWG+; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNYp2-00042u-A3; Sun, 23 Jul 2023 09:08:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNXgH-0003wy-6f for guix-patches@gnu.org; Sun, 23 Jul 2023 07:55:21 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNXfy-0003lh-7t for guix-patches@gnu.org; Sun, 23 Jul 2023 07:55:17 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qNXfy-0006WD-3F for guix-patches@gnu.org; Sun, 23 Jul 2023 07:55:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64804] [PATCH] gnu: rust: Update to Rust 1.71.0 Resent-From: Fries Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 23 Jul 2023 11:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64804 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64804@debbugs.gnu.org Cc: Fries X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.169011325924992 (code B ref -1); Sun, 23 Jul 2023 11:55:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jul 2023 11:54:19 +0000 Received: from localhost ([127.0.0.1]:38895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNXfF-0006Ux-I4 for submit@debbugs.gnu.org; Sun, 23 Jul 2023 07:54:19 -0400 Received: from lists.gnu.org ([2001:470:142::17]:45910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNSk2-0000UO-Hr for submit@debbugs.gnu.org; Sun, 23 Jul 2023 02:38:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNSju-0001WB-7p for guix-patches@gnu.org; Sun, 23 Jul 2023 02:38:46 -0400 Received: from mail-4324.protonmail.ch ([185.70.43.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNSjq-0008D3-Lt for guix-patches@gnu.org; Sun, 23 Jul 2023 02:38:46 -0400 Date: Sun, 23 Jul 2023 06:38:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1690094318; x=1690353518; bh=k57i6xZtAI4iYRjxGcTa/3jK2fhmvvIfWXuutdIILtg=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=A4AeHWG+06UeEGquwB6htOVpTI4wh2bIJgLUugkA+Rst/A/OToGgJWLQ6lg2HhAQN /mwJeERVT7pgJuKzaxGf3L0WoxTfFIoXPIoaYJAggOLyK8fzWVoYj2dNNxjFYL/Mvl wpqRQ8aL0+cCiE+GmE/zVvrDp0BkVDaxhd/3BjdQQ4aC81hFkIiudalC929QszM6RU kJjlrNiCRGANJQy5cojyKLLaPV8M9tLbMtIk+0Suo6f6NDtTZKM96X6WCJCY7z6Ib7 mL22zEnmFC2/8adBgReNPOfy0bunnkxjNeaqN+c4uhiYWpV76R2DngXepzXuq2H19s l0HwjVsj0ZckA== Message-ID: <1bbbeed9c7c6e50464bee042e8dd06e9cd62c4c2.1690094273.git.fries1234@protonmail.com> Feedback-ID: 42759890:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.43.24; envelope-from=fries1234@protonmail.com; helo=mail-4324.protonmail.ch X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 23 Jul 2023 07:54:16 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Sun, 23 Jul 2023 09:08:25 -0400 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Fries X-ACL-Warn: , Fries via Guix-patches From: Fries via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx2.migadu.com X-Migadu-Spam-Score: -3.64 X-Spam-Score: -3.64 X-Migadu-Queue-Id: 5C65D4EA15 X-TUID: zQvLfuVQ9MGl this one was quite a bit of effort but i seem like i actually got it working! the major changes that i've done is for Rust 1.70, i made a patch that enables the cc feature flag so it would compile the outline asm files instead of using included binary .a files which were removed by guix. i also ignored a lot more tests for Rust 1.71, mainly gitoxide tests as they require the network and the git binary and we don't have that in the build. also rustfmt requires rustc's shared libraries so i set the RUSTFLAGS environment variable to add the "out" outputs lib folder to the RUNPATH so the rustfmt binary works! --- .../patches/rust-1.70-fix-rustix-build.patch | 20 +++ gnu/packages/rust.scm | 137 ++++++++++++++++-- 2 files changed, 141 insertions(+), 16 deletions(-) create mode 100644 gnu/packages/patches/rust-1.70-fix-rustix-build.patch diff --git a/gnu/packages/patches/rust-1.70-fix-rustix-build.patch b/gnu/pa= ckages/patches/rust-1.70-fix-rustix-build.patch new file mode 100644 index 0000000..a7e2003 --- /dev/null +++ b/gnu/packages/patches/rust-1.70-fix-rustix-build.patch @@ -0,0 +1,20 @@ +--- a/vendor/fd-lock/Cargo.toml=092023-05-31 14:44:48.000000000 -0700 ++++ b/vendor/fd-lock/Cargo.toml=092023-07-14 21:19:34.637702319 -0700 +@@ -45,7 +45,7 @@ +=20 + [target."cfg(unix)".dependencies.rustix] + version =3D "0.37.0" +-features =3D ["fs"] ++features =3D ["fs", "cc"] +=20 + [target."cfg(windows)".dependencies.windows-sys] + version =3D "0.45.0" +--- a/src/bootstrap/Cargo.lock=092023-07-11 20:32:40.000000000 -0700 ++++ b/src/bootstrap/Cargo.lock=092023-07-14 22:41:53.269284713 -0700 +@@ -618,6 +618,7 @@ + dependencies =3D [ + "bitflags", ++ "cc", + "errno", + "io-lifetimes", + "libc", diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 8e106a9..d489de9 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -16,6 +16,7 @@ ;;; Copyright =C2=A9 2022 Zheng Junjie <873216071@qq.com> ;;; Copyright =C2=A9 2022 Jim Newsome ;;; Copyright =C2=A9 2022 Mark H Weaver +;;; Copyright =C2=A9 2023 Fries ;;; ;;; This file is part of GNU Guix. ;;; @@ -122,6 +123,9 @@ (define* (rust-bootstrapped-package base-rust version c= hecksum) (alist-replace "rustc-bootstrap" (list base-rust) (package-native-inputs base-rust)))))) =20 + + + ;;; Note: mrustc's only purpose is to be able to bootstap Rust; it's desig= ned ;;; to be used in source form. (define %mrustc-commit "597593aba86fa2edbea80c6e09f0b1b2a480722d") @@ -705,6 +709,81 @@ (define rust-1.68 (rust-bootstrapped-package rust-1.67 "1.68.2" "15ifyd5jj8rd979dkakp887hgmhndr68pqaqvd2hqkfdywirqcw= k")) =20 +(define rust-1.69 + (let ((base-rust + (rust-bootstrapped-package + rust-1.68 "1.69.0" "03zn7kx5bi5mdfsqfccj4h8gd6abm7spj0kjsfxwlv5= dcwc9f1gv"))) + (package + (inherit base-rust) + (source + (origin + (inherit (package-source base-rust)) + (snippet + '(begin + (for-each delete-file-recursively + '("src/llvm-project" + "vendor/tikv-jemalloc-sys/jemalloc")) + ;; Also remove the bundled (mostly Windows) libraries. + (for-each delete-file + (find-files "vendor" ".*\\.(a|dll|exe|lib)$"))))))= ))) + +(define rust-1.70 + (let ((base-rust + (rust-bootstrapped-package + rust-1.69 "1.70.0" "0z6j7d0ni0rmfznv0w3mrf882m11kyh51g2bxkj40l3s= 1c0axgxj"))) + (package + (inherit base-rust) + (source + (origin + (inherit (package-source base-rust)) + ;; Rust 1.70 uses the rustix library which on Linux, it defaults t= o + ;; using outline ASM which without the cc cargo feature enabled, i= t + ;; will expect a precompiled binary library. This patch will enabl= e the cargo + ;; cc feature flag inside the fd-lock vendored Cargo.toml file, wh= ich is the + ;; crate that uses rustix. + (patches (search-patches "rust-1.70-fix-rustix-build.patch")) + (patch-flags '("-p1")))) + (arguments + (substitute-keyword-arguments (package-arguments base-rust) + ((#:phases phases) + `(modify-phases ,phases + (replace 'build + (lambda* (#:key parallel-build? #:allow-other-keys) + (let ((job-spec (string-append + "-j" (if parallel-build? + (number->string (parallel-job-coun= t)) + "1")))) + (invoke "./x.py" job-spec "build" "--stage=3D1" + "library/std" + "src/tools/cargo"))))))))))) + +(define rust-1.71 + (let ((base-rust + (rust-bootstrapped-package + rust-1.70 "1.71.0" "15jc0d13cmrh2xvpkyyvsbwgn3w4klqiwf2wlgzfp22m= vjmy8rx6"))) + (package + (inherit base-rust) + (arguments + (substitute-keyword-arguments (package-arguments base-rust) + ((#:phases phases) + `(modify-phases ,phases + (replace 'patch-cargo-checksums + (lambda _ + (substitute* '("Cargo.lock" + "src/bootstrap/Cargo.lock" + "src/tools/rust-analyzer/Cargo.lock" + "src/tools/cargo/Cargo.lock") + (("(checksum =3D )\".*\"" all name) + (string-append name "\"" ,%cargo-reference-hash "\""))= ) + (generate-all-checksums "vendor")))))))))) + +;;; Function to make creating a list to ignore tests a bit easier. +(define (make-ignore-test-list strs) + (map (lambda (str) + (let ((ignore-string (format #f "#[ignore]\n~a" str))) + `((,str) ,ignore-string))) + strs)) + ;;; Note: Only the latest versions of Rust are supported and tested. The ;;; intermediate rusts are built for bootstrapping purposes and should not ;;; be relied upon. This is to ease maintenance and reduce the time @@ -713,7 +792,7 @@ (define rust-1.68 ;;; Here we take the latest included Rust, make it public, and re-enable t= ests ;;; and extra components such as rustfmt. (define-public rust - (let ((base-rust rust-1.67)) + (let ((base-rust rust-1.71)) (package (inherit base-rust) (outputs (cons "rustfmt" (package-outputs base-rust))) @@ -748,23 +827,43 @@ (define-public rust (which "env"))))) (add-after 'unpack 'disable-tests-requiring-git (lambda _ - (substitute* "src/tools/cargo/tests/testsuite/new.rs" - (("fn author_prefers_cargo") - "#[ignore]\nfn author_prefers_cargo") - (("fn finds_author_git") - "#[ignore]\nfn finds_author_git") - (("fn finds_local_author_git") - "#[ignore]\nfn finds_local_author_git")))) + (substitute* "src/tools/cargo/tests/testsuite/git.rs" + ,@(make-ignore-test-list + '("fn fetch_downloads_with_git2_first_then_with_gito= xide_and_vice_versa" + "fn git_fetch_cli_env_clean" + "fn git_with_cli_force" + "fn use_the_cli"))) + ;; Gitoxide tests seem to require the internet to run + ;; and Guix build containers don't have the internet. + (substitute* "src/tools/cargo/tests/testsuite/git_shallo= w.rs" + ,@(make-ignore-test-list + '("fn gitoxide_clones_git_dependency_with_shallow_pr= otocol_and_git2_is_used_for_followup_fetches" + "fn gitoxide_clones_registry_with_shallow_protocol= _and_aborts_and_updates_again" + "fn gitoxide_clones_registry_with_shallow_protocol= _and_follow_up_fetch_maintains_shallowness" + "fn gitoxide_clones_registry_with_shallow_protocol= _and_follow_up_with_git2_fetch" + "fn gitoxide_clones_registry_without_shallow_proto= col_and_follow_up_fetch_uses_shallowness" + "fn gitoxide_clones_shallow_two_revs_same_deps" + "fn gitoxide_git_dependencies_switch_from_branch_t= o_rev" + "fn gitoxide_shallow_clone_followed_by_non_shallow= _update" + "fn shallow_deps_work_with_revisions_and_branches_= mixed_on_same_dependency"))) + (substitute* "src/tools/cargo/tests/testsuite/offline.rs= " + ,@(make-ignore-test-list '("fn gitoxide_cargo_compile_= offline_with_cached_git_dep_shallow_dep"))) + (substitute* "src/tools/cargo/tests/testsuite/patch.rs" + ,@(make-ignore-test-list '("fn gitoxide_clones_shallow= _old_git_patch"))))) (add-after 'unpack 'disable-tests-requiring-mercurial (lambda _ - (substitute* - "src/tools/cargo/tests/testsuite/init/simple_hg_ignore_= exists/mod.rs" - (("fn simple_hg_ignore_exists") - "#[ignore]\nfn simple_hg_ignore_exists")) (substitute* "src/tools/cargo/tests/testsuite/init/mercurial_autodet= ect/mod.rs" - (("fn mercurial_autodetect") - "#[ignore]\nfn mercurial_autodetect")))) + ,@(make-ignore-test-list '("fn case"))) + (substitute* + "src/tools/cargo/tests/testsuite/init/simple_hg/mod.rs" + ,@(make-ignore-test-list '("fn case"))) + (substitute* + "src/tools/cargo/tests/testsuite/init/simple_hg_ignore_e= xists/mod.rs" + ,@(make-ignore-test-list '("fn case"))) + (substitute* + "src/tools/cargo/tests/testsuite/new.rs" + ,@(make-ignore-test-list '("fn simple_hg"))))) (add-after 'unpack 'disable-tests-broken-on-aarch64 (lambda _ (with-directory-excursion "src/tools/cargo/tests/testsuit= e/" @@ -807,7 +906,7 @@ (define-public rust ;; We skip the test since it's drastically unlikely Guix's ;; packaging will introduce a bug here. (lambda _ - (delete-file "src/test/ui/parser/shebang/sneaky-attrib.rs= "))) + (delete-file "tests/ui/parser/shebang/sneaky-attrib.rs"))= ) (add-after 'unpack 'patch-process-tests (lambda* (#:key inputs #:allow-other-keys) (let ((bash (assoc-ref inputs "bash"))) @@ -840,11 +939,17 @@ (define-public rust "gdb =3D \"" gdb "/bin/gdb\"\n")))))) (replace 'build ;; Phase overridden to also build rustfmt. - (lambda* (#:key parallel-build? #:allow-other-keys) + (lambda* (#:key parallel-build? outputs #:allow-other-keys) (let ((job-spec (string-append "-j" (if parallel-build? (number->string (parallel-job-c= ount)) "1")))) + ;; Append the default output's lib folder to the RUSTFL= AGS + ;; environment variable. this lets programs that depend= on + ;; rustc's shared libraries like rustfmt work. + (setenv "RUSTFLAGS" + (format #f "-C link-arg=3D-Wl,-rpath,~a/lib" + (assoc-ref outputs "out"))) (invoke "./x.py" job-spec "build" "library/std" ;rustc "src/tools/cargo" base-commit: 00ed2901f5171e4f9435641a91678217cae38030 --=20 2.41.0