diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-10-17 23:43:33 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-10-17 23:59:03 +0200 |
| commit | 3d47aa81ba4c19b45ce9a9ff0ece0252777ea8ed (patch) | |
| tree | f12190e8ba332d08806100441dfdfec8acd80586 /tests/grafts.scm | |
| parent | 645b9df858683dc05ffa04c9eb2fdc45ccef4a65 (diff) | |
grafts: Apply the right grafts in the presence of multiple outputs.
Fixes <http://bugs.gnu.org/24712>.
* guix/grafts.scm (cumulative-grafts): Add grafts for all the outputs of
DRV.
* tests/grafts.scm ("graft-derivation, replaced derivation has multiple
outputs"): New test.
Diffstat (limited to 'tests/grafts.scm')
| -rw-r--r-- | tests/grafts.scm | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/grafts.scm b/tests/grafts.scm index 4eff06b4b3c..6454a03b1f5 100644 --- a/tests/grafts.scm +++ b/tests/grafts.scm | |||
| @@ -201,6 +201,54 @@ | |||
| 201 | (and (string=? (readlink one) repl) | 201 | (and (string=? (readlink one) repl) |
| 202 | (string=? (readlink two) one)))))) | 202 | (string=? (readlink two) one)))))) |
| 203 | 203 | ||
| 204 | (test-assert "graft-derivation, replaced derivation has multiple outputs" | ||
| 205 | ;; Here we have a replacement just for output "one" of P1 and not for the | ||
| 206 | ;; other output. Make sure the graft for P1:one correctly applies to the | ||
| 207 | ;; dependents of P1. See <http://bugs.gnu.org/24712>. | ||
| 208 | (let* ((p1 (build-expression->derivation | ||
| 209 | %store "p1" | ||
| 210 | `(let ((one (assoc-ref %outputs "one")) | ||
| 211 | (two (assoc-ref %outputs "two"))) | ||
| 212 | (mkdir one) | ||
| 213 | (mkdir two)) | ||
| 214 | #:outputs '("one" "two"))) | ||
| 215 | (p1r (build-expression->derivation | ||
| 216 | %store "P1" | ||
| 217 | `(let ((other (assoc-ref %outputs "ONE"))) | ||
| 218 | (mkdir other) | ||
| 219 | (call-with-output-file (string-append other "/replacement") | ||
| 220 | (const #t))) | ||
| 221 | #:outputs '("ONE"))) | ||
| 222 | (p2 (build-expression->derivation | ||
| 223 | %store "p2" | ||
| 224 | `(let ((out (assoc-ref %outputs "aaa"))) | ||
| 225 | (mkdir (assoc-ref %outputs "zzz")) | ||
| 226 | (mkdir out) (chdir out) | ||
| 227 | (symlink (assoc-ref %build-inputs "p1:one") "one") | ||
| 228 | (symlink (assoc-ref %build-inputs "p1:two") "two")) | ||
| 229 | #:outputs '("aaa" "zzz") | ||
| 230 | #:inputs `(("p1:one" ,p1 "one") | ||
| 231 | ("p1:two" ,p1 "two")))) | ||
| 232 | (p3 (build-expression->derivation | ||
| 233 | %store "p3" | ||
| 234 | `(symlink (assoc-ref %build-inputs "p2:aaa") | ||
| 235 | (assoc-ref %outputs "out")) | ||
| 236 | #:inputs `(("p2:aaa" ,p2 "aaa") | ||
| 237 | ("p2:zzz" ,p2 "zzz")))) | ||
| 238 | (p1g (graft | ||
| 239 | (origin p1) | ||
| 240 | (origin-output "one") | ||
| 241 | (replacement p1r) | ||
| 242 | (replacement-output "ONE"))) | ||
| 243 | (p3d (graft-derivation %store p3 (list p1g)))) | ||
| 244 | (and (build-derivations %store (list p3d)) | ||
| 245 | (let ((out (derivation->output-path (pk 'p2d p3d)))) | ||
| 246 | (and (not (string=? (readlink out) | ||
| 247 | (derivation->output-path p2 "aaa"))) | ||
| 248 | (string=? (derivation->output-path p1 "two") | ||
| 249 | (readlink (string-append out "/two"))) | ||
| 250 | (file-exists? (string-append out "/one/replacement"))))))) | ||
| 251 | |||
| 204 | (test-assert "graft-derivation, renaming" ;<http://bugs.gnu.org/23132> | 252 | (test-assert "graft-derivation, renaming" ;<http://bugs.gnu.org/23132> |
| 205 | (let* ((build `(begin | 253 | (let* ((build `(begin |
| 206 | (use-modules (guix build utils)) | 254 | (use-modules (guix build utils)) |
