From 257b93412ad52dc26b53e0dae71a79b9b51ab33f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 13 Mar 2014 19:21:49 +0100 Subject: guix build: Support '--with-source' along with '-e'. * guix/scripts/build.scm (derivation-from-expression): Remove. (options->derivations): Handle pairs of the form "('argument . (? derivation?))". (options/resolve-packages): Add 'store' parameter; update caller. Add 'system' variable. Add case for 'expression pairs. * guix/scripts/archive.scm (derivation-from-expression): New procedure. --- guix/scripts/archive.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'guix/scripts/archive.scm') diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm index 8280a821c5..0ab7686585 100644 --- a/guix/scripts/archive.scm +++ b/guix/scripts/archive.scm @@ -23,6 +23,7 @@ #:use-module (guix store) #:use-module (guix packages) #:use-module (guix derivations) + #:use-module (guix monads) #:use-module (guix ui) #:use-module (guix pki) #:use-module (guix pk-crypto) @@ -143,6 +144,24 @@ Export/import one or more packages from/to the store.\n")) %standard-build-options)) +(define (derivation-from-expression store str package-derivation + system source?) + "Read/eval STR and return the corresponding derivation path for SYSTEM. +When SOURCE? is true and STR evaluates to a package, return the derivation of +the package source; otherwise, use PACKAGE-DERIVATION to compute the +derivation of a package." + (match (read/eval str) + ((? package? p) + (if source? + (let ((source (package-source p))) + (if source + (package-source-derivation store source) + (leave (_ "package `~a' has no source~%") + (package-name p)))) + (package-derivation store p system))) + ((? procedure? proc) + (run-with-store store (proc) #:system system)))) + (define (options->derivations+files store opts) "Given OPTS, the result of 'args-fold', return a list of derivations to build and a list of store files to transfer." -- cgit v1.2.3