aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-06-23 11:46:17 +0200
committerLudovic Courtès <ludo@gnu.org>2019-06-27 11:14:41 +0200
commitc89985d91d2b44704fbcaebd7a097dee0c0e3e4a (patch)
treee4526f0321de2b397eaad258ce8a7be5e28c6362
parent4311cf965c978c7865c03349c82110b241f8ff23 (diff)
downloadguix-c89985d91d2b44704fbcaebd7a097dee0c0e3e4a.tar
guix-c89985d91d2b44704fbcaebd7a097dee0c0e3e4a.tar.gz
derivations: Add 'derivation-input'.
* guix/derivations.scm (derivation-input): New procedure. * tests/grafts.scm (make-derivation-input): Remove. ("graft-derivation, unused outputs not depended on"): Use 'derivation-input'.
-rw-r--r--guix/derivations.scm8
-rw-r--r--tests/grafts.scm16
2 files changed, 12 insertions, 12 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 8145d51143..4df7b06181 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -157,6 +157,14 @@
"Return the <derivation> object INPUT refers to."
(read-derivation-from-file (derivation-input-path input)))
+(define* (derivation-input drv #:optional
+ (outputs (derivation-output-names drv)))
+ "Return a <derivation-input> for the OUTPUTS of DRV."
+ ;; This is a public interface meant to be more convenient than
+ ;; 'make-derivation-input' and giving us more control.
+ (make-derivation-input (derivation-file-name drv)
+ outputs))
+
(set-record-type-printer! <derivation>
(lambda (drv port)
(format port "#<derivation ~a => ~a ~a>"
diff --git a/tests/grafts.scm b/tests/grafts.scm
index f85f3c6913..6fd3d5e171 100644
--- a/tests/grafts.scm
+++ b/tests/grafts.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -45,9 +45,6 @@
(define %mkdir
(bootstrap-binary "mkdir"))
-(define make-derivation-input
- (@@ (guix derivations) make-derivation-input))
-
(test-begin "grafts")
@@ -356,16 +353,11 @@
(p1r-inputs (filter (match-input p1r) inputs))
(p2-inputs (filter (match-input p2) inputs)))
(and (equal? p1-inputs
- (list (make-derivation-input (derivation-file-name p1)
- '("one"))))
+ (list (derivation-input p1 '("one"))))
(equal? p1r-inputs
- (list
- (make-derivation-input (derivation-file-name p1r)
- '("ONE"))))
+ (list (derivation-input p1r '("ONE"))))
(equal? p2-inputs
- (list
- (make-derivation-input (derivation-file-name p2)
- '("aaa"))))
+ (list (derivation-input p2 '("aaa"))))
(derivation-output-names p2g))))))
(test-assert "graft-derivation, renaming" ;<http://bugs.gnu.org/23132>