guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch staging updated: gnu: rust-1.46: Add rustfmt output


From: guix-commits
Subject: branch staging updated: gnu: rust-1.46: Add rustfmt output
Date: Sun, 13 Dec 2020 18:00:42 -0500

This is an automated email from the git hooks/post-receive script.

lfam pushed a commit to branch staging
in repository guix.

The following commit(s) were added to refs/heads/staging by this push:
     new 48926b5  gnu: rust-1.46: Add rustfmt output
48926b5 is described below

commit 48926b588528c5a2b591e1e97a5757eb78d3cac1
Author: Matthew Kraai <kraai@ftbfs.org>
AuthorDate: Wed Dec 2 05:18:35 2020 -0800

    gnu: rust-1.46: Add rustfmt output
    
    * gnu/packages/rust.scm (rust-1.46)[outputs]: Add a rustfmt output.
    [arguments]: Adjust to the new 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 35a96b5..749d1f0 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]