environment: Connect to the store after the command line has been parsed.

* guix/scripts/environment.scm (guix-environment): Call 'parse-command-line'
  outside of 'with-store'.  This allows things like --help to run even if the
  daemon is not running.
This commit is contained in:
Ludovic Courtès 2015-06-11 11:09:12 +02:00
parent 57cd353d87
commit c2590362ad
1 changed files with 15 additions and 13 deletions

View File

@ -232,20 +232,22 @@ packages."
(alist-cons 'package arg result)) (alist-cons 'package arg result))
(with-error-handling (with-error-handling
(with-store store (let* ((opts (parse-command-line args %options (list %default-options)
(let* ((opts (parse-command-line args %options (list %default-options) #:argument-handler handle-argument))
#:argument-handler handle-argument)) (pure? (assoc-ref opts 'pure))
(pure? (assoc-ref opts 'pure)) (ad-hoc? (assoc-ref opts 'ad-hoc?))
(ad-hoc? (assoc-ref opts 'ad-hoc?)) (command (assoc-ref opts 'exec))
(command (assoc-ref opts 'exec)) (packages (pick-all (options/resolve-packages opts) 'package))
(packages (pick-all (options/resolve-packages opts) 'package)) (inputs (if ad-hoc?
(inputs (if ad-hoc?
(packages+propagated-inputs packages) (packages+propagated-inputs packages)
(packages->transitive-inputs packages))) (packages->transitive-inputs packages))))
(drvs (run-with-store store (with-store store
(mbegin %store-monad (define drvs
(set-guile-for-build (default-guile)) (run-with-store store
(build-inputs inputs opts))))) (mbegin %store-monad
(set-guile-for-build (default-guile))
(build-inputs inputs opts))))
(cond ((assoc-ref opts 'dry-run?) (cond ((assoc-ref opts 'dry-run?)
#t) #t)
((assoc-ref opts 'search-paths) ((assoc-ref opts 'search-paths)