summaryrefslogtreecommitdiff
path: root/guix/scripts/archive.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-03-17 18:26:46 +0100
committerLudovic Courtès <ludo@gnu.org>2014-03-17 18:26:46 +0100
commit0562dbe5d3160b72856bfa7d890ec2caf4073633 (patch)
tree56849a825f679cbd2e02ca03e42bbd8f9ff44a45 /guix/scripts/archive.scm
parentbfb6b1c7b788a5fbcffb089c0df9d254faed4d5b (diff)
parent9b43a0ffa3869e56063cd4dea054828e53113c4b (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/scripts/archive.scm')
-rw-r--r--guix/scripts/archive.scm19
1 files changed, 19 insertions, 0 deletions
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."