diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-03-04 23:27:24 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-03-04 23:27:24 +0100 |
commit | 81eec00cb221231123b74d14245ef7caa9d89ff6 (patch) | |
tree | 3beeb77c5535038dc75db843dd88a1775fb541bb /guix/ui.scm | |
parent | 8689a1908a8353b80ed1fcbb81feddc5eb799f24 (diff) | |
parent | 2a1e82bb5c2ae28b0018aa765cff6733136b3f70 (diff) |
Merge branch 'master' into core-updates
Conflicts:
Makefile.am
guix/scripts/gc.scm
guix/scripts/package.scm
guix/ui.scm
tests/guix-package.sh
Diffstat (limited to 'guix/ui.scm')
-rw-r--r-- | guix/ui.scm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/guix/ui.scm b/guix/ui.scm index 7e0c61b4f8..03d881a428 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -38,6 +38,7 @@ show-what-to-build call-with-error-handling with-error-handling + read/eval-package-expression location->string call-with-temporary-output-file switch-symlinks @@ -116,6 +117,26 @@ General help using GNU software: <http://www.gnu.org/gethelp/>")) (nix-protocol-error-message c)))) (thunk))) +(define (read/eval-package-expression str) + "Read and evaluate STR and return the package it refers to, or exit an +error." + (let ((exp (catch #t + (lambda () + (call-with-input-string str read)) + (lambda args + (leave (_ "failed to read expression ~s: ~s~%") + str args))))) + (let ((p (catch #t + (lambda () + (eval exp the-scm-module)) + (lambda args + (leave (_ "failed to evaluate expression `~a': ~s~%") + exp args))))) + (if (package? p) + p + (leave (_ "expression `~s' does not evaluate to a package~%") + exp))))) + (define* (show-what-to-build store drv #:optional dry-run?) "Show what will or would (depending on DRY-RUN?) be built in realizing the derivations listed in DRV. Return #t if there's something to build, #f |