all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matthew Kraai <kraai@ftbfs.org>
To: John Soo <jsoo1@asu.edu>
Cc: 42295@debbugs.gnu.org
Subject: [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output.
Date: Thu, 26 Nov 2020 05:25:48 -0800	[thread overview]
Message-ID: <5407eb2f-b499-2520-e0e5-48ca7171e6bd@ftbfs.org> (raw)
In-Reply-To: <87blfltrxp.fsf@asu.edu>

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

  reply	other threads:[~2020-11-26 13:28 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 [this message]
2020-11-26 16:51     ` John Soo
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

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

  git send-email \
    --in-reply-to=5407eb2f-b499-2520-e0e5-48ca7171e6bd@ftbfs.org \
    --to=kraai@ftbfs.org \
    --cc=42295@debbugs.gnu.org \
    --cc=jsoo1@asu.edu \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.