Subject: bug#39982: closed (Done: Add new rust versions)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 27 Mar 2020 13:32:01 +0000

Your bug report

#39982: [PATCH _/?] Add new rust versions

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
39982: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=39982
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Done: Add new rust versions
From: Jakub Kądziołka <[email-masked]>
To: [email-masked]
Date: Fri, 27 Mar 2020 14:31:09 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Pushed as commit 9483782a617c66b8e066ac7f1898e41f99eb8456

Subject: [PATCH] gnu: rust: Add 1.38
From: Jakub Kądziołka <[email-masked]>
To: [email-masked]
Date: Sun, 8 Mar 2020 14:14:03 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

All packages are still built with rustc 1.37, but users will see rustc
1.38 in their profiles, and packages that require newer compiler
versions will be possible to add.

* gnu/packages/rust.scm (rust-1.31): Factor out the
  patch-command-exec-tests phase to a separate procedure.
  (patch-command-exec-tests-phase): New procedure.
  (rust): Rename to rust-1.37, make rust an alias.
  (rust-1.38): New variable.
---
 gnu/packages/rust.scm | 74 ++++++++++++++++++++++++++++++-------------
 1 file changed, 52 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index d0a64b134f..3efd76b156 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -909,9 +909,30 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
              (replace 'disable-amd64-avx-test
                (lambda _
                  (substitute* "src/test/ui/run-pass/issues/issue-44056.rs"
-	          (("only-x86_64") "ignore-test"))
+                  (("only-x86_64") "ignore-test"))
                   #t)))))))))
 
+(define (patch-command-exec-tests-phase test-path)
+  "The command-exec.rs test moves around between releases.  We need to apply
+a Guix-specific patch to it for each release.  This function generates the phase
+that applies said patch, parametrized by the test-path.  This is done this way
+because the phase is more complex than the equivalents for other tests that
+move around."
+ `(lambda* (#:key inputs #:allow-other-keys)
+    (let ((coreutils (assoc-ref inputs "coreutils")))
+      (substitute* ,test-path
+        ;; This test suite includes some tests that the stdlib's
+        ;; `Command` execution properly handles situations where
+        ;; the environment or PATH variable are empty, but this
+        ;; fails since we don't have `echo` available in the usual
+        ;; Linux directories.
+        ;; NB: the leading space is so we don't fail a tidy check
+        ;; for trailing whitespace, and the newlines are to ensure
+        ;; we don't exceed the 100 chars tidy check as well
+        ((" Command::new\\(\"echo\"\\)")
+         (string-append "\nCommand::new(\"" coreutils "/bin/echo\")\n")))
+      #t)))
+
 (define-public rust-1.31
   (let ((base-rust
          (rust-bootstrapped-package rust-1.30 "1.31.1"
@@ -923,26 +944,14 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
          ((#:phases phases)
           `(modify-phases ,phases
              (add-after 'patch-tests 'patch-command-exec-tests
-               (lambda* (#:key inputs #:allow-other-keys)
-                 (let ((coreutils (assoc-ref inputs "coreutils")))
-                   (substitute* "src/test/run-pass/command-exec.rs"
-                     ;; This test suite includes some tests that the stdlib's
-                     ;; `Command` execution properly handles situations where
-                     ;; the environment or PATH variable are empty, but this
-                     ;; fails since we don't have `echo` available in the usual
-                     ;; Linux directories.
-                     ;; NB: the leading space is so we don't fail a tidy check
-                     ;; for trailing whitespace, and the newlines are to ensure
-                     ;; we don't exceed the 100 chars tidy check as well
-                     ((" Command::new\\(\"echo\"\\)")
-                      (string-append "\nCommand::new(\"" coreutils "/bin/echo\")\n")))
-                   #t)))
-	      ;; The test has been moved elsewhere.
-	      (replace 'disable-amd64-avx-test
-	        (lambda _
-	          (substitute* "src/test/ui/issues/issue-44056.rs"
-                   (("only-x86_64") "ignore-test"))
-                  #t))
+               ,(patch-command-exec-tests-phase
+                  "src/test/run-pass/command-exec.rs"))
+             ;; The test has been moved elsewhere.
+             (replace 'disable-amd64-avx-test
+               (lambda _
+                 (substitute* "src/test/ui/issues/issue-44056.rs"
+                  (("only-x86_64") "ignore-test"))
+                 #t))
              (add-after 'patch-tests 'patch-process-docs-rev-cmd
                (lambda* _
                  ;; Disable some doc tests which depend on the "rev" command
@@ -1084,7 +1093,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
           `(modify-phases ,phases
              (delete 'patch-process-docs-rev-cmd))))))))
 
-(define-public rust
+(define-public rust-1.37
   (let ((base-rust
          (rust-bootstrapped-package rust-1.36 "1.37.0"
            "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj")))
@@ -1100,3 +1109,24 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
                    (mkdir-p cargo-home)
                    (setenv "CARGO_HOME" cargo-home)
                    #t))))))))))
+
+(define-public rust-1.38
+  (let ((base-rust
+         (rust-bootstrapped-package rust-1.37 "1.38.0"
+           "101dlpsfkq67p0hbwx4acqq6n90dj4bbprndizpgh1kigk566hk4")))
+    (package
+      (inherit base-rust)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base-rust)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (replace 'patch-command-exec-tests
+               ,(patch-command-exec-tests-phase
+                  "src/test/ui/command-exec.rs"))
+             (add-after 'patch-tests 'patch-command-uid-gid-test
+               (lambda _
+                 (substitute* "src/test/ui/command-uid-gid.rs"
+                   (("/bin/sh") (which "sh"))
+                   (("ignore-sgx") "ignore-sgx\n// ignore-tidy-linelength")))))))))))
+
+(define-public rust rust-1.37)
-- 
2.25.1