[bug#33465] gnu: rust: Don't depend on 'git'.

Message ID cubpnuvofd6.fsf@gmx.com
State Accepted
Headers show
Series [bug#33465] gnu: rust: Don't depend on 'git'. | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied

Commit Message

Pierre Langlois Nov. 23, 2018, 5:47 p.m. UTC
Pierre Langlois writes:

> Whoops, ignore that patch, it doesn't do what I wanted it to do. The
> point was to skip the tests *only* for temporary packages used for
> bootstrapping the final one. But here it's disabled the tests all the
> time, we don't want that... my bad!  I'll another look when I have time.

Right, attached is what I meant to do.

Thanks!
Pierre

Comments

Marius Bakke Nov. 24, 2018, 1:09 a.m. UTC | #1
Pierre Langlois <pierre.langlois@gmx.com> writes:

> Pierre Langlois writes:
>
>> Whoops, ignore that patch, it doesn't do what I wanted it to do. The
>> point was to skip the tests *only* for temporary packages used for
>> bootstrapping the final one. But here it's disabled the tests all the
>> time, we don't want that... my bad!  I'll another look when I have time.
>
> Right, attached is what I meant to do.

Hello!

I don't have a strong opinion for or against disabling tests in the Rust
bootstrap toolchain.  But with Git removed, most (all?) of Rusts
dependencies are packages that do not change very frequently (i.e. only
on the 'staging' and 'core-updates' branches), so maybe it's not as
urgent?

Regardless, I've pushed the original patch to the 'core-updates'
branch.  Could you submit the other patch to a separate issue or to
guix-devel?  TIA!
Danny Milosavljevic Nov. 24, 2018, 9:45 p.m. UTC | #2
Hi,

I'd prefer if the git parts were removed in a new phase "remove-git-tests" and
that phase removed (ha) in the newest rust - otherwise we never test rust git
integration.

Then the substitution wouldn't need to be duplicated either.
Pierre Langlois Nov. 25, 2018, 11:53 a.m. UTC | #3
Hi Danny,

Danny Milosavljevic writes:

> Hi,
>
> I'd prefer if the git parts were removed in a new phase "remove-git-tests" and
> that phase removed (ha) in the newest rust - otherwise we never test rust git
> integration.
>
> Then the substitution wouldn't need to be duplicated either.

Alternatively, if we go with removing tests althogether when building
rust for bootstrapping, we can also remove non-essential native inputs
such as git and gdb.  And then we can keep all of them for the final
rust.

As with Marius, I don't have a strong opinion on this, I just thought
I'd mention it as a possibility to speedup rust's build process. I can
submit a patch in a separate ticket if you think it's a good idea.

Thanks!
Pierre

Patch

From 326a4761b03c50481d44d5b485954d823006bbb8 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <pierre.langlois@gmx.com>
Date: Fri, 23 Nov 2018 11:58:06 +0000
Subject: [PATCH v2] gnu: rust: Do not run tests when building for bootstrapping.

* gnu/packages/rust.scm (rust-bootstrapped-package): Create a temporary
rust-bootstrap package that inherits from base-rust and removes the check
phase.  Then use it for the cargo-bootsrap and rustc-bootstrap native inputs.
---
 gnu/packages/rust.scm | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index a56faad079..7d416836aa 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -7,6 +7,7 @@ 
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org>
+;;; Copyright © 2018 Pierre Langlois <pierre.langlois@gmx.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -83,15 +84,26 @@ 
 (define* (rust-bootstrapped-package base-rust version checksum
                                     #:key (patches '()))
   "Bootstrap rust VERSION with source checksum CHECKSUM patched with PATCHES using BASE-RUST."
-  (package
-    (inherit base-rust)
-    (version version)
-    (source
-     (rust-source version checksum #:patches patches))
-    (native-inputs
-     (alist-replace "cargo-bootstrap" (list base-rust "cargo")
-                    (alist-replace "rustc-bootstrap" (list base-rust)
-                                   (package-native-inputs base-rust))))))
+  ;; Tests take a long time to run, as they do not run in parallel for
+  ;; stability reasons.  Disable them when building the rust used for
+  ;; bootstrapping.
+  (let ((rust-bootstrap
+         (package
+           (inherit base-rust)
+           (arguments
+            (substitute-keyword-arguments (package-arguments base-rust)
+              ((#:phases phases)
+               `(modify-phases ,phases
+                  (delete 'check))))))))
+    (package
+      (inherit base-rust)
+      (version version)
+      (source
+       (rust-source version checksum #:patches patches))
+      (native-inputs
+       (alist-replace "cargo-bootstrap" (list rust-bootstrap "cargo")
+                      (alist-replace "rustc-bootstrap" (list rust-bootstrap)
+                                     (package-native-inputs base-rust)))))))
 
 (define-public mrustc
   (let ((rustc-version "1.19.0"))
-- 
2.19.2