diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-01-05 23:51:13 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-01-05 23:51:13 +0100 |
commit | 7244a5f74e8a2f465b1ad04b5c4666457567c54e (patch) | |
tree | b8c8f624d087814ba7336a9fa5294133e97fcbb8 /guix | |
parent | 3441e164976c14ef8bf9a95ab4130ca25ac85e70 (diff) | |
download | gnu-guix-7244a5f74e8a2f465b1ad04b5c4666457567c54e.tar gnu-guix-7244a5f74e8a2f465b1ad04b5c4666457567c54e.tar.gz |
derivations: Add `derivation-path->output-paths'.
* guix/derivations.scm (derivation-path->output-paths): New procedure.
* tests/derivations.scm ("multiple-output derivation"): Test it.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/derivations.scm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index 6fbce14da0..6737dd6274 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org> +;;; Copyright (C) 2012, 2013 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of Guix. ;;; @@ -55,6 +55,7 @@ read-derivation write-derivation derivation-path->output-path + derivation-path->output-paths derivation %guile-for-build @@ -288,6 +289,16 @@ path of its output OUTPUT." (outputs (derivation-outputs drv))) (and=> (assoc-ref outputs output) derivation-output-path))))) +(define (derivation-path->output-paths path) + "Read the derivation from PATH (`/nix/store/xxx.drv'), and return the +list of name/path pairs of its outputs." + (let* ((drv (call-with-input-file path read-derivation)) + (outputs (derivation-outputs drv))) + (map (match-lambda + ((name . output) + (cons name (derivation-output-path output)))) + outputs))) + ;;; ;;; Derivation primitive. |