summary refs log tree commit diff
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2018-04-02 18:47:58 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2018-04-15 09:22:16 +0200
commitca523cc5189a40dafcff8c08dc99aa287068df11 (patch)
tree6a22e620593ef2a7a6cee0071d2194a2477bdb97
parent8fdde581031abf812e316b0e0fa2ba1db153b4e1 (diff)
downloadguix-ca523cc5189a40dafcff8c08dc99aa287068df11.tar.gz
gnu: Factorize rust-bootstrapped-package.
* gnu/packages/rust.scm (rust-bootstrapped-package): New procedure.
(rust): Use rust-bootstrapped-package.
-rw-r--r--gnu/packages/rust.scm29
1 files changed, 18 insertions, 11 deletions
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 8ec748fa6d..eaa8c48525 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -235,6 +235,18 @@ safety and thread safety guarantees.")
     ;; Dual licensed.
     (license (list license:asl2.0 license:expat))))
 
+(define (rust-bootstrapped-package base-rust version checksum)
+  "Bootstrap rust VERSION with source checksum CHECKSUM using BASE-RUST."
+  (package
+    (inherit base-rust)
+    (version version)
+    (source
+     (rust-source version checksum))
+    (native-inputs
+     (alist-replace "cargo-bootstrap" (list base-rust "cargo")
+                    (alist-replace "rustc-bootstrap" (list base-rust)
+                                   (package-native-inputs base-rust))))))
+
 (define-public rust-1.23
   (package
     (inherit rust-1.19)
@@ -337,18 +349,13 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
                #t)))))))))
 
 (define-public rust
-  (let ((base-rust rust-1.23))
+  (let ((base-rust
+         (rust-bootstrapped-package rust-1.23 "1.24.1"
+                                    "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y")))
     (package
       (inherit base-rust)
-      (version "1.24.1")
-      (source
-       (rust-source version
-                    "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y"))
-      (native-inputs
-       (alist-replace "cargo-bootstrap" (list base-rust "cargo")
-                      (alist-replace "rustc-bootstrap" (list base-rust)
-                                     (package-native-inputs base-rust))))
       (arguments
        (substitute-keyword-arguments (package-arguments base-rust)
-         ((#:phases phases) `(modify-phases ,phases
-                               (delete 'fix-mtime-bug))))))))
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (delete 'fix-mtime-bug))))))))