GNU bug report logs - #42295
[PATCH] gnu: rust-1.44: Add rustfmt output.

Previous Next

Package: guix-patches;

Reported by: Matthew Kraai <kraai <at> ftbfs.org>

Date: Thu, 9 Jul 2020 12:34:01 UTC

Severity: normal

Tags: patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42295 in the body.
You can then email your comments to 42295 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#42295; Package guix-patches. (Thu, 09 Jul 2020 12:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthew Kraai <kraai <at> ftbfs.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 09 Jul 2020 12:34:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matthew Kraai <kraai <at> ftbfs.org>
To: guix-patches <at> gnu.org
Cc: Matthew Kraai <kraai <at> ftbfs.org>
Subject: [PATCH] gnu: rust-1.44: Add rustfmt output.
Date: Thu,  9 Jul 2020 05:32:56 -0700
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#42295; Package guix-patches. (Wed, 25 Nov 2020 14:47:02 GMT) Full text and rfc822 format available.

Message #8 received at 42295 <at> debbugs.gnu.org (full text, mbox):

From: John Soo <jsoo1 <at> asu.edu>
To: Matthew Kraai <kraai <at> ftbfs.org>
Cc: 42295 <at> debbugs.gnu.org
Subject: Re: [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output.
Date: Wed, 25 Nov 2020 06:46:42 -0800
Hi Matthew,

Thanks! I had packaged rustfmt-nightly but this is much better.

Matthew Kraai <kraai <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#42295; Package guix-patches. (Thu, 26 Nov 2020 13:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 42295 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Kraai <kraai <at> ftbfs.org>
To: John Soo <jsoo1 <at> asu.edu>
Cc: 42295 <at> debbugs.gnu.org
Subject: Re: [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output.
Date: Thu, 26 Nov 2020 05:25:48 -0800
[Message part 1 (text/plain, inline)]
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 <at> 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

[patch (text/plain, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#42295; Package guix-patches. (Thu, 26 Nov 2020 16:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 42295 <at> debbugs.gnu.org (full text, mbox):

From: John Soo <jsoo1 <at> asu.edu>
To: Matthew Kraai <kraai <at> ftbfs.org>
Cc: 42295 <at> debbugs.gnu.org
Subject: Re: [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output.
Date: Thu, 26 Nov 2020 08:51:21 -0800
[Message part 1 (text/plain, inline)]
Hi Matthew,

Matthew Kraai <kraai <at> 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 <at> 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

[0001-gnu-Add-rls-as-an-output-of-rust-1.44.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#42295; Package guix-patches. (Wed, 02 Dec 2020 13:30:02 GMT) Full text and rfc822 format available.

Message #17 received at 42295 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Kraai <kraai <at> ftbfs.org>
To: John Soo <jsoo1 <at> asu.edu>
Cc: 42295 <at> debbugs.gnu.org
Subject: Re: [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output.
Date: Wed, 2 Dec 2020 05:29:25 -0800
[Message part 1 (text/plain, inline)]
Hi John,

On 11/26/20 8:51 AM, John Soo wrote:
> Matthew Kraai <kraai <at> 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 <at> 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

[0001-gnu-rust-1.46-Add-rustfmt-output.patch (text/x-patch, attachment)]

Reply sent to Efraim Flashner <efraim <at> flashner.co.il>:
You have taken responsibility. (Thu, 28 Jan 2021 18:34:02 GMT) Full text and rfc822 format available.

Notification sent to Matthew Kraai <kraai <at> ftbfs.org>:
bug acknowledged by developer. (Thu, 28 Jan 2021 18:34:02 GMT) Full text and rfc822 format available.

Message #22 received at 42295-done <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: 42295-done <at> debbugs.gnu.org
Subject: Re: [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output.
Date: Thu, 28 Jan 2021 20:32:46 +0200
[Message part 1 (text/plain, inline)]
This is applied on staging so closing the bug

-- 
Efraim Flashner   <efraim <at> 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
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 26 Feb 2021 12:24:17 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 60 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.