From 0991fd53367907908fbd901a9fbe79540e4e4527 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 6 Jan 2019 21:54:08 +0100 Subject: build: Require Guile 2.2. * configure.ac: Require Guile 2.2. * README: Adjust accordingly. * doc/guix.texi (Requirements): Likewise. * gnu/packages/package-management.scm (guile2.0-guix): Deprecate. (guix-minimal): Inherit from GUIX, not from GUILE2.0-GUIX. --- doc/guix.texi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 96654165bb..7c6a714830 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17,7 +17,7 @@ @set SUBSTITUTE-SERVER ci.guix.info @copying -Copyright @copyright{} 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès@* +Copyright @copyright{} 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès@* Copyright @copyright{} 2013, 2014, 2016 Andreas Enge@* Copyright @copyright{} 2013 Nikita Karetnikov@* Copyright @copyright{} 2014, 2015, 2016 Alex Kost@* @@ -645,8 +645,7 @@ GNU Guix is available for download from its website at GNU Guix depends on the following packages: @itemize -@item @url{http://gnu.org/software/guile/, GNU Guile}, version 2.0.13 or -later, including 2.2.x; +@item @url{http://gnu.org/software/guile/, GNU Guile}, version 2.2.x; @item @url{https://notabug.org/cwebber/guile-gcrypt, Guile-Gcrypt}, version 0.1.0 or later; @item -- cgit v1.2.3 From 8af4c335e32fbed7556a4cd7f26f93bc66afaace Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Mon, 31 Dec 2018 00:39:02 +0100 Subject: services: Add docker. * gnu/services/docker.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * doc/guix.texi (Miscellaneous Services): Document the service. --- doc/guix.texi | 27 ++++++++++++++ gnu/local.mk | 1 + gnu/services/docker.scm | 94 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 gnu/services/docker.scm (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 7c6a714830..c0cc8d4169 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -22118,6 +22118,33 @@ The following is an example @code{dicod-service} configuration. %dicod-database:gcide)))) @end example +@cindex Docker +@subsubheading Docker Service + +The @code{(gnu services docker)} module provides the following service. + +@defvr {Scheme Variable} docker-service-type + +This is the type of the service that runs @url{http://www.docker.com,Docker}, +a daemon that can execute application bundles (sometimes referred to as +``containers'') in isolated environments. + +@end defvr + +@deftp {Data Type} docker-configuration +This is the data type representing the configuration of Docker and Containerd. + +@table @asis + +@item @code{package} (default: @code{docker}) +The Docker package to use. + +@item @code{containerd} (default: @var{containerd}) +The Containerd package to use. + +@end table +@end deftp + @node Setuid Programs @subsection Setuid Programs diff --git a/gnu/local.mk b/gnu/local.mk index 25363869dd..7c319b727f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -483,6 +483,7 @@ GNU_SYSTEM_MODULES = \ %D%/services/desktop.scm \ %D%/services/dict.scm \ %D%/services/dns.scm \ + %D%/services/docker.scm \ %D%/services/authentication.scm \ %D%/services/games.scm \ %D%/services/kerberos.scm \ diff --git a/gnu/services/docker.scm b/gnu/services/docker.scm new file mode 100644 index 0000000000..6d270831b3 --- /dev/null +++ b/gnu/services/docker.scm @@ -0,0 +1,94 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2018 Danny Milosavljevic +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu services docker) + #:use-module (gnu services) + #:use-module (gnu services configuration) + #:use-module (gnu services base) + #:use-module (gnu services dbus) + #:use-module (gnu services shepherd) + #:use-module (gnu system shadow) + #:use-module (gnu packages docker) + #:use-module (guix records) + #:use-module (guix gexp) + #:use-module (guix packages) + + #:export (docker-configuration + docker-service-type)) + +(define-configuration docker-configuration + (docker + (package docker) + "Docker daemon package.") + (containerd + (package containerd) + "containerd package.")) + +(define %docker-accounts + (list (user-group (name "docker") (system? #t)))) + +(define (%containerd-activation config) + (let ((state-dir "/var/lib/containerd")) + #~(begin + (use-modules (guix build utils)) + (mkdir-p #$state-dir)))) + +(define (%docker-activation config) + (%containerd-activation config) + (let ((state-dir "/var/lib/docker")) + #~(begin + (use-modules (guix build utils)) + (mkdir-p #$state-dir)))) + +(define (containerd-shepherd-service config) + (let* ((package (docker-configuration-containerd config))) + (shepherd-service + (documentation "containerd daemon.") + (provision '(containerd)) + (start #~(make-forkexec-constructor + (list (string-append #$package "/bin/containerd")))) + (stop #~(make-kill-destructor))))) + +(define (docker-shepherd-service config) + (let* ((docker (docker-configuration-docker config))) + (shepherd-service + (documentation "Docker daemon.") + (provision '(dockerd)) + (requirement '(containerd)) + (start #~(make-forkexec-constructor + (list (string-append #$docker "/bin/dockerd") + "-p" "/var/run/docker.pid") + #:pid-file "/var/run/docker.pid" + #:log-file "/var/log/docker.log")) + (stop #~(make-kill-destructor))))) + +(define docker-service-type + (service-type (name 'docker) + (description "Provide capability to run Docker application +bundles in Docker containers.") + (extensions + (list + (service-extension activation-service-type + %docker-activation) + (service-extension shepherd-root-service-type + (lambda args + (list (apply containerd-shepherd-service args) + (apply docker-shepherd-service args)))) + (service-extension account-service-type + (const %docker-accounts)))) + (default-value (docker-configuration)))) -- cgit v1.2.3 From 84a2de36a10dc2ab80f86e16721cbd228c85279e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 10 Jan 2019 23:33:36 +0100 Subject: services: Deprecate a few more service procedures. These procedures were already either undocumented (and de facto deprecated) or documented as deprecated or redundant. * gnu/services/base.scm (guix-service, guix-publish-service): Mark as deprecated. * gnu/services/mcron.scm (mcron-service): Likewise. * gnu/services/networking.scm (tor-service): Likewise. * doc/guix.texi (Scheduled Job Execution): Remove 'mcron-service' and adjust example. (Networking Services): Remove 'tor-service'. * gnu/tests/base.scm (%mcron-os): Use 'mcron-service-type' instead of 'mcron-service'. * gnu/tests/networking.scm (%tor-os): Use 'tor-service-type' instead of 'tor-service'. * tests/guix-system.sh: Likewise. --- doc/guix.texi | 25 +++++-------------------- gnu/services/base.scm | 8 ++++++-- gnu/services/mcron.scm | 6 ++++-- gnu/services/networking.scm | 7 ++++--- gnu/system/install.scm | 3 ++- gnu/tests/base.scm | 5 +++-- gnu/tests/networking.scm | 2 +- tests/guix-system.sh | 6 ++++-- 8 files changed, 29 insertions(+), 33 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index c0cc8d4169..ed7723c00b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11684,9 +11684,11 @@ gexps to introduce job definitions that are passed to mcron (operating-system ;; @dots{} - (services (cons (mcron-service (list garbage-collector-job - updatedb-job - idutils-job)) + (services (cons (service mcron-service-type + (mcron-configuration + (jobs (list garbage-collector-job + updatedb-job + idutils-job)))) %base-services))) @end lisp @@ -11709,17 +11711,6 @@ also specify the number of tasks to display: # herd schedule mcron 10 @end example -@deffn {Scheme Procedure} mcron-service @var{jobs} [#:mcron @var{mcron}] -Return an mcron service running @var{mcron} that schedules @var{jobs}, a -list of gexps denoting mcron job specifications. - -This is a shorthand for: -@example -(service mcron-service-type - (mcron-configuration (mcron mcron) (jobs jobs))) -@end example -@end deffn - @defvr {Scheme Variable} mcron-service-type This is the type of the @code{mcron} service, whose value is an @code{mcron-configuration} object. @@ -12313,12 +12304,6 @@ Tor} anonymous networking daemon. The service is configured using a @end defvr -@deffn {Scheme Procedure} tor-service [@var{config-file}] [#:tor @var{tor}] -This procedure is deprecated and will be removed in a future release. Return -a service of the @code{tor-service-type} type. @var{config-file} and -@var{tor} have the same meaning as in @code{}. -@end deffn - @deftp {Data Type} tor-configuration @table @asis @item @code{tor} (default: @code{tor}) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 6e99cbfec4..8395a856fc 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1688,7 +1688,9 @@ failed to register public key '~a': ~a~%" key status))))))) (description "Run the build daemon of GNU@tie{}Guix, aka. @command{guix-daemon}."))) -(define* (guix-service #:optional (config %default-guix-configuration)) +(define-deprecated (guix-service #:optional + (config %default-guix-configuration)) + guix-service-type "Return a service that runs the Guix build daemon according to @var{config}." (service guix-service-type config)) @@ -1789,7 +1791,9 @@ failed to register public key '~a': ~a~%" key status))))))) "Add a Shepherd service running @command{guix publish}, a command that allows you to share pre-built binaries with others over HTTP."))) -(define* (guix-publish-service #:key (guix guix) (port 80) (host "localhost")) +(define-deprecated (guix-publish-service #:key (guix guix) + (port 80) (host "localhost")) + guix-publish-service-type "Return a service that runs @command{guix publish} listening on @var{host} and @var{port} (@pxref{Invoking guix publish}). diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 120b663e3e..e4b652b3d4 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,6 +21,7 @@ #:use-module (gnu services base) #:use-module (gnu services shepherd) #:autoload (gnu packages guile) (mcron) + #:use-module (guix deprecation) #:use-module (guix records) #:use-module (guix gexp) #:use-module (srfi srfi-1) @@ -142,7 +143,8 @@ files." jobs))))) (default-value (mcron-configuration)))) ;empty job list -(define* (mcron-service jobs #:optional (mcron mcron)) +(define-deprecated (mcron-service jobs #:optional (mcron mcron)) + mcron-service-type "Return an mcron service running @var{mcron} that schedules @var{jobs}, a list of gexps denoting mcron job specifications. diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 2f49bf28dd..cab129e0c3 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -755,9 +755,10 @@ HiddenServicePort ~a ~a~%" "Run the @uref{https://torproject.org, Tor} anonymous networking daemon."))) -(define* (tor-service #:optional - (config-file (plain-file "empty" "")) - #:key (tor tor)) +(define-deprecated (tor-service #:optional + (config-file (plain-file "empty" "")) + #:key (tor tor)) + tor-service-type "Return a service to run the @uref{https://torproject.org, Tor} anonymous networking daemon. diff --git a/gnu/system/install.scm b/gnu/system/install.scm index c345ba0626..19a6f6a038 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -253,7 +253,8 @@ You have been warned. Thanks for being so brave.\x1b[0m ;; The build daemon. Register the official server keys as trusted. ;; This allows the installation process to use substitutes by ;; default. - (guix-service (guix-configuration (authorize-key? #t))) + (service guix-service-type + (guix-configuration (authorize-key? #t))) ;; Start udev so that useful device nodes are available. ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index 8d4e218a8f..2b20aac1dc 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2018 Clément Lassieur ;;; ;;; This file is part of GNU Guix. @@ -627,7 +627,8 @@ non-ASCII names from /tmp.") (job3 #~(job next-second-from ;to test $PATH "touch witness-touch"))) (simple-operating-system - (mcron-service (list job1 job2 job3))))) + (service mcron-service-type + (mcron-configuration (jobs (list job1 job2 job3))))))) (define (run-mcron-test name) (define os diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm index 9f12a4ae8d..a97b29bc4b 100644 --- a/gnu/tests/networking.scm +++ b/gnu/tests/networking.scm @@ -351,7 +351,7 @@ subnet 192.168.1.0 netmask 255.255.255.0 { (define %tor-os (simple-operating-system - (tor-service))) + (service tor-service-type))) (define %tor-os/unix-socks-socket (simple-operating-system diff --git a/tests/guix-system.sh b/tests/guix-system.sh index 23d2da4903..adb623d244 100644 --- a/tests/guix-system.sh +++ b/tests/guix-system.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès # Copyright © 2017 Tobias Geerinckx-Rice # Copyright © 2018 Chris Marusich # @@ -258,7 +258,9 @@ cat > "$tmpdir/config.scm"< Date: Wed, 9 Jan 2019 14:17:19 +0100 Subject: guix build: Re-purpose '--verbosity' and add '--debug'. The previous '--verbosity' option was misleading and rarely what users were looking for. The new option provides a consistent way to choose whether or not to display the build log. * guix/scripts/build.scm (show-build-options-help): Remove "--verbosity" and add "--debug". (set-build-options-from-command-line): Use the 'debug key of OPTS for #:verbosity. (%standard-build-options): Change "verbosity" to "debug". Use 'string->number*' instead of 'string->number'. (%default-options): Change 'verbosity to 'debug and add a 'verbosity key. (show-help): Add '--verbosity'. (%options): Likewise, and change '--quiet' to set the 'verbosity key of RESULT. (guix-build): Use 'with-status-verbosity' instead of parameterizing CURRENT-BUILD-OUTPUT-PORT, honor the 'verbosity key of OPTS, and remove 'quiet?'. * guix/scripts/environment.scm (show-help, %options): Add '--verbosity'. (%default-options): Add 'debug'. (guix-environment): Honor the 'verbosity key of OPTS. * guix/scripts/pack.scm (%default-options): Add 'debug. (%options, show-help): Add '--verbosity'. (guix-pack): Honor the 'verbosity key of OPTS. * guix/scripts/package.scm (%default-options): Add 'debug. (show-help, %options): Add '--verbosity'. Mark '--verbose' as deprecated and change it to set 'verbosity. (guix-package): Honor the 'verbosity key of OPTS and remove 'verbose?'. * guix/scripts/pull.scm (%default-options): Add 'debug. (show-help, %options): Add '--verbosity'. (guix-pull): Honor the 'verbosity key of OPTS. * guix/scripts/system.scm (show-help, %options): Add '--verbosity'. (%default-options): Add 'debug. (guix-system): Honor the 'verbosity key of OPTS. * guix/scripts/archive.scm (%default-options): Add 'debug, 'print-build-trace?, 'print-extended-build-trace?, and 'multiplexed-build-output?. (show-help, %options): Add '--verbosity'. (export-from-store): Remove call to 'set-build-options-from-command-line'. (guix-archive): Wrap body in 'with-status-verbosity'. Add call to 'set-build-options-from-command-line. * doc/guix.texi (Common Build Options): Document '--verbosity' and '--debug'. (Additional Build Options): Adjust description of '--quiet'. --- doc/guix.texi | 28 +++++---- guix/scripts/archive.scm | 55 ++++++++++------- guix/scripts/build.scm | 140 ++++++++++++++++++++++--------------------- guix/scripts/environment.scm | 12 +++- guix/scripts/pack.scm | 12 +++- guix/scripts/package.scm | 21 ++++--- guix/scripts/pull.scm | 12 +++- guix/scripts/system.scm | 15 ++++- 8 files changed, 178 insertions(+), 117 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index ed7723c00b..2039ff67cf 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2101,10 +2101,6 @@ By default, @command{guix package} reports as an error @dfn{collisions} in the profile. Collisions happen when two or more different versions or variants of a given package end up in the profile. -@item --verbose -Produce verbose output. In particular, emit the build log of the -environment on the standard error port. - @item --bootstrap Use the bootstrap Guile to build the profile. This option is only useful to distribution developers. @@ -6363,10 +6359,15 @@ Likewise, when the build or substitution process lasts for more than By default, the daemon's setting is honored (@pxref{Invoking guix-daemon, @code{--timeout}}). -@item --verbosity=@var{level} -Use the given verbosity level. @var{level} must be an integer between 0 -and 5; higher means more verbose output. Setting a level of 4 or more -may be helpful when debugging setup issues with the build daemon. +@c Note: This option is actually not part of %standard-build-options but +@c most programs honor it. +@cindex verbosity, of the command-line tools +@cindex build logs, verbosity +@item -v @var{level} +@itemx --verbosity=@var{level} +Use the given verbosity @var{level}, an integer. Choosing 0 means that no +output is produced, 1 is for quiet output, and 2 shows all the build log +output on standard error. @item --cores=@var{n} @itemx -c @var{n} @@ -6379,6 +6380,11 @@ Allow at most @var{n} build jobs in parallel. @xref{Invoking guix-daemon, @code{--max-jobs}}, for details about this option and the equivalent @command{guix-daemon} option. +@item --debug=@var{level} +Produce debugging output coming from the build daemon. @var{level} must be an +integer between 0 and 5; higher means more verbose output. Setting a level of +4 or more may be helpful when debugging setup issues with the build daemon. + @end table Behind the scenes, @command{guix build} is essentially an interface to @@ -6547,9 +6553,9 @@ build}. @item --quiet @itemx -q -Build quietly, without displaying the build log. Upon completion, the -build log is kept in @file{/var} (or similar) and can always be -retrieved using the @option{--log-file} option. +Build quietly, without displaying the build log; this is equivalent to +@code{--verbosity=0}. Upon completion, the build log is kept in @file{/var} +(or similar) and can always be retrieved using the @option{--log-file} option. @item --file=@var{file} @itemx -f @var{file} diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm index fb2f61ce30..950f0f41d8 100644 --- a/guix/scripts/archive.scm +++ b/guix/scripts/archive.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +23,7 @@ #:use-module ((guix build utils) #:select (mkdir-p)) #:use-module ((guix serialization) #:select (restore-file)) #:use-module (guix store) + #:use-module (guix status) #:use-module (guix grafts) #:use-module (guix packages) #:use-module (guix derivations) @@ -55,7 +56,11 @@ (substitutes? . #t) (build-hook? . #t) (graft? . #t) - (verbosity . 0))) + (print-build-trace? . #t) + (print-extended-build-trace? . #t) + (multiplexed-build-output? . #t) + (verbosity . 2) + (debug . 0))) (define (show-help) (display (G_ "Usage: guix archive [OPTION]... PACKAGE... @@ -85,6 +90,8 @@ Export/import one or more packages from/to the store.\n")) -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")) (display (G_ " --target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\"")) + (display (G_ " + -v, --verbosity=LEVEL use the given verbosity LEVEL")) (newline) (show-build-options-help) @@ -161,6 +168,11 @@ Export/import one or more packages from/to the store.\n")) (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) + (option '(#\v "verbosity") #t #f + (lambda (opt name arg result) + (let ((level (string->number* arg))) + (alist-cons 'verbosity level + (alist-delete 'verbosity result))))) (option '(#\n "dry-run") #f #f (lambda (opt name arg result) (alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) @@ -239,7 +251,6 @@ build and a list of store files to transfer." resulting archive to the standard output port." (let-values (((drv files) (options->derivations+files store opts))) - (set-build-options-from-command-line store opts) (show-what-to-build store drv #:use-substitutes? (assoc-ref opts 'substitutes?) #:dry-run? (assoc-ref opts 'dry-run?)) @@ -329,21 +340,23 @@ the input port." ((assoc-ref opts 'authorize) (authorize-key)) (else - (with-store store - (cond ((assoc-ref opts 'export) - (export-from-store store opts)) - ((assoc-ref opts 'import) - (import-paths store (current-input-port))) - ((assoc-ref opts 'missing) - (let* ((files (lines (current-input-port))) - (missing (remove (cut valid-path? store <>) - files))) - (format #t "~{~a~%~}" missing))) - ((assoc-ref opts 'extract) - => - (lambda (target) - (restore-file (current-input-port) target))) - (else - (leave - (G_ "either '--export' or '--import' \ -must be specified~%")))))))))))) + (with-status-verbosity (assoc-ref opts 'verbosity) + (with-store store + (set-build-options-from-command-line store opts) + (cond ((assoc-ref opts 'export) + (export-from-store store opts)) + ((assoc-ref opts 'import) + (import-paths store (current-input-port))) + ((assoc-ref opts 'missing) + (let* ((files (lines (current-input-port))) + (missing (remove (cut valid-path? store <>) + files))) + (format #t "~{~a~%~}" missing))) + ((assoc-ref opts 'extract) + => + (lambda (target) + (restore-file (current-input-port) target))) + (else + (leave + (G_ "either '--export' or '--import' \ +must be specified~%"))))))))))))) diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 564bdf0ced..5a158799ae 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -449,14 +449,14 @@ options handled by 'set-build-options-from-command-line', and listed in mark the build as failed after SECONDS of silence")) (display (G_ " --timeout=SECONDS mark the build as failed after SECONDS of activity")) - (display (G_ " - --verbosity=LEVEL use the given verbosity LEVEL")) (display (G_ " --rounds=N build N times in a row to detect non-determinism")) (display (G_ " -c, --cores=N allow the use of up to N CPU cores for the build")) (display (G_ " - -M, --max-jobs=N allow at most N build jobs"))) + -M, --max-jobs=N allow at most N build jobs")) + (display (G_ " + --debug=LEVEL produce debugging output at LEVEL"))) (define (set-build-options-from-command-line store opts) "Given OPTS, an alist as returned by 'args-fold' given @@ -479,7 +479,7 @@ options handled by 'set-build-options-from-command-line', and listed in (assoc-ref opts 'print-extended-build-trace?) #:multiplexed-build-output? (assoc-ref opts 'multiplexed-build-output?) - #:verbosity (assoc-ref opts 'verbosity))) + #:verbosity (assoc-ref opts 'debug))) (define set-build-options-from-command-line* (store-lift set-build-options-from-command-line)) @@ -553,12 +553,12 @@ options handled by 'set-build-options-from-command-line', and listed in (apply values (alist-cons 'timeout (string->number* arg) result) rest))) - (option '("verbosity") #t #f + (option '("debug") #t #f (lambda (opt name arg result . rest) - (let ((level (string->number arg))) + (let ((level (string->number* arg))) (apply values - (alist-cons 'verbosity level - (alist-delete 'verbosity result)) + (alist-cons 'debug level + (alist-delete 'debug result)) rest)))) (option '(#\c "cores") #t #f (lambda (opt name arg result . rest) @@ -590,7 +590,8 @@ options handled by 'set-build-options-from-command-line', and listed in (print-build-trace? . #t) (print-extended-build-trace? . #t) (multiplexed-build-output? . #t) - (verbosity . 0))) + (verbosity . 2) + (debug . 0))) (define (show-help) (display (G_ "Usage: guix build [OPTION]... PACKAGE-OR-DERIVATION... @@ -619,6 +620,8 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n")) -r, --root=FILE make FILE a symlink to the result, and register it as a garbage collector root")) (display (G_ " + -v, --verbosity=LEVEL use the given verbosity LEVEL")) + (display (G_ " -q, --quiet do not show the build log")) (display (G_ " --log-file return the log file names for the given derivations")) @@ -694,9 +697,15 @@ must be one of 'package', 'all', or 'transitive'~%") (option '(#\r "root") #t #f (lambda (opt name arg result) (alist-cons 'gc-root arg result))) + (option '(#\v "verbosity") #t #f + (lambda (opt name arg result) + (let ((level (string->number* arg))) + (alist-cons 'verbosity level + (alist-delete 'verbosity result))))) (option '(#\q "quiet") #f #f (lambda (opt name arg result) - (alist-cons 'quiet? #t result))) + (alist-cons 'verbosity 0 + (alist-delete 'verbosity result)))) (option '("log-file") #f #f (lambda (opt name arg result) (alist-cons 'log-file? #t result))) @@ -819,66 +828,59 @@ needed." (parse-command-line args %options (list %default-options))) - (define quiet? - (assoc-ref opts 'quiet?)) - (with-error-handling ;; Ask for absolute file names so that .drv file names passed from the ;; user to 'read-derivation' are absolute when it returns. (with-fluids ((%file-port-name-canonicalization 'absolute)) - (with-store store - ;; Set the build options before we do anything else. - (set-build-options-from-command-line store opts) - - (parameterize ((current-terminal-columns (terminal-columns)) - (current-build-output-port - (if quiet? - (%make-void-port "w") - (build-event-output-port - (build-status-updater print-build-event))))) - (let* ((mode (assoc-ref opts 'build-mode)) - (drv (options->derivations store opts)) - (urls (map (cut string-append <> "/log") - (if (assoc-ref opts 'substitutes?) - (or (assoc-ref opts 'substitute-urls) - ;; XXX: This does not necessarily match the - ;; daemon's substitute URLs. - %default-substitute-urls) - '()))) - (items (filter-map (match-lambda - (('argument . (? store-path? file)) - file) - (_ #f)) - opts)) - (roots (filter-map (match-lambda - (('gc-root . root) root) - (_ #f)) - opts))) - - (unless (or (assoc-ref opts 'log-file?) - (assoc-ref opts 'derivations-only?)) - (show-what-to-build store drv - #:use-substitutes? - (assoc-ref opts 'substitutes?) - #:dry-run? (assoc-ref opts 'dry-run?) - #:mode mode)) - - (cond ((assoc-ref opts 'log-file?) - (for-each (cut show-build-log store <> urls) - (delete-duplicates - (append (map derivation-file-name drv) - items)))) - ((assoc-ref opts 'derivations-only?) - (format #t "~{~a~%~}" (map derivation-file-name drv)) - (for-each (cut register-root store <> <>) - (map (compose list derivation-file-name) drv) - roots)) - ((not (assoc-ref opts 'dry-run?)) - (and (build-derivations store drv mode) - (for-each show-derivation-outputs drv) - (for-each (cut register-root store <> <>) - (map (lambda (drv) - (map cdr - (derivation->output-paths drv))) - drv) - roots)))))))))) + (with-status-verbosity (assoc-ref opts 'verbosity) + (with-store store + ;; Set the build options before we do anything else. + (set-build-options-from-command-line store opts) + + (parameterize ((current-terminal-columns (terminal-columns))) + (let* ((mode (assoc-ref opts 'build-mode)) + (drv (options->derivations store opts)) + (urls (map (cut string-append <> "/log") + (if (assoc-ref opts 'substitutes?) + (or (assoc-ref opts 'substitute-urls) + ;; XXX: This does not necessarily match the + ;; daemon's substitute URLs. + %default-substitute-urls) + '()))) + (items (filter-map (match-lambda + (('argument . (? store-path? file)) + file) + (_ #f)) + opts)) + (roots (filter-map (match-lambda + (('gc-root . root) root) + (_ #f)) + opts))) + + (unless (or (assoc-ref opts 'log-file?) + (assoc-ref opts 'derivations-only?)) + (show-what-to-build store drv + #:use-substitutes? + (assoc-ref opts 'substitutes?) + #:dry-run? (assoc-ref opts 'dry-run?) + #:mode mode)) + + (cond ((assoc-ref opts 'log-file?) + (for-each (cut show-build-log store <> urls) + (delete-duplicates + (append (map derivation-file-name drv) + items)))) + ((assoc-ref opts 'derivations-only?) + (format #t "~{~a~%~}" (map derivation-file-name drv)) + (for-each (cut register-root store <> <>) + (map (compose list derivation-file-name) drv) + roots)) + ((not (assoc-ref opts 'dry-run?)) + (and (build-derivations store drv mode) + (for-each show-derivation-outputs drv) + (for-each (cut register-root store <> <>) + (map (lambda (drv) + (map cdr + (derivation->output-paths drv))) + drv) + roots))))))))))) diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 9461d04976..116b8dcbce 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -157,6 +157,8 @@ COMMAND or an interactive shell in that environment.\n")) (display (G_ " --expose=SPEC for containers, expose read-only host file system according to SPEC")) + (display (G_ " + -v, --verbosity=LEVEL use the given verbosity LEVEL")) (display (G_ " --bootstrap use bootstrap binaries to build the environment")) (newline) @@ -179,7 +181,8 @@ COMMAND or an interactive shell in that environment.\n")) (print-build-trace? . #t) (print-extended-build-trace? . #t) (multiplexed-build-output? . #t) - (verbosity . 0))) + (debug . 0) + (verbosity . 2))) (define (tag-package-arg opts arg) "Return a two-element list with the form (TAG ARG) that tags ARG with either @@ -260,6 +263,11 @@ COMMAND or an interactive shell in that environment.\n")) (option '(#\r "root") #t #f (lambda (opt name arg result) (alist-cons 'gc-root arg result))) + (option '(#\v "verbosity") #t #f + (lambda (opt name arg result) + (let ((level (string->number* arg))) + (alist-cons 'verbosity level + (alist-delete 'verbosity result))))) (option '("bootstrap") #f #f (lambda (opt name arg result) (alist-cons 'bootstrap? #t result))) @@ -674,7 +682,7 @@ message if any test fails." (leave (G_ "'--user' cannot be used without '--container'~%"))) (with-store store - (with-status-verbosity 1 + (with-status-verbosity (assoc-ref opts 'verbosity) (define manifest (options/resolve-packages store opts)) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index d9e0050159..b19a4ae1b1 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -598,7 +598,8 @@ please email '~a'~%") (print-build-trace? . #t) (print-extended-build-trace? . #t) (multiplexed-build-output? . #t) - (verbosity . 0) + (debug . 0) + (verbosity . 2) (symlinks . ()) (compressor . ,(first %compressors)))) @@ -685,6 +686,11 @@ please email '~a'~%") (alist-cons 'profile-name arg result)) (_ (leave (G_ "~a: unsupported profile name~%") arg))))) + (option '(#\v "verbosity") #t #f + (lambda (opt name arg result) + (let ((level (string->number* arg))) + (alist-cons 'verbosity level + (alist-delete 'verbosity result))))) (option '("bootstrap") #f #f (lambda (opt name arg result) (alist-cons 'bootstrap? #t result))) @@ -722,6 +728,8 @@ Create a bundle of PACKAGE.\n")) (display (G_ " --profile-name=NAME populate /var/guix/profiles/.../NAME")) + (display (G_ " + -v, --verbosity=LEVEL use the given verbosity LEVEL")) (display (G_ " --bootstrap use the bootstrap binaries to build the pack")) (newline) @@ -772,7 +780,7 @@ Create a bundle of PACKAGE.\n")) (with-error-handling (with-store store - (with-status-verbosity 2 + (with-status-verbosity (assoc-ref opts 'verbosity) ;; Set the build options before we do anything else. (set-build-options-from-command-line store opts) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 876787fbe2..7ff6bfd6d8 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -293,7 +293,8 @@ ENTRIES, a list of manifest entries, in the context of PROFILE." (define %default-options ;; Alist of default option values. - `((verbosity . 0) + `((verbosity . 1) + (debug . 0) (graft? . #t) (substitutes? . #t) (build-hook? . #t) @@ -346,7 +347,7 @@ Install, remove, or upgrade packages in a single transaction.\n")) (display (G_ " --bootstrap use the bootstrap Guile to build the profile")) (display (G_ " - --verbose produce verbose output")) + -v, --verbosity=LEVEL use the given verbosity LEVEL")) (newline) (display (G_ " -s, --search=REGEXP search in synopsis and description using REGEXP")) @@ -472,13 +473,21 @@ kind of search path~%") (values (alist-cons 'dry-run? #t (alist-cons 'graft? #f result)) #f))) + (option '(#\v "verbosity") #t #f + (lambda (opt name arg result arg-handler) + (let ((level (string->number* arg))) + (values (alist-cons 'verbosity level + (alist-delete 'verbosity result)) + #f)))) (option '("bootstrap") #f #f (lambda (opt name arg result arg-handler) (values (alist-cons 'bootstrap? #t result) #f))) - (option '("verbose") #f #f + (option '("verbose") #f #f ;deprecated (lambda (opt name arg result arg-handler) - (values (alist-cons 'verbose? #t result) + (values (alist-cons 'verbosity 2 + (alist-delete 'verbosity + result)) #f))) (option '("allow-collisions") #f #f (lambda (opt name arg result arg-handler) @@ -907,14 +916,12 @@ processed, #f otherwise." (define opts (parse-command-line args %options (list %default-options #f) #:argument-handler handle-argument)) - (define verbose? - (assoc-ref opts 'verbose?)) (with-error-handling (or (process-query opts) (parameterize ((%store (open-connection)) (%graft? (assoc-ref opts 'graft?))) - (with-status-verbosity 1 + (with-status-verbosity (assoc-ref opts 'verbosity) (set-build-options-from-command-line (%store) opts) (parameterize ((%guile-for-build (package-derivation diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 6389d5ec09..6d1914f7c2 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -66,7 +66,8 @@ (print-extended-build-trace? . #t) (multiplexed-build-output? . #t) (graft? . #t) - (verbosity . 0))) + (debug . 0) + (verbosity . 2))) (define (show-help) (display (G_ "Usage: guix pull [OPTION]... @@ -89,6 +90,8 @@ Download and deploy the latest version of Guix.\n")) (display (G_ " -n, --dry-run show what would be pulled and built")) (display (G_ " + -v, --verbosity=LEVEL use the given verbosity LEVEL")) + (display (G_ " -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")) (display (G_ " --bootstrap use the bootstrap Guile to build the new Guix")) @@ -135,6 +138,11 @@ Download and deploy the latest version of Guix.\n")) (option '(#\n "dry-run") #f #f (lambda (opt name arg result) (alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) + (option '(#\v "verbosity") #t #f + (lambda (opt name arg result) + (let ((level (string->number* arg))) + (alist-cons 'verbosity level + (alist-delete 'verbosity result))))) (option '("bootstrap") #f #f (lambda (opt name arg result) (alist-cons 'bootstrap? #t result))) @@ -510,7 +518,7 @@ Use '~/.config/guix/channels.scm' instead.")) (process-query opts profile)) (else (with-store store - (with-status-verbosity 2 + (with-status-verbosity (assoc-ref opts 'verbosity) (parameterize ((%current-system (assoc-ref opts 'system)) (%graft? (assoc-ref opts 'graft?)) (%repository-cache-directory cache)) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 9e31baaddb..569b826acd 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -1015,6 +1015,8 @@ Some ACTIONS support additional ARGS.\n")) --full-boot for 'vm', make a full boot sequence")) (display (G_ " --skip-checks skip file system and initrd module safety checks")) + (display (G_ " + -v, --verbosity=LEVEL use the given verbosity LEVEL")) (newline) (display (G_ " -h, --help display this help and exit")) @@ -1074,6 +1076,11 @@ Some ACTIONS support additional ARGS.\n")) (option '(#\n "dry-run") #f #f (lambda (opt name arg result) (alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) + (option '(#\v "verbosity") #t #f + (lambda (opt name arg result) + (let ((level (string->number* arg))) + (alist-cons 'verbosity level + (alist-delete 'verbosity result))))) (option '(#\s "system") #t #f (lambda (opt name arg result) (alist-cons 'system arg @@ -1092,7 +1099,8 @@ Some ACTIONS support additional ARGS.\n")) (print-extended-build-trace? . #t) (multiplexed-build-output? . #t) (graft? . #t) - (verbosity . 0) + (debug . 0) + (verbosity . #f) ;default (file-system-type . "ext4") (image-size . guess) (install-bootloader? . #t))) @@ -1267,8 +1275,9 @@ argument list and OPTS is the option alist." (args (option-arguments opts)) (command (assoc-ref opts 'action))) (parameterize ((%graft? (assoc-ref opts 'graft?))) - (with-status-verbosity (if (memq command '(init reconfigure)) - 1 2) + (with-status-verbosity (or (assoc-ref opts 'verbosity) + (if (memq command '(init reconfigure)) + 1 2)) (process-command command args opts)))))) ;;; Local Variables: -- cgit v1.2.3