unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: John Soo <jsoo1@asu.edu>
To: Matthew Kraai <kraai@ftbfs.org>
Cc: 42295@debbugs.gnu.org
Subject: [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output.
Date: Thu, 26 Nov 2020 08:51:21 -0800	[thread overview]
Message-ID: <871rggt62e.fsf@asu.edu> (raw)
In-Reply-To: <5407eb2f-b499-2520-e0e5-48ca7171e6bd@ftbfs.org> (Matthew Kraai's message of "Thu, 26 Nov 2020 05:25:48 -0800")

[-- 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


  reply	other threads:[~2020-11-26 16:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-12-02 13:29       ` Matthew Kraai
2021-01-28 18:32         ` bug#42295: " Efraim Flashner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871rggt62e.fsf@asu.edu \
    --to=jsoo1@asu.edu \
    --cc=42295@debbugs.gnu.org \
    --cc=kraai@ftbfs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).