environment: Do not connect to the daemon when '--profile' is used.
This further speeds up the 'guix environment -p PROFILE' case. * guix/scripts/environment.scm (guix-environment*)[store-needed?]: New variable. [with-store/maybe]: New macro. Use it instead of 'with-store', and remove 'with-build-handler' form.master
parent
648a6eb03f
commit
99499a2037
|
@ -691,6 +691,26 @@ command-line option processing with 'parse-command-line'."
|
|||
(mappings (pick-all opts 'file-system-mapping))
|
||||
(white-list (pick-all opts 'inherit-regexp)))
|
||||
|
||||
(define store-needed?
|
||||
;; Whether connecting to the daemon is needed.
|
||||
(or container? (not profile)))
|
||||
|
||||
(define-syntax-rule (with-store/maybe store exp ...)
|
||||
;; Evaluate EXP... with STORE bound to a connection, unless
|
||||
;; STORE-NEEDED? is false, in which case STORE is bound to #f.
|
||||
(let ((proc (lambda (store) exp ...)))
|
||||
(if store-needed?
|
||||
(with-store s
|
||||
(set-build-options-from-command-line s opts)
|
||||
(with-build-handler (build-notifier #:use-substitutes?
|
||||
(assoc-ref opts 'substitutes?)
|
||||
#:verbosity
|
||||
(assoc-ref opts 'verbosity)
|
||||
#:dry-run?
|
||||
(assoc-ref opts 'dry-run?))
|
||||
(proc s)))
|
||||
(proc #f))))
|
||||
|
||||
(when container? (assert-container-features))
|
||||
|
||||
(when (and (not container?) link-prof?)
|
||||
|
@ -701,13 +721,7 @@ command-line option processing with 'parse-command-line'."
|
|||
(leave (G_ "--no-cwd cannot be used without --container~%")))
|
||||
|
||||
|
||||
(with-store store
|
||||
(with-build-handler (build-notifier #:use-substitutes?
|
||||
(assoc-ref opts 'substitutes?)
|
||||
#:verbosity
|
||||
(assoc-ref opts 'verbosity)
|
||||
#:dry-run?
|
||||
(assoc-ref opts 'dry-run?))
|
||||
(with-store/maybe store
|
||||
(with-status-verbosity (assoc-ref opts 'verbosity)
|
||||
(define manifest-from-opts
|
||||
(options/resolve-packages store opts))
|
||||
|
@ -724,12 +738,10 @@ command-line option processing with 'parse-command-line'."
|
|||
(when (null? (manifest-entries manifest))
|
||||
(warning (G_ "no packages specified; creating an empty environment~%")))
|
||||
|
||||
(set-build-options-from-command-line store opts)
|
||||
|
||||
;; Use the bootstrap Guile when requested.
|
||||
(parameterize ((%graft? (assoc-ref opts 'graft?))
|
||||
(%guile-for-build
|
||||
(and (or container? (not profile))
|
||||
(and store-needed?
|
||||
(package-derivation
|
||||
store
|
||||
(if bootstrap?
|
||||
|
@ -753,9 +765,10 @@ command-line option processing with 'parse-command-line'."
|
|||
;; --search-paths. Additionally, we might need to build bash for
|
||||
;; a container.
|
||||
(mbegin %store-monad
|
||||
(mwhen store-needed?
|
||||
(built-derivations (append
|
||||
(if prof-drv (list prof-drv) '())
|
||||
(if (derivation? bash) (list bash) '())))
|
||||
(if (derivation? bash) (list bash) '()))))
|
||||
(mwhen gc-root
|
||||
(register-gc-root profile gc-root))
|
||||
|
||||
|
@ -785,4 +798,8 @@ command-line option processing with 'parse-command-line'."
|
|||
(exit/status
|
||||
(launch-environment/fork command profile manifest
|
||||
#:white-list white-list
|
||||
#:pure? pure?)))))))))))))))
|
||||
#:pure? pure?))))))))))))))
|
||||
|
||||
;;; Local Variables:
|
||||
;;; (put 'with-store/maybe 'scheme-indent-function 1)
|
||||
;;; End:
|
||||
|
|
Reference in New Issue