diff options
author | Ludovic Courtès <ludo@gnu.org> | 2012-07-07 20:14:20 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2012-07-07 20:14:31 +0200 |
commit | a3d73f59e35e19561afde1bf60ef881a4e8db0e7 (patch) | |
tree | 5ef1d41fdae49ba439d3e10ae615f69abba45e6e /guix/packages.scm | |
parent | d5f0c7cc626a0517237c55848342777623d1bd01 (diff) | |
download | gnu-guix-a3d73f59e35e19561afde1bf60ef881a4e8db0e7.tar gnu-guix-a3d73f59e35e19561afde1bf60ef881a4e8db0e7.tar.gz |
Add `package-transitive-inputs'; use it to honor propagated inputs.
* guix/packages.scm (package-transitive-inputs): New procedure.
(package-derivation): Use it to compute INPUTS.
* tests/packages.scm (dummy-package): New macro.
("package-transitive-inputs"): New test.
Diffstat (limited to 'guix/packages.scm')
-rw-r--r-- | guix/packages.scm | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/guix/packages.scm b/guix/packages.scm index 2d269ad339..c835e92815 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -57,6 +57,7 @@ package-properties package-location + package-transitive-inputs package-source-derivation package-derivation package-cross-derivation)) @@ -161,6 +162,27 @@ representation." (($ <origin> uri method sha256 name) (method store uri 'sha256 sha256 name)))) +(define (package-transitive-inputs package) + "Return the transitive inputs of PACKAGE---i.e., its direct inputs along +with their propagated inputs, recursively." + (let loop ((inputs (concatenate (list (package-native-inputs package) + (package-inputs package) + (package-propagated-inputs package)))) + (result '())) + (match inputs + (() + (delete-duplicates (reverse result))) ; XXX: efficiency + (((and i (name (? package? p) sub ...)) rest ...) + (let ((t (map (match-lambda + ((dep-name derivation ...) + (cons (string-append name "/" dep-name) + derivation))) + (package-propagated-inputs p)))) + (loop (append t rest) + (append t (cons i result))))) + ((input rest ...) + (loop rest (cons input result)))))) + (define* (package-derivation store package #:optional (system (%current-system))) "Return the derivation of PACKAGE for SYSTEM." @@ -186,8 +208,7 @@ representation." (list name (add-to-store store (basename file) #t #f "sha256" file)))) - (concatenate (list native-inputs inputs - propagated-inputs))))) + (package-transitive-inputs package)))) (apply builder store (string-append name "-" version) (package-source-derivation store source) |