pull: Add '--profile'.

* guix/scripts/pull.scm (show-help, %options): Add '--profile'.
(build-and-install): Change 'config-dir' argument to 'profile'.
(guix-pull): Honor '--profile'.
* doc/guix.texi (Invoking guix pull): Document it.
This commit is contained in:
Ludovic Courtès 2018-09-03 12:46:40 +02:00
parent 214452ffd3
commit ee94cfeb99
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 16 additions and 7 deletions

View File

@ -2851,6 +2851,10 @@ is provided, the subset of generations that match @var{pattern}.
The syntax of @var{pattern} is the same as with @code{guix package The syntax of @var{pattern} is the same as with @code{guix package
--list-generations} (@pxref{Invoking guix package}). --list-generations} (@pxref{Invoking guix package}).
@item --profile=@var{profile}
@itemx -p @var{profile}
Use @var{profile} instead of @file{~/.config/guix/current}.
@item --bootstrap @item --bootstrap
Use the bootstrap Guile to build the latest Guix. This option is only Use the bootstrap Guile to build the latest Guix. This option is only
useful to Guix developers. useful to Guix developers.

View File

@ -79,6 +79,8 @@ Download and deploy the latest version of Guix.\n"))
(display (G_ " (display (G_ "
-l, --list-generations[=PATTERN] -l, --list-generations[=PATTERN]
list generations matching PATTERN")) list generations matching PATTERN"))
(display (G_ "
-p, --profile=PROFILE use PROFILE instead of ~/.config/guix/current"))
(display (G_ " (display (G_ "
--bootstrap use the bootstrap Guile to build the new Guix")) --bootstrap use the bootstrap Guile to build the new Guix"))
(newline) (newline)
@ -113,6 +115,10 @@ Download and deploy the latest version of Guix.\n"))
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'ref `(branch . ,(string-append "origin/" arg)) (alist-cons 'ref `(branch . ,(string-append "origin/" arg))
result))) result)))
(option '(#\p "profile") #t #f
(lambda (opt name arg result)
(alist-cons 'profile (canonicalize-profile arg)
result)))
(option '(#\n "dry-run") #f #f (option '(#\n "dry-run") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) (alist-cons 'dry-run? #t (alist-cons 'graft? #f result))))
@ -152,15 +158,12 @@ Download and deploy the latest version of Guix.\n"))
#:heading (G_ "New in this revision:\n")))) #:heading (G_ "New in this revision:\n"))))
(_ #t))) (_ #t)))
(define* (build-and-install instances config-dir (define* (build-and-install instances profile
#:key verbose?) #:key verbose?)
"Build the tool from SOURCE, and install it in CONFIG-DIR." "Build the tool from SOURCE, and install it in PROFILE."
(define update-profile (define update-profile
(store-lift build-and-use-profile)) (store-lift build-and-use-profile))
(define profile
(string-append config-dir "/current"))
(mlet %store-monad ((manifest (channel-instances->manifest instances))) (mlet %store-monad ((manifest (channel-instances->manifest instances)))
(mbegin %store-monad (mbegin %store-monad
(update-profile profile manifest) (update-profile profile manifest)
@ -414,7 +417,9 @@ Use '~/.config/guix/channels.scm' instead."))
(let* ((opts (parse-command-line args %options (let* ((opts (parse-command-line args %options
(list %default-options))) (list %default-options)))
(cache (string-append (cache-directory) "/pull")) (cache (string-append (cache-directory) "/pull"))
(channels (channel-list opts))) (channels (channel-list opts))
(profile (or (assoc-ref opts 'profile)
(string-append (config-directory) "/current"))))
(cond ((assoc-ref opts 'query) (cond ((assoc-ref opts 'query)
(process-query opts)) (process-query opts))
@ -456,7 +461,7 @@ Use '~/.config/guix/channels.scm' instead."))
%bootstrap-guile %bootstrap-guile
(canonical-package guile-2.2))))) (canonical-package guile-2.2)))))
(run-with-store store (run-with-store store
(build-and-install instances (config-directory) (build-and-install instances profile
#:verbose? #:verbose?
(assoc-ref opts 'verbose?))))))))))))) (assoc-ref opts 'verbose?)))))))))))))