diff options
| author | Marius Bakke <mbakke@fastmail.com> | 2020-03-30 12:17:33 +0200 |
|---|---|---|
| committer | Marius Bakke <mbakke@fastmail.com> | 2020-03-30 12:17:33 +0200 |
| commit | ae0badf5bb791428423a98d4e4e2b8d297a5d4be (patch) | |
| tree | 4282d243db3e90839a5f7d3b5878674ccd0e2e14 /gnu/packages/rust.scm | |
| parent | ee401ed9249fbe284ef1b9b437d39207ca88131b (diff) | |
| parent | 927f3655662b41f25225ea03baa3ded687aa7cbb (diff) | |
Merge branch 'master' into core-updates
Conflicts:
gnu/packages/admin.scm
gnu/packages/commencement.scm
gnu/packages/guile.scm
gnu/packages/linux.scm
gnu/packages/package-management.scm
gnu/packages/pulseaudio.scm
gnu/packages/web.scm
Diffstat (limited to 'gnu/packages/rust.scm')
| -rw-r--r-- | gnu/packages/rust.scm | 121 |
1 files changed, 99 insertions, 22 deletions
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 76afdefabe2..6774603db6f 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm | |||
| @@ -55,6 +55,32 @@ | |||
| 55 | #:use-module (ice-9 match) | 55 | #:use-module (ice-9 match) |
| 56 | #:use-module (srfi srfi-26)) | 56 | #:use-module (srfi srfi-26)) |
| 57 | 57 | ||
| 58 | ;; This is the hash for the empty file, and the reason it's relevant is not | ||
| 59 | ;; the most obvious. | ||
| 60 | ;; | ||
| 61 | ;; The root of the problem is that Cargo keeps track of a file called | ||
| 62 | ;; Cargo.lock, that contains the hash of the tarball source of each dependency. | ||
| 63 | ;; | ||
| 64 | ;; However, tarball sources aren't handled well by Guix because of the need to | ||
| 65 | ;; patch shebangs in any helper scripts. This is why we use Cargo's vendoring | ||
| 66 | ;; capabilities, where instead of the tarball, a directory is provided in its | ||
| 67 | ;; place. (In the case of rustc, the source code already ships with vendored | ||
| 68 | ;; dependencies, but crates built with cargo-build-system undergo vendoring | ||
| 69 | ;; during the build.) | ||
| 70 | ;; | ||
| 71 | ;; To preserve the advantages of checksumming, vendored dependencies contain | ||
| 72 | ;; a file called .cargo-checksum.json, which contains the hash of the tarball, | ||
| 73 | ;; as well as the list of files in it, with the hash of each file. | ||
| 74 | ;; | ||
| 75 | ;; The patch-cargo-checksums phase of cargo-build-system runs after | ||
| 76 | ;; any Guix-specific patches to the vendored dependencies and regenerates the | ||
| 77 | ;; .cargo-checksum.json files, but it's hard to know the tarball checksum that | ||
| 78 | ;; should be written to the file - and taking care of any unhandled edge case | ||
| 79 | ;; would require rebuilding everything that depends on rust. This is why we lie, | ||
| 80 | ;; and say that the tarball has the hash of an empty file. It's not a problem | ||
| 81 | ;; because cargo-build-system removes the Cargo.lock file. We can't do that | ||
| 82 | ;; for rustc because of a quirk of its build system, so we modify the lock file | ||
| 83 | ;; to substitute the hash. | ||
| 58 | (define %cargo-reference-hash | 84 | (define %cargo-reference-hash |
| 59 | "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") | 85 | "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") |
| 60 | 86 | ||
| @@ -912,9 +938,30 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" | |||
| 912 | (replace 'disable-amd64-avx-test | 938 | (replace 'disable-amd64-avx-test |
| 913 | (lambda _ | 939 | (lambda _ |
| 914 | (substitute* "src/test/ui/run-pass/issues/issue-44056.rs" | 940 | (substitute* "src/test/ui/run-pass/issues/issue-44056.rs" |
| 915 | (("only-x86_64") "ignore-test")) | 941 | (("only-x86_64") "ignore-test")) |
| 916 | #t))))))))) | 942 | #t))))))))) |
| 917 | 943 | ||
| 944 | (define (patch-command-exec-tests-phase test-path) | ||
| 945 | "The command-exec.rs test moves around between releases. We need to apply | ||
| 946 | a Guix-specific patch to it for each release. This function generates the phase | ||
| 947 | that applies said patch, parametrized by the test-path. This is done this way | ||
| 948 | because the phase is more complex than the equivalents for other tests that | ||
| 949 | move around." | ||
| 950 | `(lambda* (#:key inputs #:allow-other-keys) | ||
| 951 | (let ((coreutils (assoc-ref inputs "coreutils"))) | ||
| 952 | (substitute* ,test-path | ||
| 953 | ;; This test suite includes some tests that the stdlib's | ||
| 954 | ;; `Command` execution properly handles situations where | ||
| 955 | ;; the environment or PATH variable are empty, but this | ||
| 956 | ;; fails since we don't have `echo` available in the usual | ||
| 957 | ;; Linux directories. | ||
| 958 | ;; NB: the leading space is so we don't fail a tidy check | ||
| 959 | ;; for trailing whitespace, and the newlines are to ensure | ||
| 960 | ;; we don't exceed the 100 chars tidy check as well | ||
| 961 | ((" Command::new\\(\"echo\"\\)") | ||
| 962 | (string-append "\nCommand::new(\"" coreutils "/bin/echo\")\n"))) | ||
| 963 | #t))) | ||
| 964 | |||
| 918 | (define-public rust-1.31 | 965 | (define-public rust-1.31 |
| 919 | (let ((base-rust | 966 | (let ((base-rust |
| 920 | (rust-bootstrapped-package rust-1.30 "1.31.1" | 967 | (rust-bootstrapped-package rust-1.30 "1.31.1" |
| @@ -926,26 +973,14 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" | |||
| 926 | ((#:phases phases) | 973 | ((#:phases phases) |
| 927 | `(modify-phases ,phases | 974 | `(modify-phases ,phases |
| 928 | (add-after 'patch-tests 'patch-command-exec-tests | 975 | (add-after 'patch-tests 'patch-command-exec-tests |
| 929 | (lambda* (#:key inputs #:allow-other-keys) | 976 | ,(patch-command-exec-tests-phase |
| 930 | (let ((coreutils (assoc-ref inputs "coreutils"))) | 977 | "src/test/run-pass/command-exec.rs")) |
| 931 | (substitute* "src/test/run-pass/command-exec.rs" | 978 | ;; The test has been moved elsewhere. |
| 932 | ;; This test suite includes some tests that the stdlib's | 979 | (replace 'disable-amd64-avx-test |
| 933 | ;; `Command` execution properly handles situations where | 980 | (lambda _ |
| 934 | ;; the environment or PATH variable are empty, but this | 981 | (substitute* "src/test/ui/issues/issue-44056.rs" |
| 935 | ;; fails since we don't have `echo` available in the usual | 982 | (("only-x86_64") "ignore-test")) |
| 936 | ;; Linux directories. | 983 | #t)) |
| 937 | ;; NB: the leading space is so we don't fail a tidy check | ||
| 938 | ;; for trailing whitespace, and the newlines are to ensure | ||
| 939 | ;; we don't exceed the 100 chars tidy check as well | ||
| 940 | ((" Command::new\\(\"echo\"\\)") | ||
| 941 | (string-append "\nCommand::new(\"" coreutils "/bin/echo\")\n"))) | ||
| 942 | #t))) | ||
| 943 | ;; The test has been moved elsewhere. | ||
| 944 | (replace 'disable-amd64-avx-test | ||
| 945 | (lambda _ | ||
| 946 | (substitute* "src/test/ui/issues/issue-44056.rs" | ||
| 947 | (("only-x86_64") "ignore-test")) | ||
| 948 | #t)) | ||
| 949 | (add-after 'patch-tests 'patch-process-docs-rev-cmd | 984 | (add-after 'patch-tests 'patch-process-docs-rev-cmd |
| 950 | (lambda* _ | 985 | (lambda* _ |
| 951 | ;; Disable some doc tests which depend on the "rev" command | 986 | ;; Disable some doc tests which depend on the "rev" command |
| @@ -1087,7 +1122,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" | |||
| 1087 | `(modify-phases ,phases | 1122 | `(modify-phases ,phases |
| 1088 | (delete 'patch-process-docs-rev-cmd)))))))) | 1123 | (delete 'patch-process-docs-rev-cmd)))))))) |
| 1089 | 1124 | ||
| 1090 | (define-public rust | 1125 | (define-public rust-1.37 |
| 1091 | (let ((base-rust | 1126 | (let ((base-rust |
| 1092 | (rust-bootstrapped-package rust-1.36 "1.37.0" | 1127 | (rust-bootstrapped-package rust-1.36 "1.37.0" |
| 1093 | "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj"))) | 1128 | "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj"))) |
| @@ -1103,3 +1138,45 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" | |||
| 1103 | (mkdir-p cargo-home) | 1138 | (mkdir-p cargo-home) |
| 1104 | (setenv "CARGO_HOME" cargo-home) | 1139 | (setenv "CARGO_HOME" cargo-home) |
| 1105 | #t)))))))))) | 1140 | #t)))))))))) |
| 1141 | |||
| 1142 | (define-public rust-1.38 | ||
| 1143 | (let ((base-rust | ||
| 1144 | (rust-bootstrapped-package rust-1.37 "1.38.0" | ||
| 1145 | "101dlpsfkq67p0hbwx4acqq6n90dj4bbprndizpgh1kigk566hk4"))) | ||
| 1146 | (package | ||
| 1147 | (inherit base-rust) | ||
| 1148 | (arguments | ||
| 1149 | (substitute-keyword-arguments (package-arguments base-rust) | ||
| 1150 | ((#:phases phases) | ||
| 1151 | `(modify-phases ,phases | ||
| 1152 | (replace 'patch-command-exec-tests | ||
| 1153 | ,(patch-command-exec-tests-phase | ||
| 1154 | "src/test/ui/command-exec.rs")) | ||
| 1155 | (add-after 'patch-tests 'patch-command-uid-gid-test | ||
| 1156 | (lambda _ | ||
| 1157 | (substitute* "src/test/ui/command-uid-gid.rs" | ||
| 1158 | (("/bin/sh") (which "sh")) | ||
| 1159 | (("ignore-sgx") "ignore-sgx\n// ignore-tidy-linelength")) | ||
| 1160 | #t))))))))) | ||
| 1161 | |||
| 1162 | (define-public rust-1.39 | ||
| 1163 | (let ((base-rust | ||
| 1164 | (rust-bootstrapped-package rust-1.38 "1.39.0" | ||
| 1165 | "0mwkc1bnil2cfyf6nglpvbn2y0zfbv44zfhsd5qg4c9rm6vgd8dl"))) | ||
| 1166 | (package | ||
| 1167 | (inherit base-rust) | ||
| 1168 | (arguments | ||
| 1169 | (substitute-keyword-arguments (package-arguments base-rust) | ||
| 1170 | ((#:phases phases) | ||
| 1171 | `(modify-phases ,phases | ||
| 1172 | (replace 'patch-cargo-checksums | ||
| 1173 | ;; The Cargo.lock format changed. | ||
| 1174 | (lambda* _ | ||
| 1175 | (use-modules (guix build cargo-utils)) | ||
| 1176 | (substitute* "Cargo.lock" | ||
| 1177 | (("(checksum = )\".*\"" all name) | ||
| 1178 | (string-append name "\"" ,%cargo-reference-hash "\""))) | ||
| 1179 | (generate-all-checksums "vendor") | ||
| 1180 | #t))))))))) | ||
| 1181 | |||
| 1182 | (define-public rust rust-1.37) | ||
