diff options
| -rw-r--r-- | guix/grafts.scm | 7 | ||||
| -rw-r--r-- | tests/grafts.scm | 13 |
2 files changed, 14 insertions, 6 deletions
diff --git a/guix/grafts.scm b/guix/grafts.scm index 01e245d8eba..63f384555b4 100644 --- a/guix/grafts.scm +++ b/guix/grafts.scm | |||
| @@ -123,6 +123,10 @@ are not recursively applied to dependencies of DRV." | |||
| 123 | (define add-label | 123 | (define add-label |
| 124 | (cut cons "x" <>)) | 124 | (cut cons "x" <>)) |
| 125 | 125 | ||
| 126 | (define properties | ||
| 127 | `((type . graft) | ||
| 128 | (graft (count . ,(length grafts))))) | ||
| 129 | |||
| 126 | (match grafts | 130 | (match grafts |
| 127 | ((($ <graft> sources source-outputs targets target-outputs) ...) | 131 | ((($ <graft> sources source-outputs targets target-outputs) ...) |
| 128 | (let ((sources (zip sources source-outputs)) | 132 | (let ((sources (zip sources source-outputs)) |
| @@ -140,7 +144,8 @@ are not recursively applied to dependencies of DRV." | |||
| 140 | ,@(append (map add-label sources) | 144 | ,@(append (map add-label sources) |
| 141 | (map add-label targets))) | 145 | (map add-label targets))) |
| 142 | #:outputs outputs | 146 | #:outputs outputs |
| 143 | #:local-build? #t))))) | 147 | #:local-build? #t |
| 148 | #:properties properties))))) | ||
| 144 | (define (item->deriver store item) | 149 | (define (item->deriver store item) |
| 145 | "Return two values: the derivation that led to ITEM (a store item), and the | 150 | "Return two values: the derivation that led to ITEM (a store item), and the |
| 146 | name of the output of that derivation ITEM corresponds to (for example | 151 | name of the output of that derivation ITEM corresponds to (for example |
diff --git a/tests/grafts.scm b/tests/grafts.scm index abb074d628f..f85f3c6913c 100644 --- a/tests/grafts.scm +++ b/tests/grafts.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -51,7 +51,8 @@ | |||
| 51 | 51 | ||
| 52 | (test-begin "grafts") | 52 | (test-begin "grafts") |
| 53 | 53 | ||
| 54 | (test-assert "graft-derivation, grafted item is a direct dependency" | 54 | (test-equal "graft-derivation, grafted item is a direct dependency" |
| 55 | '((type . graft) (graft (count . 2))) | ||
| 55 | (let* ((build `(begin | 56 | (let* ((build `(begin |
| 56 | (mkdir %output) | 57 | (mkdir %output) |
| 57 | (chdir %output) | 58 | (chdir %output) |
| @@ -76,14 +77,16 @@ | |||
| 76 | (origin %mkdir) | 77 | (origin %mkdir) |
| 77 | (replacement two)))))) | 78 | (replacement two)))))) |
| 78 | (and (build-derivations %store (list grafted)) | 79 | (and (build-derivations %store (list grafted)) |
| 79 | (let ((two (derivation->output-path two)) | 80 | (let ((properties (derivation-properties grafted)) |
| 80 | (grafted (derivation->output-path grafted))) | 81 | (two (derivation->output-path two)) |
| 82 | (grafted (derivation->output-path grafted))) | ||
| 81 | (and (string=? (format #f "foo/~a/bar" two) | 83 | (and (string=? (format #f "foo/~a/bar" two) |
| 82 | (call-with-input-file (string-append grafted "/text") | 84 | (call-with-input-file (string-append grafted "/text") |
| 83 | get-string-all)) | 85 | get-string-all)) |
| 84 | (string=? (readlink (string-append grafted "/sh")) one) | 86 | (string=? (readlink (string-append grafted "/sh")) one) |
| 85 | (string=? (readlink (string-append grafted "/self")) | 87 | (string=? (readlink (string-append grafted "/self")) |
| 86 | grafted)))))) | 88 | grafted) |
| 89 | properties))))) | ||
| 87 | 90 | ||
| 88 | (test-assert "graft-derivation, grafted item uses a different name" | 91 | (test-assert "graft-derivation, grafted item uses a different name" |
| 89 | (let* ((build `(begin | 92 | (let* ((build `(begin |
