* [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output. @ 2020-07-09 12:32 Matthew Kraai 2020-11-25 14:46 ` John Soo 0 siblings, 1 reply; 6+ messages in thread From: Matthew Kraai @ 2020-07-09 12:32 UTC (permalink / raw) To: 42295; +Cc: Matthew Kraai * gnu/packages/rust.scm (rust-1.44): Add a rustfmt output. --- gnu/packages/rust.scm | 50 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 6fc0fd4f52..52aef9478b 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -1277,8 +1277,54 @@ move around." "18akhk0wz1my6y9vhardriy2ysc482z0fnjdcgs9gy59kmnarxkm")) (define-public rust-1.44 - (rust-bootstrapped-package rust-1.43 "1.44.1" - "0ww4z2v3gxgn3zddqzwqya1gln04p91ykbrflnpdbmcd575n8bky")) + (let ((base-rust + (rust-bootstrapped-package rust-1.43 "1.44.1" + "0ww4z2v3gxgn3zddqzwqya1gln04p91ykbrflnpdbmcd575n8bky"))) + (package + (inherit base-rust) + (outputs '("out" "doc" "cargo" "rustfmt")) + (arguments + (substitute-keyword-arguments (package-arguments base-rust) + ((#:phases phases) + `(modify-phases ,phases + (replace 'build + (lambda* _ + (invoke "./x.py" "build") + (invoke "./x.py" "build" "src/tools/cargo") + (invoke "./x.py" "build" "src/tools/rustfmt"))) + (replace 'check + (lambda* _ + ;; Enable parallel execution. + (let ((parallel-job-spec + (string-append "-j" (number->string + (min 4 + (parallel-job-count)))))) + (invoke "./x.py" parallel-job-spec "test" "-vv") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/cargo") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/rustfmt")))) + (replace 'mkdir-prefix-paths + (lambda* (#:key outputs #:allow-other-keys) + ;; As result of https://github.com/rust-lang/rust/issues/36989 + ;; `prefix' directory should exist before `install' call + (mkdir-p (assoc-ref outputs "out")) + (mkdir-p (assoc-ref outputs "cargo")) + (mkdir-p (assoc-ref outputs "rustfmt")) + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (invoke "./x.py" "install") + (substitute* "config.toml" + ;; replace prefix to specific output + (("prefix = \"[^\"]*\"") + (string-append "prefix = \"" (assoc-ref outputs "cargo") "\""))) + (invoke "./x.py" "install" "cargo") + (substitute* "config.toml" + ;; replace prefix to specific output + (("prefix = \"[^\"]*\"") + (string-append "prefix = \"" (assoc-ref outputs "rustfmt") "\""))) + (invoke "./x.py" "install" "rustfmt")))))))))) ;; NOTE: An update to LLVM 10 is coming in 1.45, make sure not to miss it. -- 2.27.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output. 2020-07-09 12:32 [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output Matthew Kraai @ 2020-11-25 14:46 ` John Soo 2020-11-26 13:25 ` Matthew Kraai 0 siblings, 1 reply; 6+ messages in thread From: John Soo @ 2020-11-25 14:46 UTC (permalink / raw) To: Matthew Kraai; +Cc: 42295 Hi Matthew, Thanks! I had packaged rustfmt-nightly but this is much better. Matthew Kraai <kraai@ftbfs.org> writes: > + (replace 'check > + (lambda* _ > + ;; Enable parallel execution. > + (let ((parallel-job-spec > + (string-append "-j" (number->string > + (min 4 > + (parallel-job-count)))))) > + (invoke "./x.py" parallel-job-spec "test" "-vv") > + (invoke "./x.py" parallel-job-spec "test" > + "src/tools/cargo") > + (invoke "./x.py" parallel-job-spec "test" > + "src/tools/rustfmt")))) Nice! > + (outputs '("out" "doc" "cargo" "rustfmt")) Perhaps we should make anything that can be installed as a rustup component an output (provided the source is in the rust tree). I think rls can be added immediately in the same fashion. Do you want to add a copyright line? Otherwise, this looks good to me. Best regards, John ^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output. 2020-11-25 14:46 ` John Soo @ 2020-11-26 13:25 ` Matthew Kraai 2020-11-26 16:51 ` John Soo 0 siblings, 1 reply; 6+ messages in thread From: Matthew Kraai @ 2020-11-26 13:25 UTC (permalink / raw) To: John Soo; +Cc: 42295 [-- Attachment #1: Type: text/plain, Size: 1462 bytes --] Hi John, On 11/25/20 6:46 AM, John Soo wrote: > Hi Matthew, > > Thanks! I had packaged rustfmt-nightly but this is much better. > > Matthew Kraai <kraai@ftbfs.org> writes: > >> + (replace 'check >> + (lambda* _ >> + ;; Enable parallel execution. >> + (let ((parallel-job-spec >> + (string-append "-j" (number->string >> + (min 4 >> + (parallel-job-count)))))) >> + (invoke "./x.py" parallel-job-spec "test" "-vv") >> + (invoke "./x.py" parallel-job-spec "test" >> + "src/tools/cargo") >> + (invoke "./x.py" parallel-job-spec "test" >> + "src/tools/rustfmt")))) > Nice! > >> + (outputs '("out" "doc" "cargo" "rustfmt")) > Perhaps we should make anything that can be installed as a rustup > component an output (provided the source is in the rust tree). I think > rls can be added immediately in the same fashion. Is rls deprecated in favor of rust-analyzer? > Do you want to add a copyright line? Done. > Otherwise, this looks good to me. According to https://github.com/rust-lang/rustfmt, rustfmt was made a component in 1.24.0. Would it be better to add this support to the rust-1.24 package instead? I've attached the patch I'm currently testing. -- Matthew Kraai [-- Attachment #2: patch --] [-- Type: text/plain, Size: 4228 bytes --] diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 05404de1d8..d7a26d2f46 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com> +;;; Copyright © 2020 Matthew Kraai <kraai@ftbfs.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -690,6 +691,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y"))) (package (inherit base-rust) + (outputs (cons "rustfmt" (package-outputs base-rust))) (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) @@ -701,7 +703,36 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" ;; This test is known to fail on aarch64 and powerpc64le: ;; https://github.com/rust-lang/rust/issues/45410 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) - #t))))))))) + #t)) + (add-after 'configure 'enable-extended-build + (lambda* _ + (substitute* "config.toml" + (("[[]build[]]") "[build]\nextended = true")) + #t)) + (replace 'build + (lambda* _ + (invoke "./x.py" "build") + (invoke "./x.py" "build" "src/tools/cargo") + (invoke "./x.py" "build" "src/tools/rustfmt"))) + (replace 'check + (lambda* _ + (invoke "./x.py" "-j1" "test" "-vv") + (invoke "./x.py" "-j1" "test" "src/tools/cargo") + (invoke "./x.py" "-j1" "test" "src/tools/rustfmt") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (invoke "./x.py" "install") + (substitute* "config.toml" + ;; replace prefix to specific output + (("prefix = \"[^\"]*\"") + (string-append "prefix = \"" (assoc-ref outputs "cargo") "\""))) + (invoke "./x.py" "install" "cargo") + (substitute* "config.toml" + ;; replace prefix to specific output + (("prefix = \"[^\"]*\"") + (string-append "prefix = \"" (assoc-ref outputs "rustfmt") "\""))) + (invoke "./x.py" "install" "rustfmt")))))))))) ;;; Rust 1.25 release support work with llvm 6--but build with llvm 6 is ;;; not determenistic due to <https://github.com/rust-lang/rust/issues/50556>. @@ -764,6 +795,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" `(modify-phases ,phases ;; binaryen was replaced with LLD project from LLVM (delete 'dont-build-native) + (delete 'enable-extended-build) (replace 'check (lambda* _ ;; Enable parallel execution. @@ -773,7 +805,9 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" (parallel-job-count)))))) (invoke "./x.py" parallel-job-spec "test" "-vv") (invoke "./x.py" parallel-job-spec "test" - "src/tools/cargo")))) + "src/tools/cargo") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/rustfmt")))) (replace 'remove-unsupported-tests (lambda* _ ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH. @@ -844,6 +878,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" ;; `prefix' directory should exist before `install' call (mkdir-p (assoc-ref outputs "out")) (mkdir-p (assoc-ref outputs "cargo")) + (mkdir-p (assoc-ref outputs "rustfmt")) #t)) (add-after 'patch-cargo-tests 'disable-thinlto-test (lambda* _ ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output. 2020-11-26 13:25 ` Matthew Kraai @ 2020-11-26 16:51 ` John Soo 2020-12-02 13:29 ` Matthew Kraai 0 siblings, 1 reply; 6+ messages in thread From: John Soo @ 2020-11-26 16:51 UTC (permalink / raw) To: Matthew Kraai; +Cc: 42295 [-- Attachment #1: Type: text/plain, Size: 1285 bytes --] Hi Matthew, Matthew Kraai <kraai@ftbfs.org> writes: >> Perhaps we should make anything that can be installed as a rustup >> component an output (provided the source is in the rust tree). I think >> rls can be added immediately in the same fashion. > Is rls deprecated in favor of rust-analyzer? Yes but I think it should be included until it is not supported at all anymore. > According to https://github.com/rust-lang/rustfmt, rustfmt was made a > component in 1.24.0. Would it be better to add this support to the > rust-1.24 package instead? I've attached the patch I'm currently testing. Keep it on rust@1.44. Even though guix refresh --list-dependent will report not many dependents, changing a current rust version would trigger many rebuilds. There would be enough rebuilds to require it to be applied to staging. I've also attached a work in progress patch to add rls as an output, too. I would love if all the "extended" tools can be included. Some tools like clippy and the rust-src component would be very helpful. One other thing: > + (outputs '("out" "doc" "cargo" "rustfmt")) should probably be: (cons "rustfmt" (package-outputs base-rust)) to be more resistant to changes to older packages. Best regards, John [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-gnu-Add-rls-as-an-output-of-rust-1.44.patch --] [-- Type: text/x-patch, Size: 3927 bytes --] From 7e26e4c61a609e93199acdff608272e3cbc38c76 Mon Sep 17 00:00:00 2001 From: John Soo <jsoo1@asu.edu> Date: Wed, 25 Nov 2020 06:30:02 -0800 Subject: [PATCH] gnu: Add rls as an output of rust@1.44. * gnu/packages/rust.scm (rust-1.44):[arguments] Build rls, [outputs] add rls. --- gnu/packages/rust.scm | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 23837ee5bf..ae23d98b98 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -1284,16 +1284,24 @@ move around." "0ww4z2v3gxgn3zddqzwqya1gln04p91ykbrflnpdbmcd575n8bky"))) (package (inherit base-rust) - (outputs (cons "rustfmt" (package-outputs base-rust))) + (outputs (append '("rustfmt" "rls") (package-outputs base-rust))) (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) `(modify-phases ,phases (replace 'build (lambda* _ + (substitute* "config.toml" + ;; replace prefix to specific output + (("\\[build\\]" all) + (string-append all " +extended = true +tools = [\"cargo\", \"rls\", \"clippy\", \"rustfmt\", \"analysis\", \"src\"] +"))) (invoke "./x.py" "build") (invoke "./x.py" "build" "src/tools/cargo") - (invoke "./x.py" "build" "src/tools/rustfmt"))) + (invoke "./x.py" "build" "src/tools/rustfmt") + (invoke "./x.py" "build" "src/tools/rls"))) (replace 'check (lambda* _ ;; Enable parallel execution. @@ -1305,7 +1313,12 @@ move around." (invoke "./x.py" parallel-job-spec "test" "src/tools/cargo") (invoke "./x.py" parallel-job-spec "test" - "src/tools/rustfmt")))) + "src/tools/rustfmt") + (substitute* "src/tools/rls/tests/client.rs" + (("fn client_dependency_typo_and_fix" all) + (string-append "#[ignore]\n" all))) + (invoke "./x.py" parallel-job-spec "test" + "src/tools/rls")))) (replace 'mkdir-prefix-paths (lambda* (#:key outputs #:allow-other-keys) ;; As result of https://github.com/rust-lang/rust/issues/36989 @@ -1313,6 +1326,7 @@ move around." (mkdir-p (assoc-ref outputs "out")) (mkdir-p (assoc-ref outputs "cargo")) (mkdir-p (assoc-ref outputs "rustfmt")) + (mkdir-p (assoc-ref outputs "rls")) #t)) (replace 'install (lambda* (#:key outputs #:allow-other-keys) @@ -1326,7 +1340,18 @@ move around." ;; replace prefix to specific output (("prefix = \"[^\"]*\"") (string-append "prefix = \"" (assoc-ref outputs "rustfmt") "\""))) - (invoke "./x.py" "install" "rustfmt")))))))))) + (invoke "./x.py" "install" "rustfmt") + (substitute* "config.toml" + ;; replace prefix to specific output + (("prefix = \"[^\"]*\"") + (string-append "prefix = \"" (assoc-ref outputs "rls") "\""))) + (invoke "./x.py" "install" "rls"))) + (replace 'validate-runpath + (lambda* (#:key outputs #:allow-other-keys #:rest rest) + (apply (assoc-ref %standard-phases 'validate-runpath) + ;; rls has references to "out" + #:outputs (alist-delete "rls" outputs) + rest)))))))))) (define-public rust-1.45 (let ((base-rust -- 2.29.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output. 2020-11-26 16:51 ` John Soo @ 2020-12-02 13:29 ` Matthew Kraai 2021-01-28 18:32 ` bug#42295: " Efraim Flashner 0 siblings, 1 reply; 6+ messages in thread From: Matthew Kraai @ 2020-12-02 13:29 UTC (permalink / raw) To: John Soo; +Cc: 42295 [-- Attachment #1: Type: text/plain, Size: 1232 bytes --] Hi John, On 11/26/20 8:51 AM, John Soo wrote: > Matthew Kraai <kraai@ftbfs.org> writes: >> According to https://github.com/rust-lang/rustfmt, rustfmt was made a >> component in 1.24.0. Would it be better to add this support to the >> rust-1.24 package instead? I've attached the patch I'm currently testing. > Keep it on rust@1.44. Even though guix refresh --list-dependent will > report not many dependents, changing a current rust version would > trigger many rebuilds. There would be enough rebuilds to require it to > be applied to staging. > > I've also attached a work in progress patch to add rls as an output, > too. I would love if all the "extended" tools can be included. Some > tools like clippy and the rust-src component would be very helpful. > > One other thing: > >> + (outputs '("out" "doc" "cargo" "rustfmt")) > should probably be: (cons "rustfmt" (package-outputs base-rust)) > > to be more resistant to changes to older packages. Here is an updated patch. I modified the rust-1.46 package, used your suggestion to add rustfmt to the list of outputs, did not modify the mkdir-prefix-paths phase (which doesn't seem to be necessary), and updated the delete-install-logs phase. -- Matthew Kraai [-- Attachment #2: 0001-gnu-rust-1.46-Add-rustfmt-output.patch --] [-- Type: text/x-patch, Size: 4345 bytes --] From 600cc3f1f4a38847aea48edb0e1e7e365bd00d8c Mon Sep 17 00:00:00 2001 From: Matthew Kraai <kraai@ftbfs.org> Date: Wed, 2 Dec 2020 05:18:35 -0800 Subject: [PATCH] gnu: rust-1.46: Add rustfmt output * gnu/packages/rust.scm (rust-1.46): Add a rustfmt output. --- gnu/packages/rust.scm | 67 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 35a96b5754..749d1f031f 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com> +;;; Copyright © 2020 Matthew Kraai <kraai@ftbfs.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -1315,8 +1316,70 @@ move around." #t))))))))) (define-public rust-1.46 - (rust-bootstrapped-package rust-1.45 "1.46.0" - "0a17jby2pd050s24cy4dfc0gzvgcl585v3vvyfilniyvjrqknsid")) + (let ((base-rust + (rust-bootstrapped-package rust-1.45 "1.46.0" + "0a17jby2pd050s24cy4dfc0gzvgcl585v3vvyfilniyvjrqknsid"))) + (package + (inherit base-rust) + (outputs (cons "rustfmt" (package-outputs base-rust))) + (arguments + (substitute-keyword-arguments (package-arguments base-rust) + ((#:phases phases) + `(modify-phases ,phases + (replace 'build + (lambda* _ + (invoke "./x.py" "build") + (invoke "./x.py" "build" "src/tools/cargo") + (invoke "./x.py" "build" "src/tools/rustfmt"))) + (replace 'check + (lambda* _ + ;; Test rustfmt. + (let ((parallel-job-spec + (string-append "-j" (number->string + (min 4 + (parallel-job-count)))))) + (invoke "./x.py" parallel-job-spec "test" "-vv") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/cargo") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/rustfmt")))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (invoke "./x.py" "install") + (substitute* "config.toml" + ;; replace prefix to specific output + (("prefix = \"[^\"]*\"") + (string-append "prefix = \"" (assoc-ref outputs "cargo") "\""))) + (invoke "./x.py" "install" "cargo") + (substitute* "config.toml" + ;; replace prefix to specific output + (("prefix = \"[^\"]*\"") + (string-append "prefix = \"" (assoc-ref outputs "rustfmt") "\""))) + (invoke "./x.py" "install" "rustfmt"))) + (replace 'delete-install-logs + (lambda* (#:key outputs #:allow-other-keys) + (define (delete-manifest-file out-path file) + (delete-file (string-append out-path "/lib/rustlib/" file))) + + (let ((out (assoc-ref outputs "out")) + (cargo-out (assoc-ref outputs "cargo")) + (rustfmt-out (assoc-ref outputs "rustfmt"))) + (for-each + (lambda (file) (delete-manifest-file out file)) + '("install.log" + "manifest-rust-docs" + ,(string-append "manifest-rust-std-" + (nix-system->gnu-triplet-for-rust)) + "manifest-rustc")) + (for-each + (lambda (file) (delete-manifest-file cargo-out file)) + '("install.log" + "manifest-cargo")) + (for-each + (lambda (file) (delete-manifest-file rustfmt-out file)) + '("install.log" + "manifest-rustfmt-preview")) + #t)))))))))) ;; TODO(staging): Bump this variable to the latest packaged rust. (define-public rust rust-1.45) -- 2.29.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#42295: [PATCH] gnu: rust-1.44: Add rustfmt output. 2020-12-02 13:29 ` Matthew Kraai @ 2021-01-28 18:32 ` Efraim Flashner 0 siblings, 0 replies; 6+ messages in thread From: Efraim Flashner @ 2021-01-28 18:32 UTC (permalink / raw) To: 42295-done [-- Attachment #1: Type: text/plain, Size: 260 bytes --] This is applied on staging so closing the bug -- Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-01-28 18:34 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-07-09 12:32 [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output Matthew Kraai 2020-11-25 14:46 ` John Soo 2020-11-26 13:25 ` Matthew Kraai 2020-11-26 16:51 ` John Soo 2020-12-02 13:29 ` Matthew Kraai 2021-01-28 18:32 ` bug#42295: " Efraim Flashner
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/guix.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).