From 69daee23af49aeafcb1d250c90860f9253da719e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 3 May 2017 15:57:02 +0200 Subject: ui: Rename '_' to 'G_'. This avoids collisions with '_' when the latter is used as a 'match' pattern for instance. See . * guix/ui.scm: Rename '_' to 'G_'. * po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly. * build-aux/compile-all.scm (warnings): Remove 'format'. * gnu/packages.scm, gnu/services.scm, gnu/services/shepherd.scm, gnu/system.scm, gnu/system/shadow.scm, guix/gnupg.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/elpa.scm, guix/import/pypi.scm, guix/nar.scm, guix/scripts.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/build.scm, guix/scripts/challenge.scm, guix/scripts/container.scm, guix/scripts/container/exec.scm, guix/scripts/copy.scm, guix/scripts/download.scm, guix/scripts/edit.scm, guix/scripts/environment.scm, guix/scripts/gc.scm, guix/scripts/graph.scm, guix/scripts/hash.scm, guix/scripts/import.scm, guix/scripts/import/cpan.scm, guix/scripts/import/cran.scm, guix/scripts/import/crate.scm, guix/scripts/import/elpa.scm, guix/scripts/import/gem.scm, guix/scripts/import/gnu.scm, guix/scripts/import/hackage.scm, guix/scripts/import/nix.scm, guix/scripts/import/pypi.scm, guix/scripts/import/stackage.scm, guix/scripts/lint.scm, guix/scripts/offload.scm, guix/scripts/pack.scm, guix/scripts/package.scm, guix/scripts/perform-download.scm, guix/scripts/publish.scm, guix/scripts/pull.scm, guix/scripts/refresh.scm, guix/scripts/size.scm, guix/scripts/substitute.scm, guix/scripts/system.scm, guix/ssh.scm, guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`". --- guix/scripts/pull.scm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'guix/scripts/pull.scm') diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 8e31ad620c..82fcaa248c 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -75,18 +75,18 @@ `((tarball-url . ,%snapshot-url))) (define (show-help) - (display (_ "Usage: guix pull [OPTION]... + (display (G_ "Usage: guix pull [OPTION]... Download and deploy the latest version of Guix.\n")) - (display (_ " + (display (G_ " --verbose produce verbose output")) - (display (_ " + (display (G_ " --url=URL download the Guix tarball from URL")) - (display (_ " + (display (G_ " --bootstrap use the bootstrap Guile to build the new Guix")) (newline) - (display (_ " + (display (G_ " -h, --help display this help and exit")) - (display (_ " + (display (G_ " -V, --version display version information and exit")) (newline) (show-bug-report-information)) @@ -153,7 +153,7 @@ store file name." (mbegin %store-monad (what-to-build (list tar gzip)) (built-derivations (list tar gzip)) - (format #t (_ "unpacking '~a'...~%") tarball) + (format #t (G_ "unpacking '~a'...~%") tarball) (let ((source (temporary-directory))) (with-directory-excursion source @@ -205,24 +205,24 @@ contained therein." (if (and (file-exists? latest) (string=? (readlink latest) source-dir)) (begin - (display (_ "Guix already up to date\n")) + (display (G_ "Guix already up to date\n")) (return #t)) (begin (switch-symlinks latest source-dir) (format #t - (_ "updated ~a successfully deployed under `~a'~%") + (G_ "updated ~a successfully deployed under `~a'~%") %guix-package-name latest) (return #t)))) - (leave (_ "failed to update Guix, check the build log~%"))))) + (leave (G_ "failed to update Guix, check the build log~%"))))) (define (guix-pull . args) (define (parse-options) ;; Return the alist of option values. (args-fold* args %options (lambda (opt name arg result) - (leave (_ "~A: unrecognized option~%") name)) + (leave (G_ "~A: unrecognized option~%") name)) (lambda (arg result) - (leave (_ "~A: unexpected argument~%") arg)) + (leave (G_ "~A: unexpected argument~%") arg)) %default-options)) (define (use-le-certs? url) @@ -245,7 +245,7 @@ contained therein." (fetch-tarball store url))) (fetch-tarball store url)))) (unless tarball - (leave (_ "failed to download up-to-date source, exiting\n"))) + (leave (G_ "failed to download up-to-date source, exiting\n"))) (parameterize ((%guile-for-build (package-derivation store (if (assoc-ref opts 'bootstrap?) -- cgit v1.2.3 From 4902d3c4e0376974356481f222583580b49f39e1 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 9 May 2017 15:45:04 +0200 Subject: pull: Honor the standard build options. Reported by Niall Dooley in . * guix/scripts/pull.scm (%options): Add --dry-run and all of %STANDARD-BUILD-OPTIONS. (show-help): Add call to 'show-build-options-help'. (%default-options): Add 'system', 'substitutes?', 'graft?', 'max-silent-time', and 'verbosity'. (guix-pull)[parse-options]: Remove. Use 'parse-command-line' instead. Honor --dry-run. --- doc/guix.texi | 6 ++- guix/scripts/pull.scm | 103 +++++++++++++++++++++++++++----------------------- 2 files changed, 59 insertions(+), 50 deletions(-) (limited to 'guix/scripts/pull.scm') diff --git a/doc/guix.texi b/doc/guix.texi index 4446909ed6..22dc8b3f90 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2390,13 +2390,13 @@ For example, to download and deploy version 0.12.0 of Guix from the canonical Git repo: @example -guix pull --url=http://git.savannah.gnu.org/cgit/guix.git/snapshot/v0.12.0.tar.gz +guix pull --url=https://git.savannah.gnu.org/cgit/guix.git/snapshot/v0.12.0.tar.gz @end example It can also be used to deploy arbitrary Git revisions: @example -guix pull --url=http://git.savannah.gnu.org/cgit/guix.git/snapshot/74d862e8a.tar.gz +guix pull --url=https://git.savannah.gnu.org/cgit/guix.git/snapshot/74d862e8a.tar.gz @end example @item --bootstrap @@ -2404,6 +2404,8 @@ Use the bootstrap Guile to build the latest Guix. This option is only useful to Guix developers. @end table +In addition, @command{guix pull} supports all the common build options +(@pxref{Common Build Options}). @node Invoking guix pack @section Invoking @command{guix pack} diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 82fcaa248c..5ab95628b4 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2017 Ludovic Courtès ;;; Copyright © 2017 Marius Bakke ;;; ;;; This file is part of GNU Guix. @@ -28,6 +28,7 @@ #:use-module (guix download) #:use-module (guix gexp) #:use-module (guix monads) + #:use-module (guix scripts build) #:use-module ((guix build utils) #:select (with-directory-excursion delete-file-recursively)) #:use-module ((guix build download) @@ -72,7 +73,12 @@ (define %default-options ;; Alist of default option values. - `((tarball-url . ,%snapshot-url))) + `((tarball-url . ,%snapshot-url) + (system . ,(%current-system)) + (substitutes? . #t) + (graft? . #t) + (max-silent-time . 3600) + (verbosity . 0))) (define (show-help) (display (G_ "Usage: guix pull [OPTION]... @@ -84,6 +90,7 @@ Download and deploy the latest version of Guix.\n")) (display (G_ " --bootstrap use the bootstrap Guile to build the new Guix")) (newline) + (show-build-options-help) (display (G_ " -h, --help display this help and exit")) (display (G_ " @@ -93,24 +100,29 @@ Download and deploy the latest version of Guix.\n")) (define %options ;; Specifications of the command-line options. - (list (option '("verbose") #f #f - (lambda (opt name arg result) - (alist-cons 'verbose? #t result))) - (option '("url") #t #f - (lambda (opt name arg result) - (alist-cons 'tarball-url arg - (alist-delete 'tarball-url result)))) - (option '("bootstrap") #f #f - (lambda (opt name arg result) - (alist-cons 'bootstrap? #t result))) + (cons* (option '("verbose") #f #f + (lambda (opt name arg result) + (alist-cons 'verbose? #t result))) + (option '("url") #t #f + (lambda (opt name arg result) + (alist-cons 'tarball-url arg + (alist-delete 'tarball-url result)))) + (option '(#\n "dry-run") #f #f + (lambda (opt name arg result) + (alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) + (option '("bootstrap") #f #f + (lambda (opt name arg result) + (alist-cons 'bootstrap? #t result))) - (option '(#\h "help") #f #f - (lambda args - (show-help) - (exit 0))) - (option '(#\V "version") #f #f - (lambda args - (show-version-and-exit "guix pull"))))) + (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix pull"))) + + %standard-build-options)) (define what-to-build (store-lift show-what-to-build)) @@ -215,16 +227,8 @@ contained therein." (return #t)))) (leave (G_ "failed to update Guix, check the build log~%"))))) + (define (guix-pull . args) - (define (parse-options) - ;; Return the alist of option values. - (args-fold* args %options - (lambda (opt name arg result) - (leave (G_ "~A: unrecognized option~%") name)) - (lambda (arg result) - (leave (G_ "~A: unexpected argument~%") arg)) - %default-options)) - (define (use-le-certs? url) (string-prefix? "https://git.savannah.gnu.org/" url)) @@ -232,28 +236,31 @@ contained therein." (download-to-store store url "guix-latest.tar.gz")) (with-error-handling - (let* ((opts (parse-options)) + (let* ((opts (parse-command-line args %options + (list %default-options))) (store (open-connection)) (url (assoc-ref opts 'tarball-url))) - (let ((tarball - (if (use-le-certs? url) - (let* ((drv (package-derivation store le-certs)) - (certs (string-append (derivation->output-path drv) - "/etc/ssl/certs"))) - (build-derivations store (list drv)) - (parameterize ((%x509-certificate-directory certs)) - (fetch-tarball store url))) - (fetch-tarball store url)))) - (unless tarball - (leave (G_ "failed to download up-to-date source, exiting\n"))) - (parameterize ((%guile-for-build - (package-derivation store - (if (assoc-ref opts 'bootstrap?) - %bootstrap-guile - (canonical-package guile-2.0))))) - (run-with-store store - (build-and-install tarball (config-directory) - #:verbose? (assoc-ref opts 'verbose?)))))))) + (set-build-options-from-command-line store opts) + (unless (assoc-ref opts 'dry-run?) ;XXX: not very useful + (let ((tarball + (if (use-le-certs? url) + (let* ((drv (package-derivation store le-certs)) + (certs (string-append (derivation->output-path drv) + "/etc/ssl/certs"))) + (build-derivations store (list drv)) + (parameterize ((%x509-certificate-directory certs)) + (fetch-tarball store url))) + (fetch-tarball store url)))) + (unless tarball + (leave (G_ "failed to download up-to-date source, exiting\n"))) + (parameterize ((%guile-for-build + (package-derivation store + (if (assoc-ref opts 'bootstrap?) + %bootstrap-guile + (canonical-package guile-2.0))))) + (run-with-store store + (build-and-install tarball (config-directory) + #:verbose? (assoc-ref opts 'verbose?))))))))) ;; Local Variables: ;; eval: (put 'with-PATH 'scheme-indent-function 1) -- cgit v1.2.3 From 402e98c524a44f9b8c8e5da86f68ffbd854c6669 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 9 May 2017 15:48:23 +0200 Subject: pull: Use 'with-store'. * guix/scripts/pull.scm (guix-pull): Remove call to 'open-connection'. Use 'with-store' instead. --- guix/scripts/pull.scm | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'guix/scripts/pull.scm') diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 5ab95628b4..58b87d4df4 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -238,29 +238,29 @@ contained therein." (with-error-handling (let* ((opts (parse-command-line args %options (list %default-options))) - (store (open-connection)) (url (assoc-ref opts 'tarball-url))) - (set-build-options-from-command-line store opts) (unless (assoc-ref opts 'dry-run?) ;XXX: not very useful - (let ((tarball - (if (use-le-certs? url) - (let* ((drv (package-derivation store le-certs)) - (certs (string-append (derivation->output-path drv) - "/etc/ssl/certs"))) - (build-derivations store (list drv)) - (parameterize ((%x509-certificate-directory certs)) - (fetch-tarball store url))) - (fetch-tarball store url)))) - (unless tarball - (leave (G_ "failed to download up-to-date source, exiting\n"))) - (parameterize ((%guile-for-build - (package-derivation store - (if (assoc-ref opts 'bootstrap?) - %bootstrap-guile - (canonical-package guile-2.0))))) - (run-with-store store - (build-and-install tarball (config-directory) - #:verbose? (assoc-ref opts 'verbose?))))))))) + (with-store store + (set-build-options-from-command-line store opts) + (let ((tarball + (if (use-le-certs? url) + (let* ((drv (package-derivation store le-certs)) + (certs (string-append (derivation->output-path drv) + "/etc/ssl/certs"))) + (build-derivations store (list drv)) + (parameterize ((%x509-certificate-directory certs)) + (fetch-tarball store url))) + (fetch-tarball store url)))) + (unless tarball + (leave (G_ "failed to download up-to-date source, exiting\n"))) + (parameterize ((%guile-for-build + (package-derivation store + (if (assoc-ref opts 'bootstrap?) + %bootstrap-guile + (canonical-package guile-2.0))))) + (run-with-store store + (build-and-install tarball (config-directory) + #:verbose? (assoc-ref opts 'verbose?)))))))))) ;; Local Variables: ;; eval: (put 'with-PATH 'scheme-indent-function 1) -- cgit v1.2.3