From 2a4fdb41941ffcc5611a8d6df3ea04a29561aa80 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 10 Jan 2021 21:28:31 +0100 Subject: services: cups: Add brlaser extension by default. * gnu/services/cups.scm (cups-configuration): Add brlaser to the default extensions. * doc/guix.texi (Printing Services): Document it. --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 884224fce6..a0bcb7f01b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17738,7 +17738,7 @@ Available @code{cups-configuration} fields are: The CUPS package. @end deftypevr -@deftypevr {@code{cups-configuration} parameter} package-list extensions (default: @code{(list epson-inkjet-printer-escpr hplip-minimal foomatic-filters splix)}) +@deftypevr {@code{cups-configuration} parameter} package-list extensions (default: @code{(list brlaser epson-inkjet-printer-escpr foomatic-filters hplip-minimal splix)}) Drivers and other extensions to the CUPS package. @end deftypevr -- cgit 1.4.1 From f45ccea4877183ef1e7c07a9c77e1b82a6b75d08 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 10 Jan 2021 21:28:56 +0100 Subject: doc: Add missing cups-filters default extension. * doc/guix.texi (Printing Services): Add cups-filters to the documented list of default cups-configuration extensions. --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index a0bcb7f01b..b3447a169f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17738,7 +17738,7 @@ Available @code{cups-configuration} fields are: The CUPS package. @end deftypevr -@deftypevr {@code{cups-configuration} parameter} package-list extensions (default: @code{(list brlaser epson-inkjet-printer-escpr foomatic-filters hplip-minimal splix)}) +@deftypevr {@code{cups-configuration} parameter} package-list extensions (default: @code{(list brlaser cups-filters epson-inkjet-printer-escpr foomatic-filters hplip-minimal splix)}) Drivers and other extensions to the CUPS package. @end deftypevr -- cgit 1.4.1 From c0255739fced47fa4f8d0dcd7e1a0355b4e334a1 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 12 Jan 2021 10:48:39 +0100 Subject: doc: Use two spaces after full stop. * doc/guix.texi: (GNU Distribution): (Invoking guix-daemon): (Invoking guix pull): (Invoking guix time-machine): (Specifying Additional Channels): (Build Systems): (Invoking guix refresh): (Invoking guix processes): (Mapped Devices): (Base Services): (Networking Services): (Mail Services): (Telephony Services): (Monitoring Services): (Web Services): (DNS Services): (Continuous Integration): (Audio Services): (Virtualization Services): (Version Control Services): (Guix Services): (Miscellaneous Services): (Initial RAM Disk): (Bootloader Configuration): (Invoking guix deploy): Use two spaces after full stop, as required by Texinfo syntax. --- doc/guix.texi | 168 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 85 insertions(+), 83 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index b3447a169f..2da2838b45 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -107,7 +107,7 @@ Documentation License''. @dircategory Software development @direntry -* guix environment: (guix)Invoking guix environment. Building development environments with Guix. +* guix environment: (guix)Invoking guix environment. Building development environments with Guix. * guix build: (guix)Invoking guix build. Building packages. * guix pack: (guix)Invoking guix pack. Creating binary bundles. @end direntry @@ -518,7 +518,7 @@ way for you to give it a try is by setting up an instance of little-endian 64-bit MIPS processors, specifically the Loongson series, n32 ABI, and Linux-Libre kernel. This configuration is no longer fully supported; in particular, there is no ongoing work to ensure that this -architecture still works. Should someone decide they wish to revive this +architecture still works. Should someone decide they wish to revive this architecture then the code is still available. @end table @@ -1589,7 +1589,7 @@ them with Bzip2 by default. Whether to discover substitute servers on the local network using mDNS and DNS-SD. -This feature is still experimental. However, here are a few +This feature is still experimental. However, here are a few considerations. @enumerate @@ -4263,7 +4263,7 @@ Generation 3 Jun 13 2018 23:31:07 (current) describe the current status of Guix. This @code{~/.config/guix/current} profile works exactly like the profiles -created by @command{guix package} (@pxref{Invoking guix package}). That +created by @command{guix package} (@pxref{Invoking guix package}). That is, you can list generations, roll back to the previous generation---i.e., the previous Guix---and so on: @@ -4460,7 +4460,7 @@ Scheme code that evaluates to a list of channel objects. @end table As for @command{guix pull}, the absence of any options means that the -latest commit on the master branch will be used. The command +latest commit on the master branch will be used. The command @example guix time-machine -- build hello @@ -4924,7 +4924,7 @@ updates. @cindex extending the package collection (channels) @cindex variant packages (channels) -You can specify @emph{additional channels} to pull from. To use a channel, write +You can specify @emph{additional channels} to pull from. To use a channel, write @code{~/.config/guix/channels.scm} to instruct @command{guix pull} to pull from it @emph{in addition} to the default Guix channel(s): @@ -7244,9 +7244,9 @@ specify the source sub-directory, defaulting to ``src''. The @code{#:main-class} parameter can be used with the minimal ant buildfile to specify the main class of the resulting jar. This makes the jar file executable. The @code{#:test-include} parameter can be used to -specify the list of junit tests to run. It defaults to +specify the list of junit tests to run. It defaults to @code{(list "**/*Test.java")}. The @code{#:test-exclude} can be used to -disable some tests. It defaults to @code{(list "**/Abstract*.java")}, +disable some tests. It defaults to @code{(list "**/Abstract*.java")}, because abstract classes cannot be run as tests. The parameter @code{#:build-target} can be used to specify the Ant task @@ -7280,7 +7280,7 @@ the libraries and header files are assumed to be host tools. These variables, exported by @code{(guix build-system asdf)}, implement build procedures for Common Lisp packages using -@url{https://common-lisp.net/project/asdf/, ``ASDF''}. ASDF is a system +@url{https://common-lisp.net/project/asdf/, ``ASDF''}. ASDF is a system definition facility for Common Lisp programs and libraries. The @code{asdf-build-system/source} system installs the packages in @@ -7620,13 +7620,13 @@ Julia packages require the source @code{file-name} to be the real name of the package, correctly capitalized. For packages requiring shared library dependencies, you may need to write the -@file{/deps/deps.jl} file manually. It's usually a line of @code{const +@file{/deps/deps.jl} file manually. It's usually a line of @code{const variable = /gnu/store/library.so} for each dependency, plus a void function @code{check_deps() = nothing}. Some older packages that aren't using @file{Package.toml} yet, will require -this file to be created, too. The function @code{julia-create-package-toml} -helps creating the file. You need to pass the outputs and the source of the +this file to be created, too. The function @code{julia-create-package-toml} +helps creating the file. You need to pass the outputs and the source of the package, it's name (the same as the @code{file-name} parameter), the package uuid, the package version, and a list of dependencies specified by their name and their uuid. @@ -7823,7 +7823,7 @@ run after installation using the R function @defvr {Scheme Variable} rakudo-build-system This variable is exported by @code{(guix build-system rakudo)}. It implements the build procedure used by @uref{https://rakudo.org/, -Rakudo} for @uref{https://perl6.org/, Perl6} packages. It installs the +Rakudo} for @uref{https://perl6.org/, Perl6} packages. It installs the package to @code{/gnu/store/@dots{}/NAME-VERSION/share/perl6} and installs the binaries, library files and the resources, as well as wrap the files under the @code{bin/} directory. Tests can be skipped by @@ -11465,7 +11465,7 @@ inconvenient. @item --manifest=@var{file} @itemx -m @var{file} -Select all the packages from the manifest in @var{file}. This is useful to +Select all the packages from the manifest in @var{file}. This is useful to check if any packages of the user manifest can be updated. @item --type=@var{updater} @@ -12996,7 +12996,7 @@ Produce output in the specified @var{format}, one of: @table @code @item recutils -The default option. It outputs a set of Session recutils records +The default option. It outputs a set of Session recutils records that include each @code{ChildProcess} as a field. @item normalized @@ -13919,7 +13919,7 @@ the system boots up. @item source This is either a string specifying the name of the block device to be mapped, such as @code{"/dev/sda3"}, or a list of such strings when several devices -need to be assembled for creating a new one. In case of LVM this is a +need to be assembled for creating a new one. In case of LVM this is a string specifying name of the volume group to be mapped. @item target @@ -13934,7 +13934,7 @@ be specified as @code{"VGNAME-LVNAME"}. @item targets This list of strings specifies names of the resulting mapped devices in case -there are several. The format is identical to @var{target}. +there are several. The format is identical to @var{target}. @item type This must be a @code{mapped-device-kind} object, which specifies how @@ -14811,7 +14811,7 @@ Shadow tool suite. @item @code{local-line} (default: @code{#f}) Control the CLOCAL line flag. This accepts one of three symbols as -arguments, @code{'auto}, @code{'always}, or @code{'never}. If @code{#f}, +arguments, @code{'auto}, @code{'always}, or @code{'never}. If @code{#f}, the default value chosen by agetty is @code{'auto}. @item @code{extract-baud?} (default: @code{#f}) @@ -14926,7 +14926,7 @@ implements virtual console log-in. The name of the console this Kmscon runs on---e.g., @code{"tty1"}. @item @code{login-program} (default: @code{#~(string-append #$shadow "/bin/login")}) -A gexp denoting the name of the log-in program. The default log-in program is +A gexp denoting the name of the log-in program. The default log-in program is @command{login} from the Shadow tool suite. @item @code{login-arguments} (default: @code{'("-p")}) @@ -15829,7 +15829,7 @@ and @command{wicd-curses} user interfaces. @defvr {Scheme Variable} modem-manager-service-type This is the service type for the @uref{https://wiki.gnome.org/Projects/ModemManager, ModemManager} -service. The value for this service type is a +service. The value for this service type is a @code{modem-manager-configuration} record. This service is part of @code{%desktop-services} (@pxref{Desktop @@ -15851,8 +15851,9 @@ The ModemManager package to use. @defvr {Scheme Variable} usb-modeswitch-service-type This is the service type for the -@uref{https://www.draisberghof.de/usb_modeswitch/, USB_ModeSwitch} service. The -value for this service type is a @code{usb-modeswitch-configuration} record. +@uref{https://www.draisberghof.de/usb_modeswitch/, USB_ModeSwitch} +service. The value for this service type is +a @code{usb-modeswitch-configuration} record. When plugged in, some USB modems (and other USB devices) initially present themselves as a read-only storage medium and not as a modem. They need to be @@ -16197,7 +16198,7 @@ The data type representing the configuration of a NTP server. @table @asis @item @code{type} (default: @code{'server}) -The type of the NTP server, given as a symbol. One of @code{'pool}, +The type of the NTP server, given as a symbol. One of @code{'pool}, @code{'server}, @code{'peer}, @code{'broadcast} or @code{'manycastclient}. @item @code{address} @@ -16205,7 +16206,7 @@ The address of the server, as a string. @item @code{options} NTPD options to use with that specific server, given as a list of option names -and/or of option names and values tuples. The following example define a server +and/or of option names and values tuples. The following example define a server to use with the options @option{iburst} and @option{prefer}, as well as @option{version} 3 and a @option{maxpoll} time of 16 seconds. @@ -17052,7 +17053,7 @@ Connect to the named PageKite frontend server instead of the @uref{https://pagekite.net,,pagekite.net} service. @item @code{kites} (default: @code{'("http:@@kitename:localhost:80:@@kitesecret")}) -List of service kites to use. Exposes HTTP on port 80 by default. The format +List of service kites to use. Exposes HTTP on port 80 by default. The format is @code{proto:kitename:host:port:secret}. @item @code{extra-file} (default: @code{#f}) @@ -19724,7 +19725,7 @@ Defaults to @samp{"private"}. @end deftypevr @deftypevr {@code{namespace-configuration} parameter} string separator -Hierarchy separator to use. You should use the same separator for +Hierarchy separator to use. You should use the same separator for all namespaces or some clients get confused. @samp{/} is usually a good one. The default however depends on the underlying mail storage format. @@ -19733,7 +19734,7 @@ Defaults to @samp{""}. @deftypevr {@code{namespace-configuration} parameter} string prefix Prefix required to access this namespace. This needs to be -different for all namespaces. For example @samp{Public/}. +different for all namespaces. For example @samp{Public/}. Defaults to @samp{""}. @end deftypevr @@ -19751,7 +19752,7 @@ Defaults to @samp{#f}. @deftypevr {@code{namespace-configuration} parameter} boolean hidden? If namespace is hidden, it's not advertised to clients via NAMESPACE -extension. You'll most likely also want to set @samp{list? #f}. This is mostly +extension. You'll most likely also want to set @samp{list? #f}. This is mostly useful when converting from another server with different namespaces which you want to deprecate but still keep working. For example you can create hidden namespaces with prefixes @samp{~/mail/}, @samp{~%u/mail/} @@ -19760,7 +19761,7 @@ Defaults to @samp{#f}. @end deftypevr @deftypevr {@code{namespace-configuration} parameter} boolean list? -Show the mailboxes under this namespace with the LIST command. This +Show the mailboxes under this namespace with the LIST command. This makes the namespace visible for clients that do not support the NAMESPACE extension. The special @code{children} value lists child mailboxes, but hides the namespace prefix. @@ -20861,9 +20862,9 @@ Data type representing the configuration of exim. Package object of the Exim server. @item @code{config-file} (default: @code{#f}) -File-like object of the Exim configuration file to use. If its value is +File-like object of the Exim configuration file to use. If its value is @code{#f} then use the default configuration file from the package -provided in @code{package}. The resulting configuration file is loaded +provided in @code{package}. The resulting configuration file is loaded after setting the @code{exim_user} and @code{exim_group} configuration variables. @@ -21179,11 +21180,11 @@ specifying how to deliver mail to users on this system. The configuration for a @code{mail-aliases-service-type} service is an association list denoting how to deliver mail that comes to this -system. Each entry is of the form @code{(alias addresses ...)}, with +system. Each entry is of the form @code{(alias addresses ...)}, with @code{alias} specifying the local alias and @code{addresses} specifying where to deliver this user's mail. -The aliases aren't required to exist as users on the local system. In +The aliases aren't required to exist as users on the local system. In the above example, there doesn't need to be a @code{postmaster} entry in the @code{operating-system}'s @code{user-accounts} in order to deliver the @code{postmaster} mail to @code{bob} (which subsequently would @@ -21848,7 +21849,7 @@ Maximum size in bytes that a user can send in one image message. @item @code{cert-required?} (default: @code{#f}) If it is set to @code{#t} clients that use weak password authentication -will not be accepted. Users must have completed the certificate wizard to join. +will not be accepted. Users must have completed the certificate wizard to join. @item @code{remember-channel?} (default: @code{#f}) Should murmur remember the last channel each user was in when they disconnected @@ -21859,7 +21860,7 @@ Should html be allowed in text messages, user comments, and channel descriptions @item @code{allow-ping?} (default: @code{#f}) Setting to true exposes the current user count, the maximum user count, and -the server's maximum bandwidth per client to unauthenticated users. In the +the server's maximum bandwidth per client to unauthenticated users. In the Mumble client, this information is shown in the Connect dialog. Disabling this setting will prevent public listing of the server. @@ -21933,11 +21934,11 @@ Configuration for public registration of a murmur service. @table @asis @item @code{name} -This is a display name for your server. Not to be confused with the hostname. +This is a display name for your server. Not to be confused with the hostname. @item @code{password} A password to identify your registration. -Subsequent updates will need the same password. Don't lose your password. +Subsequent updates will need the same password. Don't lose your password. @item @code{url} This should be a @code{http://} or @code{https://} link to your web @@ -21984,7 +21985,7 @@ This type has the following parameters: @table @asis @item @code{config-file} (default: @code{(tailon-configuration-file)}) -The configuration file to use for Tailon. This can be set to a +The configuration file to use for Tailon. This can be set to a @dfn{tailon-configuration-file} record value, or any gexp (@pxref{G-Expressions}). @@ -22009,7 +22010,7 @@ This type has the following parameters: @table @asis @item @code{files} (default: @code{(list "/var/log")}) -List of files to display. The list can include strings for a single file +List of files to display. The list can include strings for a single file or directory, or a list, where the first item is the name of a subsection, and the remaining items are the files or directories in that subsection. @@ -22030,24 +22031,24 @@ Allow tailing of not-yet existent files. Number of lines to read initially from each file. @item @code{allowed-commands} (default: @code{(list "tail" "grep" "awk")}) -Commands to allow running. By default, @code{sed} is disabled. +Commands to allow running. By default, @code{sed} is disabled. @item @code{debug?} (default: @code{#f}) Set @code{debug?} to @code{#t} to show debug messages. @item @code{wrap-lines} (default: @code{#t}) -Initial line wrapping state in the web interface. Set to @code{#t} to +Initial line wrapping state in the web interface. Set to @code{#t} to initially wrap lines (the default), or to @code{#f} to initially not wrap lines. @item @code{http-auth} (default: @code{#f}) -HTTP authentication type to use. Set to @code{#f} to disable -authentication (the default). Supported values are @code{"digest"} or +HTTP authentication type to use. Set to @code{#f} to disable +authentication (the default). Supported values are @code{"digest"} or @code{"basic"}. @item @code{users} (default: @code{#f}) If HTTP authentication is enabled (see @code{http-auth}), access will be -restricted to the credentials provided here. To configure users, use a +restricted to the credentials provided here. To configure users, use a list of pairs, where the first element of the pair is the username, and the 2nd element of the pair is the password. @@ -23123,9 +23124,9 @@ The httpd package to use. The pid file used by the shepherd-service. @item @code{config} (default: @code{(httpd-config-file)}) -The configuration file to use with the httpd service. The default value +The configuration file to use with the httpd service. The default value is a @code{httpd-config-file} record, but this can also be a different -G-expression that generates a file, for example a @code{plain-file}. A +G-expression that generates a file, for example a @code{plain-file}. A file outside of the store can also be specified through a string. @end table @@ -23139,7 +23140,7 @@ This data type represents a module for the httpd service. The name of the module. @item @code{file} -The file for the module. This can be relative to the httpd package being +The file for the module. This can be relative to the httpd package being used, the absolute location of a file, or a G-expression for a file within the store, for example @code{(file-append mod-wsgi "/modules/mod_wsgi.so")}. @@ -23156,7 +23157,7 @@ This data type represents a configuration file for the httpd service. @table @asis @item @code{modules} (default: @code{%default-httpd-modules}) -The modules to load. Additional modules can be added here, or loaded by +The modules to load. Additional modules can be added here, or loaded by additional configuration. For example, in order to handle requests for PHP files, you can use Apache’s @@ -23187,7 +23188,7 @@ For example, in order to handle requests for PHP files, you can use Apache’s @item @code{server-root} (default: @code{httpd}) The @code{ServerRoot} in the configuration file, defaults to the httpd -package. Directives including @code{Include} and @code{LoadModule} are +package. Directives including @code{Include} and @code{LoadModule} are taken as relative to the server root. @item @code{server-name} (default: @code{#f}) @@ -23196,7 +23197,7 @@ request scheme, hostname and port that the server uses to identify itself. This doesn't need to be set in the server config, and can be specified -in virtual hosts. The default is @code{#f} to not specify a +in virtual hosts. The default is @code{#f} to not specify a @code{ServerName}. @item @code{document-root} (default: @code{"/srv/http"}) @@ -23204,12 +23205,12 @@ The @code{DocumentRoot} from which files will be served. @item @code{listen} (default: @code{'("80")}) The list of values for the @code{Listen} directives in the config -file. The value should be a list of strings, when each string can +file. The value should be a list of strings, when each string can specify the port number to listen on, and optionally the IP address and protocol to use. @item @code{pid-file} (default: @code{"/var/run/httpd"}) -The @code{PidFile} to use. This should match the @code{pid-file} set in +The @code{PidFile} to use. This should match the @code{pid-file} set in the @code{httpd-configuration} so that the Shepherd service is configured correctly. @@ -23297,7 +23298,7 @@ configuration. In our case, startup error messages can be found in with the @var{log-directory} configuration option. @deffn {Data Type} nginx-configuration -This data type represents the configuration for NGinx. Some +This data type represents the configuration for NGinx. Some configuration can be done through this and the other provided record types, or alternatively, a config file can be provided. @@ -23511,7 +23512,7 @@ URI which this location block matches. @anchor{nginx-location-configuration body} @item @code{body} -Body of the location block, specified as a list of strings. This can contain +Body of the location block, specified as a list of strings. This can contain many configuration directives. For example, to pass requests to a upstream server group defined using an @code{nginx-upstream-configuration} block, @@ -23677,8 +23678,8 @@ The domain to use for Patchwork, this is used in the HTTPD service virtual host. @item @code{settings-module} -The settings module to use for Patchwork. As a Django application, Patchwork -is configured with a Python module containing the settings. This can either be +The settings module to use for Patchwork. As a Django application, Patchwork +is configured with a Python module containing the settings. This can either be an instance of the @code{} record, any other record that represents the settings in the store, or a directory outside of the store. @@ -23688,7 +23689,7 @@ The path under which the HTTPD service should serve the static files. @item @code{getmail-retriever-config} The getmail-retriever-configuration record value to use with -Patchwork. Getmail will be configured with this value, the messages will be +Patchwork. Getmail will be configured with this value, the messages will be delivered to Patchwork. @end table @@ -23715,7 +23716,7 @@ value by the patchwork-setup shepherd service. This setting relates to Django. @item @code{allowed-hosts} -A list of valid hosts for this Patchwork service. This should at least include +A list of valid hosts for this Patchwork service. This should at least include the domain specified in the @code{} record. This is a Django setting. @@ -23726,7 +23727,7 @@ The email address from which Patchwork should send email by default. This is a Patchwork setting. @item @code{static-url} (default: @code{#f}) -The URL to use when serving static assets. It can be part of a URL, or a full +The URL to use when serving static assets. It can be part of a URL, or a full URL, but must end in a @code{/}. If the default value is used, the @code{static-path} value from the @@ -24426,7 +24427,7 @@ This type has the following parameters: @table @asis @item @code{id} (default: @code{""}) -An identifier for other configuration fields to refer to this key. IDs must +An identifier for other configuration fields to refer to this key. IDs must be unique and must not be empty. @item @code{algorithm} (default: @code{#f}) @@ -24446,7 +24447,7 @@ This type has the following parameters: @table @asis @item @code{id} (default: @code{""}) -An identifier for other configuration fields to refer to this key. IDs must be +An identifier for other configuration fields to refer to this key. IDs must be unique and must not be empty. @item @code{address} (default: @code{'()}) @@ -24561,7 +24562,7 @@ This type has the following parameters: @table @asis @item @code{id} (default: @code{""}) -An identifier for other configuration fields to refer to this remote. IDs must +An identifier for other configuration fields to refer to this remote. IDs must be unique and must not be empty. @item @code{address} (default: @code{'()}) @@ -24971,8 +24972,8 @@ If set, fixes the dynamical ports (one per client) to the given range @item @code{tftp-root} (default: @code{/var/empty,lo}) Look for files to transfer using TFTP relative to the given directory. When this is set, TFTP paths which include ".." are rejected, to stop clients -getting outside the specified root. Absolute paths (starting with /) are -allowed, but they must be within the tftp-root. If the optional interface +getting outside the specified root. Absolute paths (starting with /) are +allowed, but they must be within the tftp-root. If the optional interface argument is given, the directory is only used for TFTP requests via that interface. @@ -24984,7 +24985,7 @@ format). For instance, if --tftp-root is "/tftp" and client 1.2.3.4 requests file "myfile" then the effective path will be "/tftp/1.2.3.4/myfile" if -/tftp/1.2.3.4 exists or /tftp/myfile otherwise. When "=mac" is specified +/tftp/1.2.3.4 exists or /tftp/myfile otherwise. When "=mac" is specified it will append the MAC address instead, using lowercase zero padded digits separated by dashes, e.g.: 01-02-03-04-aa-bb Note that resolving MAC addresses is only possible if the client is in the local network or obtained @@ -25754,11 +25755,11 @@ Location of the log file. Location of the log file used by the web interface. @item @code{queries-log-file} (default: @code{#f}) -Location of the SQL queries log file. By default, SQL queries logging is +Location of the SQL queries log file. By default, SQL queries logging is disabled. @item @code{web-queries-log-file} (default: @code{#f}) -Location of the web SQL queries log file. By default, web SQL queries +Location of the web SQL queries log file. By default, web SQL queries logging is disabled. @item @code{cache-directory} (default: @code{"/var/cache/cuirass"}) @@ -26438,7 +26439,7 @@ is only useful for output plugins that can receive tags, for example the @item @code{always-on?} (default: @code{#f}) If set to @code{#t}, then MPD attempts to keep this audio output always -open. This may be useful for streaming servers, when you don’t want to +open. This may be useful for streaming servers, when you don’t want to disconnect all listeners even when playback is accidentally stopped. @item @code{mixer-type} @@ -26482,7 +26483,7 @@ services. @subsubheading Libvirt daemon @code{libvirtd} is the server side daemon component of the libvirt -virtualization management system. This daemon runs on host servers +virtualization management system. This daemon runs on host servers and performs required management tasks for virtualized guests. @deffn {Scheme Variable} libvirt-service-type @@ -27047,9 +27048,9 @@ The virtlogd service is a server side daemon component of libvirt that is used to manage logs from virtual machine consoles. This daemon is not used directly by libvirt client applications, rather it -is called on their behalf by @code{libvirtd}. By maintaining the logs in a +is called on their behalf by @code{libvirtd}. By maintaining the logs in a standalone daemon, the main @code{libvirtd} daemon can be restarted without -risk of losing logs. The @code{virtlogd} daemon has the ability to re-exec() +risk of losing logs. The @code{virtlogd} daemon has the ability to re-exec() itself upon receiving @code{SIGUSR1}, to allow live upgrades without downtime. @deffn {Scheme Variable} virtlog-service-type @@ -29269,12 +29270,12 @@ This controls the permissions Gitolite sets on the repositories and their contents. A value like @code{#o0027} will give read access to the group used by Gitolite -(by default: @code{git}). This is necessary when using Gitolite with software +(by default: @code{git}). This is necessary when using Gitolite with software like cgit or gitweb. @item @code{git-config-keys} (default: @code{""}) -Gitolite allows you to set git config values using the @samp{config} keyword. This -setting allows control over the config keys to accept. +Gitolite allows you to set git config values using the @samp{config} +keyword. This setting allows control over the config keys to accept. @item @code{roles} (default: @code{'(("READERS" . 1) ("WRITERS" . ))}) Set the role names allowed to be used by users running the perms command. @@ -29418,8 +29419,8 @@ been thorougly tested. @end quotation The Guix Build Coordinator consists of one @dfn{coordinator}, and one or -more connected @dfn{agent} processes. The coordinator process handles -clients submitting builds, and allocating builds to agents. The agent +more connected @dfn{agent} processes. The coordinator process handles +clients submitting builds, and allocating builds to agents. The agent processes talk to a build daemon to actually perform the builds, then send the results back to the coordinator. @@ -29860,7 +29861,7 @@ An association list specifies kernel parameters and their values. The @code{(gnu services security-token)} module provides the following service to run @command{pcscd}, the PC/SC Smart Card Daemon. @command{pcscd} is the -daemon program for pcsc-lite and the MuscleCard framework. It is a resource +daemon program for pcsc-lite and the MuscleCard framework. It is a resource manager that coordinates communications with smart card readers, smart cards and cryptographic tokens that are connected to the system. @@ -29881,7 +29882,7 @@ The data type representing the configuration of @command{pcscd}. @item @code{pcsc-lite} (default: @code{pcsc-lite}) The pcsc-lite package that provides pcscd. @item @code{usb-drivers} (default: @code{(list ccid)}) -List of packages that provide USB drivers to pcscd. Drivers are expected to be +List of packages that provide USB drivers to pcscd. Drivers are expected to be under @file{pcsc/drivers} in the store directory of the package. @end table @end deftp @@ -30579,7 +30580,7 @@ volatile root file system. The @code{base-initrd} procedure is built from @code{raw-initrd} procedure. Unlike @code{base-initrd}, @code{raw-initrd} doesn't do anything high-level, such as trying to guess which kernel modules and packages should be included -to the initrd. An example use of @code{raw-initrd} is when a user has +to the initrd. An example use of @code{raw-initrd} is when a user has a custom Linux kernel configuration and default kernel modules included by @code{base-initrd} are not available. @@ -30640,7 +30641,8 @@ the root file system specified on the kernel command line via @option{--root}. @var{linux-modules} is a list of kernel modules to be loaded at boot time. @var{mapped-devices} is a list of device mappings to realize before @var{file-systems} are mounted (@pxref{Mapped Devices}). -@var{helper-packages} is a list of packages to be copied in the initrd. It may +@var{helper-packages} is a list of packages to be copied in the initrd. + It may include @code{e2fsck/static} or other packages needed by the initrd to check the root file system. @@ -30722,7 +30724,7 @@ The type of a bootloader configuration declaration. @cindex EFI, bootloader @cindex UEFI, bootloader @cindex BIOS, bootloader -The bootloader to use, as a @code{bootloader} object. For now +The bootloader to use, as a @code{bootloader} object. For now @code{grub-bootloader}, @code{grub-efi-bootloader}, @code{grub-efi-netboot-bootloader}, @code{extlinux-bootloader} and @code{u-boot-bootloader} are supported. @@ -31769,9 +31771,9 @@ machine with an @code{environment} of @code{digital-ocean-environment-type}. @table @asis @item @code{ssh-key} The path to the SSH private key to use to authenticate with the remote -host. In the future, this field may not exist. +host. In the future, this field may not exist. @item @code{tags} -A list of string ``tags'' that uniquely identify the machine. Must be given +A list of string ``tags'' that uniquely identify the machine. Must be given such that no two machines in the deployment have the same set of tags. @item @code{region} A Digital Ocean region slug, such as @code{"nyc3"}. -- cgit 1.4.1 From 2c87a25d0145d074415b8fb64c70665157f9222d Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 12 Jan 2021 10:55:41 +0100 Subject: doc: DNS Services: Fix typography. * doc/guix.texi (DNS Services): Use appropriate Texinfo markup and capitalization. --- doc/guix.texi | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 2da2838b45..d0a1ab7693 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24971,9 +24971,9 @@ If set, fixes the dynamical ports (one per client) to the given range @item @code{tftp-root} (default: @code{/var/empty,lo}) Look for files to transfer using TFTP relative to the given directory. -When this is set, TFTP paths which include ".." are rejected, to stop clients -getting outside the specified root. Absolute paths (starting with /) are -allowed, but they must be within the tftp-root. If the optional interface +When this is set, TFTP paths which include @samp{..} are rejected, to stop clients +getting outside the specified root. Absolute paths (starting with @samp{/}) are +allowed, but they must be within the TFTP-root. If the optional interface argument is given, the directory is only used for TFTP requests via that interface. @@ -24983,13 +24983,14 @@ on the end of the TFTP-root. Only valid if a TFTP root is set and the directory exists. Defaults to adding IP address (in standard dotted-quad format). -For instance, if --tftp-root is "/tftp" and client 1.2.3.4 requests file -"myfile" then the effective path will be "/tftp/1.2.3.4/myfile" if -/tftp/1.2.3.4 exists or /tftp/myfile otherwise. When "=mac" is specified -it will append the MAC address instead, using lowercase zero padded digits -separated by dashes, e.g.: 01-02-03-04-aa-bb Note that resolving MAC -addresses is only possible if the client is in the local network or obtained -a DHCP lease from dnsmasq. +For instance, if @option{--tftp-root} is @samp{/tftp} and client +@samp{1.2.3.4} requests file @file{myfile} then the effective path will +be @file{/tftp/1.2.3.4/myfile} if @file{/tftp/1.2.3.4} exists or +@file{/tftp/myfile} otherwise. When @samp{=mac} is specified it will +append the MAC address instead, using lowercase zero padded digits +separated by dashes, e.g.: @samp{01-02-03-04-aa-bb}. Note that +resolving MAC addresses is only possible if the client is in the local +network or obtained a DHCP lease from dnsmasq. @end table @end deftp -- cgit 1.4.1 From 79ba12a1dbb3e40b623dd0945a277f8720d9780a Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Fri, 1 Jan 2021 13:37:37 +0300 Subject: services: Add syncthing service. * gnu/services/syncthing.scm: New file. * gnu/local.mk: Add this. * doc/guix.texi: Document this. --- doc/guix.texi | 49 +++++++++++++++++++++++++ gnu/local.mk | 3 +- gnu/services/syncthing.scm | 89 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 gnu/services/syncthing.scm (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index d0a1ab7693..c752815975 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16507,6 +16507,55 @@ Group name or group ID that will be used when accessing the module. @end table @end deftp +The @code{(gnu services syncthing)} module provides the following services: +@cindex syncthing + +You might want a syncthing daemon if you have files between two or more +computers and want to sync them in real time, safely protected from +prying eyes. + +@deffn {Scheme Variable} syncthing-service-type +This is the service type for the @uref{https://syncthing.net/, +syncthing} daemon, The value for this service type is a +@command{syncthing-configuration} record as in this example: + +@lisp +(service syncthing-service-type + (syncthing-configuration (user "alice"))) +@end lisp + +See below for details about @code{syncthing-configuration}. + +@deftp {Data Type} syncthing-configuration +Data type representing the configuration for @code{syncthing-service-type}. + +@table @asis +@item @code{syncthing} (default: @var{syncthing}) +@code{syncthing} package to use. + +@item @code{arguments} (default: @var{'()}) +List of command-line arguments passing to @code{syncthing} binary. + +@item @code{logflags} (default: @var{0}) +Sum of loging flags, see +@uref{https://docs.syncthing.net/users/syncthing.html#cmdoption-logflags, Syncthing documentation logflags}. + +@item @code{user} (default: @var{#f}) +The user as which the Syncthing service is to be run. +This assumes that the specified user exists. + +@item @code{group} (default: @var{"users"}) +The group as which the Syncthing service is to be run. +This assumes that the specified group exists. + +@item @code{home} (default: @var{#f}) +Common configuration and data directory. The default configuration +directory is @file{$HOME} of the specified Syncthing @code{user}. + +@end table +@end deftp +@end deffn + Furthermore, @code{(gnu services ssh)} provides the following services. @cindex SSH @cindex SSH server diff --git a/gnu/local.mk b/gnu/local.mk index 65fbbe8dc5..bcf7ee0245 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -17,7 +17,7 @@ # Copyright © 2017, 2020 Mathieu Othacehe # Copyright © 2017, 2018, 2019 Gábor Boskovits # Copyright © 2018 Amirouche Boubekki -# Copyright © 2018, 2019, 2020 Oleg Pykhalov +# Copyright © 2018, 2019, 2020, 2021 Oleg Pykhalov # Copyright © 2018 Stefan Stefanović # Copyright © 2018, 2020 Maxim Cournoyer # Copyright © 2019, 2020 Guillaume Le Vaillant @@ -630,6 +630,7 @@ GNU_SYSTEM_MODULES = \ %D%/services/sddm.scm \ %D%/services/spice.scm \ %D%/services/ssh.scm \ + %D%/services/syncthing.scm \ %D%/services/sysctl.scm \ %D%/services/telephony.scm \ %D%/services/version-control.scm \ diff --git a/gnu/services/syncthing.scm b/gnu/services/syncthing.scm new file mode 100644 index 0000000000..12ebe7c107 --- /dev/null +++ b/gnu/services/syncthing.scm @@ -0,0 +1,89 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Oleg Pykhalov +;;; +;;; 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 syncthing) + #:use-module (gnu packages syncthing) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (guix gexp) + #:use-module (guix records) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:export (syncthing-configuration + syncthing-configuration? + syncthing-service-type)) + +;;; Commentary: +;;; +;;; This module provides a service definition for the syncthing service. +;;; +;;; Code: + +(define-record-type* + syncthing-configuration make-syncthing-configuration + syncthing-configuration? + (syncthing syncthing-configuration-syncthing ; + (default syncthing)) + (arguments syncthing-configuration-arguments ;list of strings + (default '())) + (logflags syncthing-configuration-logflags ;number + (default 0)) + (user syncthing-configuration-user ;string + (default #f)) + (group syncthing-configuration-group ;string + (default "users")) + (home syncthing-configuration-home ;string + (default #f))) + +(define syncthing-shepherd-service + (match-lambda + (($ syncthing arguments logflags user group home) + (list + (shepherd-service + (provision (list (string->symbol (string-append "syncthing-" user)))) + (documentation "Run syncthing.") + (requirement '(loopback)) + (start #~(make-forkexec-constructor + (append (list (string-append #$syncthing "/bin/syncthing") + "-no-browser" + "-no-restart" + (string-append "-logflags=" (number->string #$logflags))) + '#$arguments) + #:user #$user + #:group #$group + #:environment-variables + (append (list (string-append "HOME=" (or #$home (passwd:dir (getpw #$user)))) + "SSL_CERT_DIR=/etc/ssl/certs" + "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt") + (remove (lambda (str) + (or (string-prefix? "HOME=" str) + (string-prefix? "SSL_CERT_DIR=" str) + (string-prefix? "SSL_CERT_FILE=" str))) + (environ))))) + (respawn? #f) + (stop #~(make-kill-destructor))))))) + +(define syncthing-service-type + (service-type (name 'syncthing) + (extensions (list (service-extension shepherd-root-service-type + syncthing-shepherd-service))) + (description + "Run @uref{https://github.com/syncthing/syncthing, Syncthing} +decentralized continuous file system synchronization."))) + +;;; syncthing.scm ends here -- cgit 1.4.1 From 4e511fcfce2c005c615df673836c553f96550b35 Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Fri, 1 Jan 2021 13:02:11 +0300 Subject: services: Add keepalived service. * gnu/services/networking.scm (): New record. (keepalived-shepherd-service): New procedure. (keepalived-service-type): New variable. * doc/guix.texi (Networking Services): Document this. --- doc/guix.texi | 54 ++++++++++++++++++++++++++++++++++++++++++++- gnu/services/networking.scm | 47 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index c752815975..93c980c196 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -55,7 +55,7 @@ Copyright @copyright{} 2017 Andy Wingo@* Copyright @copyright{} 2017, 2018, 2019, 2020 Arun Isaac@* Copyright @copyright{} 2017 nee@* Copyright @copyright{} 2018 Rutger Helling@* -Copyright @copyright{} 2018 Oleg Pykhalov@* +Copyright @copyright{} 2018, 2021 Oleg Pykhalov@* Copyright @copyright{} 2018 Mike Gerwitz@* Copyright @copyright{} 2018 Pierre-Antoine Rouby@* Copyright @copyright{} 2018, 2019 Gábor Boskovits@* @@ -17207,6 +17207,58 @@ address, delete everything except these options: @end table @end deftp +@cindex keepalived +@deffn {Scheme Variable} keepalived-service-type +This is the type for the @uref{https://www.keepalived.org/, Keepalived} +routing software, @command{keepalived}. Its value must be an +@code{keepalived-configuration} record as in this example for master +machine: + +@lisp +(service keepalived-service-type + (keepalived-configuration + (config-file (local-file "keepalived-master.conf")))) +@end lisp + +where @file{keepalived-master.conf}: + +@example +vrrp_instance my-group @{ + state MASTER + interface enp9s0 + virtual_router_id 100 + priority 100 + unicast_peer @{ 10.0.0.2 @} + virtual_ipaddress @{ + 10.0.0.4/24 + @} +@} +@end example + +and for backup machine: + +@lisp +(service keepalived-service-type + (keepalived-configuration + (config-file (local-file "keepalived-backup.conf")))) +@end lisp + +where @file{keepalived-backup.conf}: + +@example +vrrp_instance my-group @{ + state BACKUP + interface enp9s0 + virtual_router_id 100 + priority 99 + unicast_peer @{ 10.0.0.3 @} + virtual_ipaddress @{ + 10.0.0.4/24 + @} +@} +@end example +@end deffn + @node Unattended Upgrades @subsection Unattended Upgrades diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 9ec0f6a9ca..44754781c1 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2019 Sou Bunnbu ;;; Copyright © 2019 Alex Griffin ;;; Copyright © 2020 Brice Waegeneire +;;; Copyright © 2021 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -42,6 +43,7 @@ #:use-module (gnu packages admin) #:use-module (gnu packages base) #:use-module (gnu packages bash) + #:use-module (gnu packages cluster) #:use-module (gnu packages connman) #:use-module (gnu packages freedesktop) #:use-module (gnu packages linux) @@ -192,7 +194,11 @@ yggdrasil-configuration-log-level yggdrasil-configuration-log-to yggdrasil-configuration-json-config - yggdrasil-configuration-package)) + yggdrasil-configuration-package + + keepalived-configuration + keepalived-configuration? + keepalived-service-type)) ;;; Commentary: ;;; @@ -1865,4 +1871,43 @@ See yggdrasil -genconf for config options.") (service-extension profile-service-type (compose list yggdrasil-configuration-package)))))) + +;;; +;;; Keepalived +;;; + +(define-record-type* + keepalived-configuration make-keepalived-configuration + keepalived-configuration? + (keepalived keepalived-configuration-keepalived ; + (default keepalived)) + (config-file keepalived-configuration-config-file ;file-like + (default #f))) + +(define keepalived-shepherd-service + (match-lambda + (($ keepalived config-file) + (list + (shepherd-service + (provision '(keepalived)) + (documentation "Run keepalived.") + (requirement '(loopback)) + (start #~(make-forkexec-constructor + (list (string-append #$keepalived "/sbin/keepalived") + "--dont-fork" "--log-console" "--log-detail" + "--pid=/var/run/keepalived.pid" + (string-append "--use-file=" #$config-file)) + #:pid-file "/var/run/keepalived.pid" + #:log-file "/var/log/keepalived.log")) + (respawn? #f) + (stop #~(make-kill-destructor))))))) + +(define keepalived-service-type + (service-type (name 'keepalived) + (extensions (list (service-extension shepherd-root-service-type + keepalived-shepherd-service))) + (description + "Run @uref{https://www.keepalived.org/, Keepalived} +routing software."))) + ;;; networking.scm ends here -- cgit 1.4.1 From 89dbcac107d931fd33eda4a83db445e8a90cc4af Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Tue, 12 Jan 2021 15:49:41 +0100 Subject: doc: Remove trace of ci.guix.info. * doc/guix.texi (Invoking guix weather): Use default substitute server in example. --- doc/guix.texi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 93c980c196..f38e018dff 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12917,8 +12917,9 @@ updating substitutes from '@value{SUBSTITUTE-URL}'... 100.0% @end example What this example shows is that @code{kcoreaddons} and presumably the 58 -packages that depend on it have no substitutes at @code{ci.guix.info}; -likewise for @code{qgpgme} and the 46 packages that depend on it. +packages that depend on it have no substitutes at +@code{@value{SUBSTITUTE-SERVER}}; likewise for @code{qgpgme} and the 46 +packages that depend on it. If you are a Guix developer, or if you are taking care of this build farm, you'll probably want to have a closer look at these packages: they may simply -- cgit 1.4.1 From d288a4de7df90bcd7288f779883279c1202fbe23 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 27 Dec 2020 12:10:15 +0100 Subject: publish: Add support for zstd compression. * guix/scripts/publish.scm (compress-nar)[write-compressed-file]: New procedure. Use it for 'gzip' and 'lzip'. Add 'zstd. (nar-response-port, string->compression-type): Add case for 'zstd'. * tests/publish.scm (zstd-supported?): New procedure. ("/nar/zstd/*"): New test. * doc/guix.texi (Invoking guix publish): Document zstd compression. (Base Services): Add cross-reference to the above node. --- doc/guix.texi | 22 +++++++++++++++------- guix/scripts/publish.scm | 31 ++++++++++++++++++------------- tests/publish.scm | 16 ++++++++++++++++ 3 files changed, 49 insertions(+), 20 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index f38e018dff..92ea87d6b7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12348,17 +12348,23 @@ server socket is open and the signing key has been read. @item --compression[=@var{method}[:@var{level}]] @itemx -C [@var{method}[:@var{level}]] Compress data using the given @var{method} and @var{level}. @var{method} is -one of @code{lzip} and @code{gzip}; when @var{method} is omitted, @code{gzip} -is used. +one of @code{lzip}, @code{zstd}, and @code{gzip}; when @var{method} is +omitted, @code{gzip} is used. When @var{level} is zero, disable compression. The range 1 to 9 corresponds to different compression levels: 1 is the fastest, and 9 is the best (CPU-intensive). The default is 3. -Usually, @code{lzip} compresses noticeably better than @code{gzip} for a small -increase in CPU usage; see -@uref{https://nongnu.org/lzip/lzip_benchmark.html,benchmarks on the lzip Web -page}. +Usually, @code{lzip} compresses noticeably better than @code{gzip} for a +small increase in CPU usage; see +@uref{https://nongnu.org/lzip/lzip_benchmark.html,benchmarks on the lzip +Web page}. However, @code{lzip} achieves low decompression throughput +(on the order of 50@tie{}MiB/s on modern hardware), which can be a +bottleneck for someone who downloads over a fast network connection. + +The compression ratio of @code{zstd} is between that of @code{lzip} and +that of @code{gzip}; its main advantage is a +@uref{https://facebook.github.io/zstd/,high decompression speed}. Unless @option{--cache} is used, compression occurs on the fly and the compressed streams are not @@ -15400,7 +15406,9 @@ at level 7 and gzip at level 9, write: @end lisp Level 9 achieves the best compression ratio at the expense of increased CPU -usage, whereas level 1 achieves fast compression. +usage, whereas level 1 achieves fast compression. @xref{Invoking guix +publish}, for more information on the available compression methods and +the tradeoffs involved. An empty list disables compression altogether. diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm index 5a865c838d..fa85088ed0 100644 --- a/guix/scripts/publish.scm +++ b/guix/scripts/publish.scm @@ -56,6 +56,8 @@ #:use-module (zlib) #:autoload (lzlib) (call-with-lzip-output-port make-lzip-output-port) + #:autoload (zstd) (call-with-zstd-output-port + make-zstd-output-port) #:use-module (guix cache) #:use-module (guix ui) #:use-module (guix scripts) @@ -588,23 +590,22 @@ requested using POOL." (define nar (nar-cache-file cache item #:compression compression)) + (define (write-compressed-file call-with-compressed-output-port) + ;; Note: the file port gets closed along with the compressed port. + (call-with-compressed-output-port (open-output-file (string-append nar ".tmp")) + (lambda (port) + (write-file item port)) + #:level (compression-level compression)) + (rename-file (string-append nar ".tmp") nar)) + (mkdir-p (dirname nar)) (match (compression-type compression) ('gzip - ;; Note: the file port gets closed along with the gzip port. - (call-with-gzip-output-port (open-output-file (string-append nar ".tmp")) - (lambda (port) - (write-file item port)) - #:level (compression-level compression) - #:buffer-size %default-buffer-size) - (rename-file (string-append nar ".tmp") nar)) + (write-compressed-file call-with-gzip-output-port)) ('lzip - ;; Note: the file port gets closed along with the lzip port. - (call-with-lzip-output-port (open-output-file (string-append nar ".tmp")) - (lambda (port) - (write-file item port)) - #:level (compression-level compression)) - (rename-file (string-append nar ".tmp") nar)) + (write-compressed-file call-with-lzip-output-port)) + ('zstd + (write-compressed-file call-with-zstd-output-port)) ('none ;; Cache nars even when compression is disabled so that we can ;; guarantee the TTL (see .) @@ -871,6 +872,9 @@ example: \"/foo/bar\" yields '(\"foo\" \"bar\")." (($ 'lzip level) (make-lzip-output-port (response-port response) #:level level)) + (($ 'zstd level) + (make-zstd-output-port (response-port response) + #:level level)) (($ 'none) (response-port response)) (#f @@ -953,6 +957,7 @@ blocking." (match string ("gzip" 'gzip) ("lzip" 'lzip) + ("zstd" 'zstd) (_ #f))) (define (effective-compression requested-type compressions) diff --git a/tests/publish.scm b/tests/publish.scm index cafd0f13a2..52101876b5 100644 --- a/tests/publish.scm +++ b/tests/publish.scm @@ -38,6 +38,7 @@ #:use-module ((guix pki) #:select (%public-key-file %private-key-file)) #:use-module (zlib) #:use-module (lzlib) + #:autoload (zstd) (call-with-zstd-input-port) #:use-module (web uri) #:use-module (web client) #:use-module (web response) @@ -54,6 +55,9 @@ (define %store (open-connection-for-tests)) +(define (zstd-supported?) + (resolve-module '(zstd) #t #f #:ensure #f)) + (define %reference (add-text-to-store %store "ref" "foo")) (define %item (add-text-to-store %store "item" "bar" (list %reference))) @@ -237,6 +241,18 @@ References: ~%" (cut restore-file <> temp))) (call-with-input-file temp read-string)))) +(unless (zstd-supported?) (test-skip 1)) +(test-equal "/nar/zstd/*" + "bar" + (call-with-temporary-output-file + (lambda (temp port) + (let ((nar (http-get-port + (publish-uri + (string-append "/nar/zstd/" (basename %item)))))) + (call-with-zstd-input-port nar + (cut restore-file <> temp))) + (call-with-input-file temp read-string)))) + (test-equal "/*.narinfo with compression" `(("StorePath" . ,%item) ("URL" . ,(string-append "nar/gzip/" (basename %item))) -- cgit 1.4.1 From e28d2cdd753f5c224853f3d9ffe63f848709b41a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 27 Dec 2020 12:43:26 +0100 Subject: doc: Mention optional dependency on Guile-zstd. * doc/guix.texi (Requirements): Add Guile-zstd. --- doc/guix.texi | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 92ea87d6b7..cea7f8a8cf 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -851,6 +851,11 @@ Support for build offloading (@pxref{Daemon Offload Setup}) and @uref{https://github.com/artyom-poptsov/guile-ssh, Guile-SSH}, version 0.13.0 or later. +@item +@uref{https://notabug.org/guile-zstd/guile-zstd, Guile-zstd}, for zstd +compression and decompression in @command{guix publish} and for +substitutes (@pxref{Invoking guix publish}). + @item @uref{https://ngyro.com/software/guile-semver.html, Guile-Semver} for the @code{crate} importer (@pxref{Invoking guix import}). -- cgit 1.4.1 From d4f5ea502d2c8358c2cf5fffd96cba0ac233984f Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 7 Jan 2021 21:44:22 +0100 Subject: services: qemu-binfmt: 'guix-support?' defaults to #t. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/virtualization.scm (qemu-binfmt-service-type)[guix-support?]: Change the default from #f to #t. * doc/guix.texi (Transparent Emulation with QEMU): Change the default of ‘guix-support?’ from #f to #t. Describe the implication of setting it to #f. Co-authored-by: Ludovic Courtès --- doc/guix.texi | 6 +++++- gnu/services/virtualization.scm | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index cea7f8a8cf..1234834945 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -27338,7 +27338,7 @@ This is the configuration for the @code{qemu-binfmt} service. The list of emulated QEMU platforms. Each item must be a @dfn{platform object} as returned by @code{lookup-qemu-platforms} (see below). -@item @code{guix-support?} (default: @code{#f}) +@item @code{guix-support?} (default: @code{#t}) When it is true, QEMU and all its dependencies are added to the build environment of @command{guix-daemon} (@pxref{Invoking guix-daemon, @option{--chroot-directory} option}). This allows the @code{binfmt_misc} @@ -27367,6 +27367,10 @@ build}, transparently using QEMU to emulate the ARMv7 CPU. Pretty handy if you'd like to test a package build for an architecture you don't have access to! +When @code{guix-support?} is set to @code{#f}, programs for other +architectures can still be executed transparently, but invoking commands +like @command{guix build -s armhf-linux @dots{}} will fail. + @item @code{qemu} (default: @code{qemu}) The QEMU package to use. @end table diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index f8d413d18e..a45da14a80 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -717,7 +717,7 @@ potential infinite waits blocking libvirt.")) (platforms qemu-binfmt-configuration-platforms (default '())) ;safest default (guix-support? qemu-binfmt-configuration-guix-support? - (default #f))) + (default #t))) (define (qemu-platform->binfmt qemu platform) "Return a gexp that evaluates to a binfmt string for PLATFORM, using the -- cgit 1.4.1 From 181f290aa262eae22819c6234b4065786afb14cf Mon Sep 17 00:00:00 2001 From: Simon South Date: Mon, 11 Jan 2021 12:04:59 -0500 Subject: services: openntpd: Remove support for deprecated "-s" option. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/networking.scm (openntpd-configuration): Remove "allow-large-adjustment?" field. (openntpd-shepherd-service): Remove use of "allow-large-adjustment?" configuration field and "-s" daemon option. * tests/networking.scm (%openntpd-conf-sample): Remove "allow-large-adjustment?" field. * doc/guix.texi (Networking Services)[openntpd-service-type]: Remove "allow-large-adjustment?" field from sample configuration. [openntpd-configuration]: Remove description of "allow-large-adjustment?" field. Signed-off-by: Ludovic Courtès --- doc/guix.texi | 6 +----- gnu/services/networking.scm | 12 +++--------- tests/networking.scm | 3 +-- 3 files changed, 5 insertions(+), 16 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 1234834945..c92f3a5e79 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16246,8 +16246,7 @@ clock synchronized with that of the given servers. (listen-on '("127.0.0.1" "::1")) (sensor '("udcf0 correction 70000")) (constraint-from '("www.gnu.org")) - (constraints-from '("https://www.google.com/")) - (allow-large-adjustment? #t))) + (constraints-from '("https://www.google.com/")))) @end lisp @end deffn @@ -16285,9 +16284,6 @@ a constraint. As with constraint from, specify a list of URLs, IP addresses or hostnames of HTTPS servers to provide a constraint. Should the hostname resolve to multiple IP addresses, @code{ntpd} will calculate a median constraint from all of them. -@item @code{allow-large-adjustment?} (default: @code{#f}) -Determines if @code{ntpd} is allowed to make an initial adjustment of more -than 180 seconds. @end table @end deftp diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index dd4061341e..a4d4ac0646 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -560,9 +560,7 @@ make an initial adjustment of more than 1,000 seconds." (constraint-from openntpd-constraint-from (default '())) (constraints-from openntpd-constraints-from - (default '())) - (allow-large-adjustment? openntpd-allow-large-adjustment? - (default #f))) ; upstream default + (default '()))) (define (openntpd-configuration->string config) @@ -594,8 +592,7 @@ make an initial adjustment of more than 1,000 seconds." "\n"))) ;add a trailing newline (define (openntpd-shepherd-service config) - (let ((openntpd (openntpd-configuration-openntpd config)) - (allow-large-adjustment? (openntpd-allow-large-adjustment? config))) + (let ((openntpd (openntpd-configuration-openntpd config))) (define ntpd.conf (plain-file "ntpd.conf" (openntpd-configuration->string config))) @@ -607,10 +604,7 @@ make an initial adjustment of more than 1,000 seconds." (start #~(make-forkexec-constructor (list (string-append #$openntpd "/sbin/ntpd") "-f" #$ntpd.conf - "-d" ;; don't daemonize - #$@(if allow-large-adjustment? - '("-s") - '())) + "-d") ;; don't daemonize ;; When ntpd is daemonized it repeatedly tries to respawn ;; while running, leading shepherd to disable it. To ;; prevent spamming stderr, redirect output to logfile. diff --git a/tests/networking.scm b/tests/networking.scm index c494a48067..f2421370d2 100644 --- a/tests/networking.scm +++ b/tests/networking.scm @@ -68,8 +68,7 @@ (listen-on '("127.0.0.1" "::1")) (sensor '("udcf0 correction 70000")) (constraint-from '("www.gnu.org")) - (constraints-from '("https://www.google.com/")) - (allow-large-adjustment? #t))) + (constraints-from '("https://www.google.com/")))) (test-assert "openntpd configuration generation sanity check" -- cgit 1.4.1 From 2f497d94e7f6574b0847025ce29eafaf858008ef Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Thu, 3 Dec 2020 11:53:53 +0100 Subject: image: Rename "raw" image-type to "efi-raw". * gnu/system/image.scm (raw-image-type): Rename to "efi-raw-image-type". * guix/scripts/system.scm (%default-options): Adapt accordingly. * doc/guix.texi: Ditto. Signed-off-by: Mathieu Othacehe --- doc/guix.texi | 10 +++++----- gnu/system/image.scm | 6 +++--- guix/scripts/system.scm | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index c92f3a5e79..dc41fe9aea 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -31406,7 +31406,7 @@ the @option{--image-size} option is ignored in the case of @cindex disk-image, creating disk images The @code{disk-image} command can produce various image types. The image type can be selected using the @option{--image-type} option. It -defaults to @code{raw}. When its value is @code{iso9660}, the +defaults to @code{efi-raw}. When its value is @code{iso9660}, the @option{--label} option can be used to specify a volume ID with @code{disk-image}. By default, the root file system of a disk image is mounted non-volatile; the @option{--volatile} option can be provided to @@ -31425,8 +31425,8 @@ qemu-system-x86_64 -enable-kvm -hda /tmp/my-image.qcow2 -m 1000 \ -bios $(guix build ovmf)/share/firmware/ovmf_x64.bin @end example -When using the @code{raw} image type, a raw disk image is produced; it -can be copied as is to a USB stick, for instance. Assuming +When using the @code{efi-raw} image type, a raw disk image is produced; +it can be copied as is to a USB stick, for instance. Assuming @code{/dev/sdc} is the device corresponding to a USB stick, one can copy the image to it using the following command: @@ -31553,8 +31553,8 @@ of the image. @itemx -t @var{type} For the @code{disk-image} action, create an image with given @var{type}. -When this option is omitted, @command{guix system} uses the @code{raw} -image type. +When this option is omitted, @command{guix system} uses the +@code{efi-raw} image type. @cindex ISO-9660 format @cindex CD image format diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 90b9209988..1012fa6158 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -70,7 +70,7 @@ arm64-disk-image image-with-os - raw-image-type + efi-raw-image-type qcow2-image-type iso-image-type uncompressed-iso-image-type @@ -157,9 +157,9 @@ set to the given OS." (inherit base-image) (operating-system os))) -(define raw-image-type +(define efi-raw-image-type (image-type - (name 'raw) + (name 'efi-raw) (constructor (cut image-with-os efi-disk-image <>)))) (define qcow2-image-type diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 51c8cf2f76..eb7137b7a9 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -1143,7 +1143,7 @@ Some ACTIONS support additional ARGS.\n")) (debug . 0) (verbosity . #f) ;default (validate-reconfigure . ,ensure-forward-reconfigure) - (image-type . raw) + (image-type . efi-raw) (image-size . guess) (install-bootloader? . #t) (label . #f) -- cgit 1.4.1 From cb68ae668af2ade4b0777d82f227e5462768e9e5 Mon Sep 17 00:00:00 2001 From: "Joshua C. Randall" Date: Mon, 11 Jan 2021 15:21:48 +0100 Subject: doc: Fix typo. Fixes . * doc/guix.texi (Invoking guix package): Fix typo. Signed-off-by: Mathieu Othacehe --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index dc41fe9aea..0a82219e7a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3082,7 +3082,7 @@ shells get all the right environment variable definitions: @example GUIX_PROFILE="$HOME/.guix-profile" ; \ -source "$HOME/.guix-profile/etc/profile" +source "$GUIX_PROFILE/etc/profile" @end example In a multi-user setup, user profiles are stored in a place registered as -- cgit 1.4.1 From e74baa124592428f05b17562f180469e405037f3 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sun, 17 Jan 2021 11:32:51 +0100 Subject: system: Rename 'disk-image' command 'image'. * guix/scripts/system.scm (system-derivation-for-action): Rename 'disk-image' command 'image'. Warn when using the now deprecated 'disk-image' command. (show-help): Adapt accordingly. (guix-system): Ditto. * tests/guix-system.sh: Ditto. * gnu/system/examples/bare-hurd.tmpl: Ditto. * doc/guix.texi (Building the Installation Image, Building the Installation Image for ARM Boards, Invoking guix pack, Invoking guix system): Adapt documentation. --- doc/guix.texi | 24 ++++++++++++------------ gnu/system/examples/bare-hurd.tmpl | 2 +- guix/scripts/system.scm | 21 ++++++++++++--------- tests/guix-system.sh | 4 ++-- 4 files changed, 27 insertions(+), 24 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 0a82219e7a..f02353d9fa 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2661,7 +2661,7 @@ The installation image described above was built using the @command{guix system} command, specifically: @example -guix system disk-image -t iso9660 gnu/system/install.scm +guix system image -t iso9660 gnu/system/install.scm @end example Have a look at @file{gnu/system/install.scm} in the source tree, @@ -2678,7 +2678,7 @@ If you build a disk image and the bootloader is not available otherwise includes the bootloader, specifically: @example -guix system disk-image --system=armhf-linux -e '((@@ (gnu system install) os-with-u-boot) (@@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")' +guix system image --system=armhf-linux -e '((@@ (gnu system install) os-with-u-boot) (@@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")' @end example @code{A20-OLinuXino-Lime2} is the name of the board. If you specify an invalid @@ -31393,7 +31393,7 @@ size of the image. @cindex System images, creation in various formats @cindex Creating system images in various formats @item vm-image -@itemx disk-image +@itemx image @itemx docker-image Return a virtual machine, disk image, or Docker image of the operating system declared in @var{file} that stands alone. By default, @@ -31403,22 +31403,22 @@ a value. Docker images are built to contain exactly what they need, so the @option{--image-size} option is ignored in the case of @code{docker-image}. -@cindex disk-image, creating disk images -The @code{disk-image} command can produce various image types. The +@cindex image, creating disk images +The @code{image} command can produce various image types. The image type can be selected using the @option{--image-type} option. It defaults to @code{efi-raw}. When its value is @code{iso9660}, the @option{--label} option can be used to specify a volume ID with -@code{disk-image}. By default, the root file system of a disk image is +@code{image}. By default, the root file system of a disk image is mounted non-volatile; the @option{--volatile} option can be provided to -make it volatile instead. When using @code{disk-image}, the bootloader +make it volatile instead. When using @code{image}, the bootloader installed on the generated image is taken from the provided @code{operating-system} definition. The following example demonstrates how to generate an image that uses the @code{grub-efi-bootloader} bootloader and boot it with QEMU: @example -image=$(guix system disk-image --image-type=qcow2 \ - gnu/system/examples/lightweight-desktop.tmpl) +image=$(guix system image --image-type=qcow2 \ + gnu/system/examples/lightweight-desktop.tmpl) cp $image /tmp/my-image.qcow2 chmod +w /tmp/my-image.qcow2 qemu-system-x86_64 -enable-kvm -hda /tmp/my-image.qcow2 -m 1000 \ @@ -31431,7 +31431,7 @@ it can be copied as is to a USB stick, for instance. Assuming the image to it using the following command: @example -# dd if=$(guix system disk-image my-os.scm) of=/dev/sdc status=progress +# dd if=$(guix system image my-os.scm) of=/dev/sdc status=progress @end example The @code{--list-image-types} command lists all the available image @@ -31551,7 +31551,7 @@ of the image. @item --image-type=@var{type} @itemx -t @var{type} -For the @code{disk-image} action, create an image with given @var{type}. +For the @code{image} action, create an image with given @var{type}. When this option is omitted, @command{guix system} uses the @code{efi-raw} image type. @@ -31563,7 +31563,7 @@ When this option is omitted, @command{guix system} uses the for burning on CDs and DVDs. @item --image-size=@var{size} -For the @code{vm-image} and @code{disk-image} actions, create an image +For the @code{vm-image} and @code{image} actions, create an image of the given @var{size}. @var{size} may be a number of bytes, or it may include a unit as a suffix (@pxref{Block size, size specifications,, coreutils, GNU Coreutils}). diff --git a/gnu/system/examples/bare-hurd.tmpl b/gnu/system/examples/bare-hurd.tmpl index e4b795ff27..135ed23cb6 100644 --- a/gnu/system/examples/bare-hurd.tmpl +++ b/gnu/system/examples/bare-hurd.tmpl @@ -5,7 +5,7 @@ ;; To build a disk image for a virtual machine, do ;; -;; ./pre-inst-env guix system disk-image --target=i586-pc-gnu \ +;; ./pre-inst-env guix system image --target=i586-pc-gnu \ ;; gnu/system/examples/bare-hurd.tmpl ;; ;; You may run it like so diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index eb7137b7a9..66225bff35 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -705,9 +705,11 @@ checking this by themselves in their 'check' procedure." image-size (* 70 (expt 2 20))) #:mappings mappings)) - ((disk-image) + ((image disk-image) (let* ((base-image (os->image os #:type image-type)) (base-target (image-target base-image))) + (when (eq? action 'disk-image) + (warning (G_ "'disk-image' is deprecated: use 'image' instead~%"))) (lower-object (system-image (image @@ -779,7 +781,7 @@ and TARGET arguments." "Perform ACTION for OS. INSTALL-BOOTLOADER? specifies whether to install bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the target root directory; IMAGE-SIZE is the size of the image to be built, for -the 'vm-image' and 'disk-image' actions. IMAGE-TYPE is the type of image to +the 'vm-image' and 'image' actions. IMAGE-TYPE is the type of image to be built. When VOLATILE-ROOT? is #t, the root file system is mounted volatile. @@ -968,7 +970,7 @@ Some ACTIONS support additional ARGS.\n")) (display (G_ "\ vm-image build a freestanding virtual machine image\n")) (display (G_ "\ - disk-image build a disk image, suitable for a USB stick\n")) + image build a Guix System image\n")) (display (G_ "\ docker-image build a Docker image\n")) (display (G_ "\ @@ -994,15 +996,15 @@ Some ACTIONS support additional ARGS.\n")) (display (G_ " --list-image-types list available image types")) (display (G_ " - -t, --image-type=TYPE for 'disk-image', produce an image of TYPE")) + -t, --image-type=TYPE for 'image', produce an image of TYPE")) (display (G_ " --image-size=SIZE for 'vm-image', produce an image of SIZE")) (display (G_ " --no-bootloader for 'init', do not install a bootloader")) (display (G_ " - --volatile for 'disk-image', make the root file system volatile")) + --volatile for 'image', make the root file system volatile")) (display (G_ " - --label=LABEL for 'disk-image', label disk image with LABEL")) + --label=LABEL for 'image', label disk image with LABEL")) (display (G_ " --save-provenance save provenance information")) (display (G_ " @@ -1014,7 +1016,7 @@ Some ACTIONS support additional ARGS.\n")) (display (G_ " -N, --network for 'container', allow containers to access the network")) (display (G_ " - -r, --root=FILE for 'vm', 'vm-image', 'disk-image', 'container', + -r, --root=FILE for 'vm', 'vm-image', 'image', 'container', and 'build', make FILE a symlink to the result, and register it as a garbage collector root")) (display (G_ " @@ -1335,7 +1337,7 @@ argument list and OPTS is the option alist." (alist-cons 'argument arg result) (let ((action (string->symbol arg))) (case action - ((build container vm vm-image disk-image reconfigure init + ((build container vm vm-image image disk-image reconfigure init extension-graph shepherd-graph list-generations describe delete-generations roll-back @@ -1368,7 +1370,8 @@ argument list and OPTS is the option alist." (exit 1)) (case action - ((build container vm vm-image disk-image docker-image reconfigure) + ((build container vm vm-image image disk-image docker-image + reconfigure) (unless (or (= count 1) (and expr (= count 0))) (fail))) diff --git a/tests/guix-system.sh b/tests/guix-system.sh index e7e4c17e39..f5ddd1dda3 100644 --- a/tests/guix-system.sh +++ b/tests/guix-system.sh @@ -262,8 +262,8 @@ guix system vm "$tmpfile" -d | grep '\.drv$' drv1="`guix system vm "$tmpfile" -d`" drv2="`guix system vm "$tmpfile" -d`" test "$drv1" = "$drv2" -drv1="`guix system disk-image -t iso9660 "$tmpfile" -d`" -drv2="`guix system disk-image -t iso9660 "$tmpfile" -d`" +drv1="`guix system image -t iso9660 "$tmpfile" -d`" +drv2="`guix system image -t iso9660 "$tmpfile" -d`" test "$drv1" = "$drv2" make_user_config "group-that-does-not-exist" "users" -- cgit 1.4.1 From 9ab817b2a4601b4a6755983590ed7d93ebdc8d09 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 7 Jan 2021 10:00:50 +0100 Subject: transformations: Add '--with-latest'. * guix/upstream.scm (upstream-source-compiler): New procedure. (%updaters): Set! it. * guix/transformations.scm (transform-package-latest): New procedure. (%transformations): Add 'with-latest'. (%transformation-options, show-transformation-options-help/detailed): Add '--with-latest'. * tests/transformations.scm ("options->transformation, with-latest"): New test. * doc/guix.texi (Package Transformation Options): Document it. --- doc/guix.texi | 31 ++++++++++++++++++++++++++++++ guix/transformations.scm | 49 +++++++++++++++++++++++++++++++++++++++++++++-- guix/upstream.scm | 28 +++++++++++++++++++++++++-- tests/transformations.scm | 19 +++++++++++++++++- 4 files changed, 122 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index f02353d9fa..c49bd36f85 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10381,6 +10381,37 @@ guix build coreutils --with-patch=glibc=./glibc-frob.patch In this example, glibc itself as well as everything that leads to Coreutils in the dependency graph is rebuilt. +@cindex upstream, latest version +@item --with-latest=@var{package} +So you like living on the bleeding edge? This option is for you! It +replaces occurrences of @var{package} in the dependency graph with its +latest upstream version, as reported by @command{guix refresh} +(@pxref{Invoking guix refresh}). + +It does so by determining the latest upstream release of @var{package} +(if possible), downloading it, and authenticating it @emph{if} it comes +with an OpenPGP signature. + +As an example, the command below builds Guix against the latest version +of Guile-JSON: + +@example +guix build guix --with-latest=guile-json +@end example + +There are limitations. First, in cases where the tool cannot or does +not know how to authenticate source code, you are at risk of running +malicious code; a warning is emitted in this case. Second, this option +simply changes the source used in the existing package definitions, +which is not always sufficient: there might be additional dependencies +that need to be added, patches to apply, and more generally the quality +assurance work that Guix developers normally do will be missing. + +You've been warned! In all the other cases, it's a snappy way to stay +on top. We encourage you to submit patches updating the actual package +definitions once you have successfully tested an upgrade +(@pxref{Contributing}). + @cindex test suite, skipping @item --without-tests=@var{package} Build @var{package} without running its tests. This can be useful in diff --git a/guix/transformations.scm b/guix/transformations.scm index 2385d3231e..4e9260350c 100644 --- a/guix/transformations.scm +++ b/guix/transformations.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,6 +25,9 @@ #:autoload (guix download) (download-to-store) #:autoload (guix git-download) (git-reference? git-reference-url) #:autoload (guix git) (git-checkout git-checkout? git-checkout-url) + #:autoload (guix upstream) (package-latest-release* + upstream-source-version + upstream-source-signature-urls) #:use-module (guix utils) #:use-module (guix memoization) #:use-module (guix gexp) @@ -511,6 +514,42 @@ additional patches." (rewrite obj) obj))) +(define (transform-package-latest specs) + "Return a procedure that rewrites package graphs such that those in SPECS +are replaced by their latest upstream version." + (define (package-with-latest-upstream p) + (let ((source (package-latest-release* p))) + (cond ((not source) + (warning + (G_ "could not determine latest upstream release of '~a'~%") + (package-name p)) + p) + ((string=? (upstream-source-version source) + (package-version p)) + p) + (else + (unless (pair? (upstream-source-signature-urls source)) + (warning (G_ "cannot authenticate source of '~a', version ~a~%") + (package-name p) + (upstream-source-version source))) + + ;; TODO: Take 'upstream-source-input-changes' into account. + (package + (inherit p) + (version (upstream-source-version source)) + (source source)))))) + + (define rewrite + (package-input-rewriting/spec + (map (lambda (spec) + (cons spec package-with-latest-upstream)) + specs))) + + (lambda (obj) + (if (package? obj) + (rewrite obj) + obj))) + (define %transformations ;; Transformations that can be applied to things to build. The car is the ;; key used in the option alist, and the cdr is the transformation @@ -525,7 +564,8 @@ additional patches." (with-c-toolchain . ,transform-package-toolchain) (with-debug-info . ,transform-package-with-debug-info) (without-tests . ,transform-package-tests) - (with-patch . ,transform-package-patches))) + (with-patch . ,transform-package-patches) + (with-latest . ,transform-package-latest))) (define (transformation-procedure key) "Return the transformation procedure associated with KEY, a symbol such as @@ -567,6 +607,8 @@ additional patches." (parser 'without-tests)) (option '("with-patch") #t #f (parser 'with-patch)) + (option '("with-latest") #t #f + (parser 'with-latest)) (option '("help-transform") #f #f (lambda _ @@ -598,6 +640,9 @@ additional patches." (display (G_ " --with-patch=PACKAGE=FILE add FILE to the list of patches of PACKAGE")) + (display (G_ " + --with-latest=PACKAGE + use the latest upstream release of PACKAGE")) (display (G_ " --with-c-toolchain=PACKAGE=TOOLCHAIN build PACKAGE and its dependents with TOOLCHAIN")) diff --git a/guix/upstream.scm b/guix/upstream.scm index a8ed1d81cd..accd8967d8 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -31,8 +31,8 @@ #:use-module (guix base32) #:use-module (guix gexp) #:use-module (guix store) - #:use-module ((guix derivations) - #:select (built-derivations derivation->output-path)) + #:use-module ((guix derivations) #:select (built-derivations derivation->output-path)) + #:autoload (gcrypt hash) (port-sha256) #:use-module (guix monads) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -248,6 +248,9 @@ correspond to the same version." '() (importer-modules)))) +;; Tests need to mock this variable so mark it as "non-declarative". +(set! %updaters %updaters) + (define* (lookup-updater package #:optional (updaters (force %updaters))) "Return an updater among UPDATERS that matches PACKAGE, or #f if none of @@ -351,6 +354,27 @@ values: 'interactive' (default), 'always', and 'never'." data url) #f))))))) +(define-gexp-compiler (upstream-source-compiler (source ) + system target) + "Download SOURCE from its first URL and lower it as a fixed-output +derivation that would fetch it." + (mlet* %store-monad ((url -> (first (upstream-source-urls source))) + (signature + -> (and=> (upstream-source-signature-urls source) + first)) + (tarball ((store-lift download-tarball) url signature))) + (unless tarball + (raise (formatted-message (G_ "failed to fetch source from '~a'") + url))) + + ;; Instead of returning TARBALL, return a fixed-output derivation that + ;; would be able to re-download it. In practice, since TARBALL is already + ;; in the store, no extra download will happen, but having the derivation + ;; in store improves provenance tracking. + (let ((hash (call-with-input-file tarball port-sha256))) + (url-fetch url 'sha256 hash (store-path-package-name tarball) + #:system system)))) + (define (find2 pred lst1 lst2) "Like 'find', but operate on items from both LST1 and LST2. Return two values: the item from LST1 and the item from LST2 that match PRED." diff --git a/tests/transformations.scm b/tests/transformations.scm index 9053deba41..7877029486 100644 --- a/tests/transformations.scm +++ b/tests/transformations.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2019, 2020 Ludovic Courtès +;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -30,6 +30,7 @@ #:use-module (guix ui) #:use-module (guix utils) #:use-module (guix git) + #:use-module (guix upstream) #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages busybox) @@ -396,6 +397,22 @@ (map local-file-file (origin-patches (package-source dep))))))))) +(test-equal "options->transformation, with-latest" + "42.0" + (mock ((guix upstream) %updaters + (delay (list (upstream-updater + (name 'dummy) + (pred (const #t)) + (description "") + (latest (const (upstream-source + (package "foo") + (version "42.0") + (urls '("http://example.org"))))))))) + (let* ((p (dummy-package "foo" (version "1.0"))) + (t (options->transformation + `((with-latest . "foo"))))) + (package-version (t p))))) + (test-end) ;;; Local Variables: -- cgit 1.4.1 From 2a9784ffa247bb2580346b7ce1d3f23c302459a3 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Tue, 12 Jan 2021 15:46:03 +0100 Subject: doc: Replace TP with Weblate mentions. * doc/contributing.texi: Replace link to TP with a link to Weblate. * doc/guix.texi: Replace link to TP with a link to Weblate. * doc/guix-cookbook.texi: Replace link to TP with a link to Weblate. --- doc/contributing.texi | 4 ++-- doc/guix-cookbook.texi | 5 +++-- doc/guix.texi | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'doc') diff --git a/doc/contributing.texi b/doc/contributing.texi index d0ab08336a..d1619d3a65 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -593,8 +593,8 @@ such as @command{guix package --show} take care of rendering it appropriately. Synopses and descriptions are translated by volunteers -@uref{https://translationproject.org/domain/guix-packages.html, at the -Translation Project} so that as many users as possible can read them in +@uref{https://translate.fedoraproject.org/projects/guix/packages, at +Weblate} so that as many users as possible can read them in their native language. User interfaces search them and display them in the language specified by the current locale. diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 54ab99558e..a0e91a32c7 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi @@ -57,8 +57,9 @@ its API, and related concepts. @c how to join your own translation team and how to report issues with the @c translation. If you would like to translate this document in your native language, consider -joining the @uref{https://translationproject.org/domain/guix-cookbook.html, -Translation Project}. +joining +@uref{https://translate.fedoraproject.org/projects/guix/documentation-cookbook, +Weblate}. @menu * Scheme tutorials:: Meet your new favorite language! diff --git a/doc/guix.texi b/doc/guix.texi index c49bd36f85..89b0a2fa50 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -142,9 +142,9 @@ GNU Guix参考手册}), French (@pxref{Top,,, guix.fr, Manuel de référence de Guix}), German (@pxref{Top,,, guix.de, Referenzhandbuch zu GNU Guix}), Spanish (@pxref{Top,,, guix.es, Manual de referencia de GNU Guix}), and Russian (@pxref{Top,,, guix.ru, Руководство GNU Guix}). If you -would like to translate it in your native language, consider joining the -@uref{https://translationproject.org/domain/guix-manual.html, Translation -Project}. +would like to translate it in your native language, consider joining +@uref{https://translate.fedoraproject.org/projects/guix/documentation-manual, +Weblate}. @menu * Introduction:: What is Guix about? -- cgit 1.4.1 From 07ef129db31d9738668100681babd8547f071f6e Mon Sep 17 00:00:00 2001 From: Joshua Branson Date: Thu, 21 Jan 2021 07:22:07 -0500 Subject: doc: cookbook: Add "Guix System Image API" section. * doc/guix-cookbook.texi (Guix System Image API): New section. Signed-off-by: Mathieu Othacehe --- doc/guix-cookbook.texi | 212 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) (limited to 'doc') diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index a0e91a32c7..1cddaa7faf 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi @@ -1354,6 +1354,7 @@ reference. @menu * Customizing the Kernel:: Creating and using a custom Linux kernel on Guix System. +* Guix System Image API:: Customizing images to target specific platforms. * Connecting to Wireguard VPN:: Connecting to a Wireguard VPN. * Customizing a Window Manager:: Handle customization of a Window manager on Guix System. * Running Guix on a Linode Server:: Running Guix on a Linode Server @@ -1602,6 +1603,217 @@ likely that you'll need to modify the initrd on a machine using a custom kernel, since certain modules which are expected to be built may not be available for inclusion into the initrd. +@node Guix System Image API +@section Guix System Image API + +Historically, Guix System is centered around an @code{operating-system} +structure. This structure contains various fields ranging from the +bootloader and kernel declaration to the services to install. + +Depending on the target machine, that can go from a standard +@code{x86_64} machine to a small ARM single board computer such as the +Pine64, the image constraints can vary a lot. The hardware +manufacturers will impose different image formats with various partition +sizes and offsets. + +To create images suitable for all those machines, a new abstraction is +necessary: that's the goal of the @code{image} record. This record +contains all the required information to be transformed into a +standalone image, that can be directly booted on any target machine. + +@lisp +(define-record-type* + image make-image + image? + (name image-name ;symbol + (default #f)) + (format image-format) ;symbol + (target image-target + (default #f)) + (size image-size ;size in bytes as integer + (default 'guess)) + (operating-system image-operating-system ; + (default #f)) + (partitions image-partitions ;list of + (default '())) + (compression? image-compression? ;boolean + (default #t)) + (volatile-root? image-volatile-root? ;boolean + (default #t)) + (substitutable? image-substitutable? ;boolean + (default #t))) +@end lisp + +This record contains the operating-system to instantiate. The +@code{format} field defines the image type and can be @code{efi-raw}, +@code{qcow2} or @code{iso9660} for instance. In the future, it could be +extended to @code{docker} or other image types. + +A new directory in the Guix sources is dedicated to images definition. For now +there are four files: + +@itemize @bullet +@item @file{gnu/system/images/hurd.scm} +@item @file{gnu/system/images/pine64.scm} +@item @file{gnu/system/images/novena.scm} +@item @file{gnu/system/images/pinebook-pro.scm} +@end itemize + +Let's have a look to @file{pine64.scm}. It contains the +@code{pine64-barebones-os} variable which is a minimal definition of an +operating-system dedicated to the @b{Pine A64 LTS} board. + +@lisp +(define pine64-barebones-os + (operating-system + (host-name "vignemale") + (timezone "Europe/Paris") + (locale "en_US.utf8") + (bootloader (bootloader-configuration + (bootloader u-boot-pine64-lts-bootloader) + (target "/dev/vda"))) + (initrd-modules '()) + (kernel linux-libre-arm64-generic) + (file-systems (cons (file-system + (device (file-system-label "my-root")) + (mount-point "/") + (type "ext4")) + %base-file-systems)) + (services (cons (service agetty-service-type + (agetty-configuration + (extra-options '("-L")) ; no carrier detect + (baud-rate "115200") + (term "vt100") + (tty "ttyS0"))) + %base-services)))) +@end lisp + +The @code{kernel} and @code{bootloader} fields are pointing to packages +dedicated to this board. + +Right below, the @code{pine64-image-type} variable is also defined. + +@lisp +(define pine64-image-type + (image-type + (name 'pine64-raw) + (constructor (cut image-with-os arm64-disk-image <>)))) +@end lisp + +It's using a record we haven't talked about yet, the @code{image-type} record, +defined this way: + +@lisp +(define-record-type* + image-type make-image-type + image-type? + (name image-type-name) ;symbol + (constructor image-type-constructor)) ; -> +@end lisp + +The main purpose of this record is to associate a name to a procedure +transforming an @code{operating-system} to an image. To understand why +it is necessary, let's have a look to the command producing an image +from an @code{operating-system} configuration file: + +@example +guix system image my-os.scm +@end example + +This command expects an @code{operating-system} configuration but how +should we indicate that we want an image targeting a Pine64 board? We +need to provide an extra information, the @code{image-type}, by passing +the @code{--image-type} or @code{-t} flag, this way: + +@example +guix system image --image-type=pine64-raw my-os.scm +@end example + +This @code{image-type} parameter points to the @code{pine64-image-type} +defined above. Hence, the @code{operating-system} declared in +@code{my-os.scm} will be applied the @code{(cut image-with-os +arm64-disk-image <>)} procedure to turn it into an image. + +The resulting image looks like: + +@lisp +(image + (format 'disk-image) + (target "aarch64-linux-gnu") + (operating-system my-os) + (partitions + (list (partition + (inherit root-partition) + (offset root-offset))))) +@end lisp + +which is the aggregation of the @code{operating-system} defined in + @code{my-os.scm} to the @code{arm64-disk-image} record. + +But enough Scheme madness. What does this image API bring to the Guix user? + +One can run: + +@example +mathieu@@cervin:~$ guix system --list-image-types +The available image types are: + + - pinebook-pro-raw + - pine64-raw + - novena-raw + - hurd-raw + - hurd-qcow2 + - qcow2 + - uncompressed-iso9660 + - efi-raw + - arm64-raw + - arm32-raw + - iso9660 +@end example + +and by writing an @code{operating-system} file based on +@code{pine64-barebones-os}, you can customize your image to your +preferences in a file (@file{my-pine-os.scm}) like this: + +@lisp +(use-modules (gnu services linux) + (gnu system images pine64)) + +(let ((base-os pine64-barebones-os)) + (operating-system + (inherit base-os) + (timezone "America/Indiana/Indianapolis") + (services + (cons + (service earlyoom-service-type + (earlyoom-configuration + (prefer-regexp "icecat|chromium"))) + (operating-system-user-services base-os))))) +@end lisp + +run: + +@example +guix system image --image-type=pine64-raw my-pine-os.scm +@end example + +or, + +@example +guix system image --image-type=hurd-raw my-hurd-os.scm +@end example + +to get an image that can be written directly to a hard drive and booted +from. + +Without changing anything to @code{my-hurd-os.scm}, calling: + +@example +guix system image --image-type=hurd-qcow2 my-hurd-os.scm +@end example + +will instead produce a Hurd QEMU image. + @node Connecting to Wireguard VPN @section Connecting to Wireguard VPN -- cgit 1.4.1 From 55e097e26f5cd1598a482b1b40b075d2ee05ea55 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 21 Jan 2021 20:57:43 +0100 Subject: doc: Properly close sentences ending with an upper-case letter. * doc/guix.texi (Application Setup): (USB Stick and DVD Installation): (Proxy Settings): (Primary URL): (origin Reference): (Build Systems): (The Store): (Package Transformation Options): (Invoking guix lint): (Invoking guix graph): (operating-system Reference): (X Window): (Desktop Services): (Database Services): (Mail Services): (Messaging Services): (Monitoring Services): (LDAP Services): (Certificate Services): (DNS Services): (VPN Services): (Power Management Services): (Virtualization Services): (Version Control Services): (Name Service Switch): (Bootloader Configuration): (Running Guix in a VM): (Separate Debug Info): Use "@." to indicate to Texinfo the sentence does end with a capital letter. --- doc/guix.texi | 80 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 89b0a2fa50..4a20b3b902 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1748,7 +1748,7 @@ $ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale Note that the @code{glibc-locales} package contains data for all the locales supported by the GNU@tie{}libc and weighs in at around -917@tie{}MiB. Alternatively, the @code{glibc-utf8-locales} is smaller but +917@tie{}MiB@. Alternatively, the @code{glibc-utf8-locales} is smaller but limited to a few UTF-8 locales. The @env{GUIX_LOCPATH} variable plays a role similar to @env{LOCPATH} @@ -2137,7 +2137,7 @@ Access to @file{/dev/srX} usually requires root privileges. @unnumberedsubsec Booting Once this is done, you should be able to reboot the system and boot from -the USB stick or DVD. The latter usually requires you to get in the +the USB stick or DVD@. The latter usually requires you to get in the BIOS or UEFI boot menu, where you can choose to boot from the USB stick. In order to boot from Libreboot, switch to the command mode by pressing the @kbd{c} key and type @command{search_grub usb}. @@ -3848,7 +3848,7 @@ authenticating bindings between domain names and public keys). @vindex http_proxy @vindex https_proxy -Substitutes are downloaded over HTTP or HTTPS. The @env{http_proxy} and +Substitutes are downloaded over HTTP or HTTPS@. The @env{http_proxy} and @env{https_proxy} environment variables can be set in the environment of @command{guix-daemon} and are honored for downloads of substitutes. Note that the value of those environment variables in the environment @@ -5316,7 +5316,7 @@ repository in the @file{.guix-channel} file, like so: This allows @command{guix pull} to determine whether it is pulling code from a mirror of the channel; when that is the case, it warns the user -that the mirror might be stale and displays the primary URL. That way, +that the mirror might be stale and displays the primary URL@. That way, users cannot be tricked into fetching code from a stale mirror that does not receive security updates. @@ -6718,7 +6718,7 @@ values are: a URL represented as a string, or a list thereof. @cindex fixed-output derivations, for download @item @code{method} -A monadic procedure that handles the given URI. The procedure must +A monadic procedure that handles the given URI@. The procedure must accept at least three arguments: the value of the @code{uri} field and the hash algorithm and hash value specified by the @code{hash} field. It must return a store item or a derivation in the store monad @@ -7290,7 +7290,7 @@ definition facility for Common Lisp programs and libraries. The @code{asdf-build-system/source} system installs the packages in source form, and can be loaded using any common lisp implementation, via -ASDF. The others, such as @code{asdf-build-system/sbcl}, install binary +ASDF@. The others, such as @code{asdf-build-system/sbcl}, install binary systems in the format which a particular implementation understands. These build systems can also be used to produce executable programs, or lisp images which contain a set of packages pre-loaded. @@ -8582,7 +8582,7 @@ instruct it to listen for TCP connections (@pxref{Invoking guix-daemon, @item ssh @cindex SSH access to build daemons -These URIs allow you to connect to a remote daemon over SSH. This +These URIs allow you to connect to a remote daemon over SSH@. This feature requires Guile-SSH (@pxref{Requirements}) and a working @command{guile} binary in @env{PATH} on the destination machine. It supports public key and GSSAPI authentication. A typical URL might look @@ -10307,7 +10307,7 @@ guix build --with-c-toolchain=hwloc=clang-toolchain \ @quotation Note There can be application binary interface (ABI) incompatibilities among tool chains. This is particularly true of the C++ standard library and -run-time support libraries such as that of OpenMP. By rebuilding all +run-time support libraries such as that of OpenMP@. By rebuilding all dependents with the same tool chain, @option{--with-c-toolchain} minimizes the risks of incompatibility but cannot entirely eliminate them. Choose @var{package} wisely. @@ -11730,7 +11730,7 @@ Identify inputs that should most likely be native inputs. Probe @code{home-page} and @code{source} URLs and report those that are invalid. Suggest a @code{mirror://} URL when applicable. If the @code{source} URL redirects to a GitHub URL, recommend usage of the GitHub -URL. Check that the source file name is meaningful, e.g.@: is not just a +URL@. Check that the source file name is meaningful, e.g.@: is not just a version number or ``git-checkout'', without a declared @code{file-name} (@pxref{origin Reference}). @@ -12024,7 +12024,7 @@ the command-line tools. Packages and their dependencies form a @dfn{graph}, specifically a directed acyclic graph (DAG). It can quickly become difficult to have a mental model of the package DAG, so the @command{guix graph} command -provides a visual representation of the DAG. By default, +provides a visual representation of the DAG@. By default, @command{guix graph} emits a DAG representation in the input format of @uref{https://www.graphviz.org/, Graphviz}, so its output can be passed directly to the @command{dot} command of Graphviz. It can also emit an @@ -13464,7 +13464,7 @@ Manual}). Here are some examples: @table @code @item (list (uuid "4dab5feb-d176-45de-b287-9b0a6e4c01cb")) -Use the swap partition with the given UUID. You can learn the UUID of a +Use the swap partition with the given UUID@. You can learn the UUID of a Linux swap partition by running @command{swaplabel @var{device}}, where @var{device} is the @file{/dev} file name of that partition. @@ -17740,7 +17740,7 @@ auto-login session. @deftp {Data Type} xorg-configuration This data type represents the configuration of the Xorg graphical display server. Note that there is no Xorg service; instead, the X server is started -by a ``display manager'' such as GDM, SDDM, and SLiM. Thus, the configuration +by a ``display manager'' such as GDM, SDDM, and SLiM@. Thus, the configuration of these display managers aggregates an @code{xorg-configuration} record. @table @asis @@ -18729,7 +18729,7 @@ The desktop environments in Guix use the Xorg display server by default. If you'd like to use the newer display server protocol called Wayland, you need to use the @code{sddm-service} instead of GDM as the graphical login manager. You should then -select the ``GNOME (Wayland)'' session in SDDM. Alternatively you can +select the ``GNOME (Wayland)'' session in SDDM@. Alternatively you can also try starting GNOME on Wayland manually from a TTY with the command ``XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session``. Currently only GNOME has support for Wayland. @@ -19343,7 +19343,7 @@ Port on which PostgreSQL should listen. Locale to use as the default when creating the database cluster. @item @code{config-file} (default: @code{(postgresql-config-file)}) -The configuration file to use when running PostgreSQL. The default +The configuration file to use when running PostgreSQL@. The default behaviour uses the postgresql-config-file record with the default values for the fields. @@ -19396,7 +19396,7 @@ required to add extensions provided by other packages. @deftp {Data Type} postgresql-config-file Data type representing the PostgreSQL configuration file. As shown in the following example, this can be used to customize the configuration -of PostgreSQL. Note that you can use any G-expression or filename in +of PostgreSQL@. Note that you can use any G-expression or filename in place of this record, if you already have a configuration file you'd like to use for example. @@ -19423,7 +19423,7 @@ host all all ::1/128 md5")) @table @asis @item @code{log-destination} (default: @code{"syslog"}) -The logging method to use for PostgreSQL. Multiple values are accepted, +The logging method to use for PostgreSQL@. Multiple values are accepted, separated by commas. @item @code{hba-file} (default: @code{%default-postgres-hba}) @@ -20349,7 +20349,7 @@ could allow a user to delete others' mailboxes, or @code{ln -s @deftypevr {@code{dovecot-configuration} parameter} boolean mail-full-filesystem-access? Allow full file system access to clients. There's no access checks -other than what the operating system does for the active UID/GID. It +other than what the operating system does for the active UID/GID@. It works with both maildir and mboxes, allowing you to prefix mailboxes names with e.g.@: @file{/path/} or @file{~user/}. Defaults to @samp{#f}. @@ -20382,14 +20382,14 @@ Defaults to @samp{"optimized"}. @end deftypevr @deftypevr {@code{dovecot-configuration} parameter} boolean mail-nfs-storage? -Mail storage exists in NFS. Set this to yes to make Dovecot flush +Mail storage exists in NFS@. Set this to yes to make Dovecot flush NFS caches whenever needed. If you're using only a single mail server this isn't needed. Defaults to @samp{#f}. @end deftypevr @deftypevr {@code{dovecot-configuration} parameter} boolean mail-nfs-index? -Mail index files also exist in NFS. Setting this to yes requires +Mail index files also exist in NFS@. Setting this to yes requires @samp{mmap-disable? #t} and @samp{fsync-disable? #f}. Defaults to @samp{#f}. @end deftypevr @@ -20496,9 +20496,9 @@ Defaults to @samp{"30 secs"}. @end deftypevr @deftypevr {@code{dovecot-configuration} parameter} boolean mail-save-crlf? -Save mails with CR+LF instead of plain LF. This makes sending those +Save mails with CR+LF instead of plain LF@. This makes sending those mails take less CPU, especially with sendfile() syscall with Linux and -FreeBSD. But it also creates a bit more disk I/O which may just make it +FreeBSD@. But it also creates a bit more disk I/O which may just make it slower. Also note that if other software reads the mboxes/maildirs, they may handle the extra CRs wrong and cause problems. Defaults to @samp{#f}. @@ -21562,7 +21562,7 @@ A list of verification options (these mostly map to OpenSSL's @end deftypevr @deftypevr {@code{ssl-configuration} parameter} maybe-string-list options -A list of general options relating to SSL/TLS. These map to OpenSSL's +A list of general options relating to SSL/TLS@. These map to OpenSSL's @code{set_options()}. For a full list of options available in LuaSec, see the LuaSec source. @end deftypevr @@ -21627,7 +21627,7 @@ Defaults to @samp{#f}. @deftypevr {@code{prosody-configuration} parameter} string-list s2s-insecure-domains Many servers don't support encryption or have invalid or self-signed certificates. You can list domains here that will not be required to -authenticate using certificates. They will be authenticated using DNS. See +authenticate using certificates. They will be authenticated using DNS@. See @url{https://prosody.im/doc/s2s#security}. Defaults to @samp{()}. @end deftypevr @@ -22240,7 +22240,7 @@ Bind the web interface to the specified port. Bind the web interface to the specified address. @item @code{base} (default: @code{"/"}) -Specify the path of the base URL. This can be useful if +Specify the path of the base URL@. This can be useful if @command{darkstat} is accessed via a reverse proxy. @end table @@ -22804,7 +22804,7 @@ Defaults to @samp{"nslcd"}. @deftypevr {@code{nslcd-configuration} parameter} log-option log This option controls the way logging is done via a list containing -SCHEME and LEVEL. The SCHEME argument may either be the symbols +SCHEME and LEVEL@. The SCHEME argument may either be the symbols @samp{none} or @samp{syslog}, or an absolute file name. The LEVEL argument is optional and specifies the log level. The log level may be one of the following symbols: @samp{crit}, @samp{error}, @samp{warning}, @@ -24344,7 +24344,7 @@ first securely generates a key on the server. It then makes a request to the Let's Encrypt certificate authority (CA) to sign the key. The CA checks that the request originates from the host in question by using a challenge-response protocol, requiring the server to provide its -response over HTTP. If that protocol completes successfully, the CA +response over HTTP@. If that protocol completes successfully, the CA signs the key, resulting in a certificate. That certificate is valid for a limited period of time, and therefore to continue to provide TLS services, the server needs to periodically ask the CA to renew its @@ -24603,7 +24603,7 @@ must match a key ID defined in a @code{knot-key-configuration}. No key means that a key is not require to match that ACL. @item @code{action} (default: @code{'()}) -An ordered list of actions that are permitted or forbidden by this ACL. Possible +An ordered list of actions that are permitted or forbidden by this ACL@. Possible values are lists of zero or more elements from @code{'transfer}, @code{'notify} and @code{'update}. @@ -24714,7 +24714,7 @@ An optional port can be given with the @@ separator. For instance: @item @code{via} (default: @code{'()}) An ordered list of source IP addresses. An empty list will have Knot choose -an appropriate source IP. An optional port can be given with the @@ separator. +an appropriate source IP@. An optional port can be given with the @@ separator. The default is to choose at random. @item @code{key} (default: @code{#f}) @@ -24783,11 +24783,11 @@ When @code{#t}, use the Single-Type Signing Scheme. An algorithm of signing keys and issued signatures. @item @code{ksk-size} (default: @code{256}) -The length of the KSK. Note that this value is correct for the default +The length of the KSK@. Note that this value is correct for the default algorithm, but would be unsecure for other algorithms. @item @code{zsk-size} (default: @code{256}) -The length of the ZSK. Note that this value is correct for the default +The length of the ZSK@. Note that this value is correct for the default algorithm, but would be unsecure for other algorithms. @item @code{dnskey-ttl} (default: @code{'default}) @@ -25253,7 +25253,7 @@ Defaults to @samp{()}. The @code{(gnu services vpn)} module provides services related to @dfn{virtual private networks} (VPNs). It provides a @emph{client} service for your machine to connect to a VPN, and a @emph{server} service for your machine -to host a VPN. Both services use @uref{https://openvpn.net/, OpenVPN}. +to host a VPN@. Both services use @uref{https://openvpn.net/, OpenVPN}. @deffn {Scheme Procedure} openvpn-client-service @ [#:config (openvpn-client-configuration)] @@ -26175,7 +26175,7 @@ Defaults to @samp{disabled}. @end deftypevr @deftypevr {@code{tlp-configuration} parameter} string energy-perf-policy-on-ac -Set CPU performance versus energy saving policy on AC. Alternatives are +Set CPU performance versus energy saving policy on AC@. Alternatives are performance, normal, powersave. Defaults to @samp{"performance"}. @@ -27108,7 +27108,7 @@ Defaults to @samp{#f}. @end deftypevr @deftypevr {@code{libvirt-configuration} parameter} optional-string host-uuid -Host UUID. UUID must not have all digits be the same. +Host UUID@. UUID must not have all digits be the same. Defaults to @samp{""}. @@ -27390,7 +27390,7 @@ guix build -s armhf-linux inkscape @noindent and it will build Inkscape for ARMv7 @emph{as if it were a native -build}, transparently using QEMU to emulate the ARMv7 CPU. Pretty handy +build}, transparently using QEMU to emulate the ARMv7 CPU@. Pretty handy if you'd like to test a package build for an architecture you don't have access to! @@ -28384,7 +28384,7 @@ serve the default @file{/srv/git} over HTTPS might be: This example assumes that you are using Let's Encrypt to get your TLS certificate. @xref{Certificate Services}. The default @code{certbot} service will redirect all HTTP traffic on @code{git.my-host.org} to -HTTPS. You will also need to add an @code{fcgiwrap} proxy to your +HTTPS@. You will also need to add an @code{fcgiwrap} proxy to your system services. @xref{Web Services}. @end deffn @@ -30637,7 +30637,7 @@ system databases. @itemx rpc @itemx services @itemx shadow -The system databases handled by the NSS. Each of these fields must be a +The system databases handled by the NSS@. Each of these fields must be a list of @code{} objects (see below). @end table @end deftp @@ -30895,7 +30895,7 @@ in ``legacy'' BIOS mode. @vindex grub-efi-netboot-bootloader @code{grub-efi-netboot-bootloader} allows you to boot your system over network -through TFTP. In combination with an NFS root file system this allows you to +through TFTP@. In combination with an NFS root file system this allows you to build a diskless Guix system. The installation of the @code{grub-efi-netboot-bootloader} generates the content @@ -30932,7 +30932,7 @@ TFTP, for example by copying them into the TFTP root directory at @code{target}. It is important to note that symlinks pointing outside the TFTP root directory may need to be allowed in the configuration of your TFTP server. Further the -store link exposes the whole store through TFTP. Both points need to be +store link exposes the whole store through TFTP@. Both points need to be considered carefully for security aspects. Beside the @code{grub-efi-netboot-bootloader}, the already mentioned TFTP and @@ -32049,7 +32049,7 @@ connect pass the @command{-spice port=5930,disable-ticketing} flag to @command{qemu}. See previous section for further information on how to do this. Spice also allows you to do some nice stuff like share your clipboard with your -VM. To enable that you'll also have to pass the following flags to @command{qemu}: +VM@. To enable that you'll also have to pass the following flags to @command{qemu}: @example -device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x5 @@ -32801,7 +32801,7 @@ missing. The problem with debugging information is that is takes up a fair amount of disk space. For example, debugging information for the GNU C Library -weighs in at more than 60 MiB. Thus, as a user, keeping all the +weighs in at more than 60 MiB@. Thus, as a user, keeping all the debugging info of all the installed programs is usually not an option. Yet, space savings should not come at the cost of an impediment to debugging---especially in the GNU system, which should make it easier -- cgit 1.4.1 From 4de829a2230f6b5867207d3f722d393884f65057 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 22 Jan 2021 17:29:35 +0100 Subject: doc: Clarify that package transformations are preserved across upgrades. Reported by pineapples on #guix. This is a followup to 8e1907a72430aa989125b053573ef0897c480697. * doc/guix.texi (Invoking guix package): Remove sentence that says that package transformations are lost upon upgrading and explicitly say the opposite. --- doc/guix.texi | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 4a20b3b902..7e7c43286f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3576,11 +3576,8 @@ Consequently, this command must be used with care. Finally, since @command{guix package} may actually start build processes, it supports all the common build options (@pxref{Common Build Options}). It also supports package transformation options, such as -@option{--with-source} (@pxref{Package Transformation Options}). -However, note that package transformations are lost when upgrading; to -preserve transformations across upgrades, you should define your own -package variant in a Guile module and add it to @env{GUIX_PACKAGE_PATH} -(@pxref{Defining Packages}). +@option{--with-source}, and preserves them across upgrades +(@pxref{Package Transformation Options}). @node Substitutes @section Substitutes -- cgit 1.4.1 From a38d0b0137400b4d54bab5181538fd7eeeefa49a Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 18 Jan 2021 10:25:18 +0100 Subject: services: postgresql: Use Guile datatypes. * gnu/services/databases.scm (postgresql-config-file-compiler): Support Guile datatypes in the "extra-config" field. * gnu/tests/databases.scm (%postgresql-os): Test it. * doc/guix.texi (Database Services): Document it. --- doc/guix.texi | 18 ++++++++++++------ gnu/services/databases.scm | 38 ++++++++++++++++++++++---------------- gnu/tests/databases.scm | 10 +++++++++- 3 files changed, 43 insertions(+), 23 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 7e7c43286f..3c607b308a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19410,12 +19410,12 @@ local all all trust host all all 127.0.0.1/32 md5 host all all ::1/128 md5")) (extra-config - '(("session_preload_libraries" "'auto_explain'") - ("random_page_cost" "2") - ("auto_explain.log_min_duration" "'100ms'") - ("work_mem" "'500MB'") - ("logging_collector" "on") - ("log_directory" "'/var/log/postgresql'"))))))) + '(("session_preload_libraries" "auto_explain") + ("random_page_cost" 2) + ("auto_explain.log_min_duration" "100 ms") + ("work_mem" "500 MB") + ("logging_collector" #t) + ("log_directory" "/var/log/postgresql"))))))) @end lisp @table @asis @@ -19435,6 +19435,12 @@ List of additional keys and values to include in the PostgreSQL config file. Each entry in the list should be a list where the first element is the key, and the remaining elements are the values. +The values can be numbers, booleans or strings and will be mapped to +PostgreSQL parameters types @code{Boolean}, @code{String}, +@code{Numeric}, @code{Numeric with Unit} and @code{Enumerated} described +@uref{https://www.postgresql.org/docs/current/config-setting.html, +here}. + @end table @end deftp diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index d2dc5f0da8..bb0e40632e 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -115,22 +115,28 @@ host all all ::1/128 md5")) (match file (($ log-destination hba-file ident-file extra-config) - (define (single-quote string) - (if string - (list "'" string "'") - '())) - - (define contents - (append-map - (match-lambda - ((key) '()) - ((key . #f) '()) - ((key values ...) `(,key " = " ,@values "\n"))) - - `(("log_destination" ,@(single-quote log-destination)) - ("hba_file" ,@(single-quote hba-file)) - ("ident_file" ,@(single-quote ident-file)) - ,@extra-config))) + ;; See: https://www.postgresql.org/docs/current/config-setting.html. + (define (format-value value) + (cond + ((boolean? value) + (list (if value "on" "off"))) + ((number? value) + (list (number->string value))) + (else + (list "'" value "'")))) + + (define contents + (append-map + (match-lambda + ((key) '()) + ((key . #f) '()) + ((key values ...) + `(,key " = " ,@(append-map format-value values) "\n"))) + + `(("log_destination" ,log-destination) + ("hba_file" ,hba-file) + ("ident_file" ,ident-file) + ,@extra-config))) (gexp->derivation "postgresql.conf" diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index 31d5ae4c6a..7338007919 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm @@ -218,7 +218,15 @@ (simple-operating-system (service postgresql-service-type (postgresql-configuration - (postgresql postgresql-10))))) + (postgresql postgresql-10) + (config-file + (postgresql-config-file + (extra-config + '(("session_preload_libraries" "auto_explain") + ("random_page_cost" 2) + ("auto_explain.log_min_duration" "100 ms") + ("work_mem" "500 MB") + ("debug_print_plan" #t))))))))) (define (run-postgresql-test) "Run tests in %POSTGRESQL-OS." -- cgit 1.4.1 From 6c0679215f4ffa534c1eb2e8c8a6e043a0c993fe Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 18 Jan 2021 10:35:29 +0100 Subject: services: postgresql: Add socket directory support. * gnu/services/databases.scm (postgresql-config-file-socket-directory): New procedure. ()[socket-directory]: New field. (postgresql-config-file-compiler): Honor it. (postgresql-activation): Create the socket directory if needed. * doc/guix.texi (Database Services): Document it. * gnu/tests/guix.scm (%guix-data-service-os): Adapt it. * gnu/tests/monitoring.scm (%zabbix-os): Ditto. * gnu/tests/web.scm (patchwork-os): Ditto. Signed-off-by: Mathieu Othacehe --- doc/guix.texi | 6 ++++++ gnu/services/databases.scm | 32 +++++++++++++++++++++++--------- gnu/tests/guix.scm | 5 ++++- gnu/tests/monitoring.scm | 7 ++++++- gnu/tests/web.scm | 7 ++++++- 5 files changed, 45 insertions(+), 12 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 3c607b308a..b01bbf0d96 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19430,6 +19430,12 @@ configuration. @item @code{ident-file} (default: @code{%default-postgres-ident}) Filename or G-expression for the user name mapping configuration. +@item @code{socket-directory} (default: @code{"/var/lib/postgresql"}) +Specifies the directory of the Unix-domain socket(s) on which PostgreSQL +is to listen for connections from client applications. If set to +@code{#false} PostgreSQL does not listen on any Unix-domain sockets, in +which case only TCP/IP sockets can be used to connect to the server. + @item @code{extra-config} (default: @code{'()}) List of additional keys and values to include in the PostgreSQL config file. Each entry in the list should be a list where the first element diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index bb0e40632e..83dee52cf3 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -43,6 +43,7 @@ postgresql-config-file-log-destination postgresql-config-file-hba-file postgresql-config-file-ident-file + postgresql-config-file-socket-directory postgresql-config-file-extra-config postgresql-configuration @@ -101,20 +102,23 @@ host all all ::1/128 md5")) (define-record-type* postgresql-config-file make-postgresql-config-file postgresql-config-file? - (log-destination postgresql-config-file-log-destination - (default "syslog")) - (hba-file postgresql-config-file-hba-file - (default %default-postgres-hba)) - (ident-file postgresql-config-file-ident-file - (default %default-postgres-ident)) - (extra-config postgresql-config-file-extra-config - (default '()))) + (log-destination postgresql-config-file-log-destination + (default "syslog")) + (hba-file postgresql-config-file-hba-file + (default %default-postgres-hba)) + (ident-file postgresql-config-file-ident-file + (default %default-postgres-ident)) + (socket-directory postgresql-config-file-socket-directory + (default "/var/run/postgresql")) + (extra-config postgresql-config-file-extra-config + (default '()))) (define-gexp-compiler (postgresql-config-file-compiler (file ) system target) (match file (($ log-destination hba-file - ident-file extra-config) + ident-file socket-directory + extra-config) ;; See: https://www.postgresql.org/docs/current/config-setting.html. (define (format-value value) (cond @@ -136,6 +140,9 @@ host all all ::1/128 md5")) `(("log_destination" ,log-destination) ("hba_file" ,hba-file) ("ident_file" ,ident-file) + ,@(if socket-directory + `(("unix_socket_directories" ,socket-directory)) + '()) ,@extra-config))) (gexp->derivation @@ -211,6 +218,13 @@ host all all ::1/128 md5")) (mkdir-p #$data-directory) (chown #$data-directory (passwd:uid user) (passwd:gid user)) + ;; Create the socket directory. + (let ((socket-directory + #$(postgresql-config-file-socket-directory config-file))) + (when (string? socket-directory) + (mkdir-p socket-directory) + (chown socket-directory (passwd:uid user) (passwd:gid user)))) + ;; Drop privileges and init state directory in a new ;; process. Wait for it to finish before proceeding. (match (primitive-fork) diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm index af7d8f0b21..219b8b482f 100644 --- a/gnu/tests/guix.scm +++ b/gnu/tests/guix.scm @@ -164,7 +164,10 @@ " local all all trust host all all 127.0.0.1/32 trust -host all all ::1/128 trust")))))) +host all all ::1/128 trust")) + ;; XXX: Remove when postgresql default socket directory is + ;; changed to /var/run/postgresql. + (socket-directory #f))))) (service guix-data-service-type (guix-data-service-configuration (host "0.0.0.0"))) diff --git a/gnu/tests/monitoring.scm b/gnu/tests/monitoring.scm index 7371b02fe1..c21bb1e63d 100644 --- a/gnu/tests/monitoring.scm +++ b/gnu/tests/monitoring.scm @@ -309,7 +309,12 @@ zabbix||{} (service dhcp-client-service-type) (service postgresql-service-type (postgresql-configuration - (postgresql postgresql-10))) + (postgresql postgresql-10) + ;; XXX: Remove when postgresql default socket directory is + ;; changed to /var/run/postgresql. + (config-file + (postgresql-config-file + (socket-directory #f))))) (service zabbix-front-end-service-type (zabbix-front-end-configuration (db-password "zabbix"))) diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index 7f4518acd2..cc0e79c8b2 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -569,7 +569,12 @@ HTTP-PORT." (listen '("8080")))))) (service postgresql-service-type (postgresql-configuration - (postgresql postgresql-10))) + (postgresql postgresql-10) + ;; XXX: Remove when postgresql default socket directory is + ;; changed to /var/run/postgresql. + (config-file + (postgresql-config-file + (socket-directory #f))))) (service patchwork-service-type (patchwork-configuration (patchwork patchwork) -- cgit 1.4.1 From fe4b8823505c3271fc3eacaa93c30a5cec078739 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 18 Jan 2021 10:52:25 +0100 Subject: services: postgresql: Add log directory support. * gnu/services/databases.scm (postgresql-configuration-log-directory): New procedure. ()[log-directory]: New field. (postgresql-activation): Create the log directory. (postgresql-shepherd-service): Honor it. * gnu/tests/databases.scm (%postgresql-log-directory): New variable. (log-file): New test case. * doc/guix.texi (Database Services): Document it. --- doc/guix.texi | 5 +++++ gnu/services/databases.scm | 36 ++++++++++++++++++++++++++++-------- gnu/tests/databases.scm | 20 ++++++++++++++++++++ 3 files changed, 53 insertions(+), 8 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index b01bbf0d96..f4fbe6b0e6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19344,6 +19344,11 @@ The configuration file to use when running PostgreSQL@. The default behaviour uses the postgresql-config-file record with the default values for the fields. +@item @code{log-directory} (default: @code{"/var/log/postgresql"}) +The directory where @command{pg_ctl} output will be written in a file +named @code{"pg_ctl.log"}. This file can be useful to debug PostgreSQL +configuration errors for instance. + @item @code{data-directory} (default: @code{"/var/lib/postgresql/data"}) Directory in which to store the data. diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index 83dee52cf3..c387a7da6c 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -52,6 +52,7 @@ postgresql-configuration-port postgresql-configuration-locale postgresql-configuration-file + postgresql-configuration-log-directory postgresql-configuration-data-directory postgresql-service @@ -164,6 +165,8 @@ host all all ::1/128 md5")) (default "en_US.utf8")) (config-file postgresql-configuration-file (default (postgresql-config-file))) + (log-directory postgresql-configuration-log-directory + (default "/var/log/postgresql")) (data-directory postgresql-configuration-data-directory (default "/var/lib/postgresql/data")) (extension-packages postgresql-configuration-extension-packages @@ -200,15 +203,18 @@ host all all ::1/128 md5")) (define postgresql-activation (match-lambda - (($ postgresql port locale config-file data-directory - extension-packages) + (($ postgresql port locale config-file + log-directory data-directory + extension-packages) #~(begin (use-modules (guix build utils) (ice-9 match)) (let ((user (getpwnam "postgres")) - (initdb (string-append #$(final-postgresql postgresql extension-packages) - "/bin/initdb")) + (initdb (string-append + #$(final-postgresql postgresql + extension-packages) + "/bin/initdb")) (initdb-args (append (if #$locale @@ -225,6 +231,11 @@ host all all ::1/128 md5")) (mkdir-p socket-directory) (chown socket-directory (passwd:uid user) (passwd:gid user)))) + ;; Create the log directory. + (when (string? #$log-directory) + (mkdir-p #$log-directory) + (chown #$log-directory (passwd:uid user) (passwd:gid user))) + ;; Drop privileges and init state directory in a new ;; process. Wait for it to finish before proceeding. (match (primitive-fork) @@ -247,8 +258,9 @@ host all all ::1/128 md5")) (define postgresql-shepherd-service (match-lambda - (($ postgresql port locale config-file data-directory - extension-packages) + (($ postgresql port locale config-file + log-directory data-directory + extension-packages) (let* ((pg_ctl-wrapper ;; Wrapper script that switches to the 'postgres' user before ;; launching daemon. @@ -260,13 +272,21 @@ host all all ::1/128 md5")) (match (command-line) ((_ mode) (let ((user (getpwnam "postgres")) - (pg_ctl #$(file-append (final-postgresql postgresql extension-packages) + (pg_ctl #$(file-append + (final-postgresql postgresql + extension-packages) "/bin/pg_ctl")) (options (format #f "--config-file=~a -p ~d" #$config-file #$port))) (setgid (passwd:gid user)) (setuid (passwd:uid user)) - (execl pg_ctl pg_ctl "-D" #$data-directory "-o" options + (execl pg_ctl pg_ctl "-D" #$data-directory + #$@(if (string? log-directory) + (list "-l" + (string-append log-directory + "/pg_ctl.log")) + '()) + "-o" options mode))))))) (pid-file (in-vicinity data-directory "postmaster.pid")) (action (lambda args diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index 7338007919..d881a8c3ee 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm @@ -214,6 +214,9 @@ ;;; The PostgreSQL service. ;;; +(define %postgresql-log-directory + "/var/log/postgresql") + (define %postgresql-os (simple-operating-system (service postgresql-service-type @@ -262,6 +265,23 @@ (start-service 'postgres)) marionette)) + (test-assert "log-file" + (marionette-eval + '(begin + (use-modules (ice-9 ftw) + (ice-9 match)) + (current-output-port + (open-file "/dev/console" "w0")) + (let ((server-log-file + (string-append #$%postgresql-log-directory + "/pg_ctl.log"))) + (and (file-exists? server-log-file) + (display + (call-with-input-file server-log-file + get-string-all))) + #t)) + marionette)) + (test-end) (exit (= (test-runner-fail-count (test-runner-current)) 0))))) -- cgit 1.4.1 From ec145a2ff9f6a69234ddd2f3656ac324b53d30d3 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 18 Jan 2021 11:10:28 +0100 Subject: services: postgresql: Add postgresql-role-service-type. * gnu/services/databases.scm (postgresql-role, postgresql-role?, postgresql-role-name, postgresql-role-permissions, postgresql-role-create-database?, postgresql-role-configuration, postgresql-role-configuration?, postgresql-role-configuration-host, postgresql-role-configuration-roles, postgresql-role-service-type): New procedures. * gnu/tests/databases.scm: Test it. * doc/guix.texi: Document it. --- doc/guix.texi | 62 +++++++++++++++++++++++++++ gnu/services/databases.scm | 102 +++++++++++++++++++++++++++++++++++++++++++++ gnu/tests/databases.scm | 44 ++++++++++++++++++- 3 files changed, 207 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index f4fbe6b0e6..6ea782fd23 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19455,6 +19455,68 @@ here}. @end table @end deftp +@deffn {Scheme Variable} postgresql-role-service-type +This service allows to create PostgreSQL roles and databases after +PostgreSQL service start. Here is an example of its use. + +@lisp +(service postgresql-role-service-type + (postgresql-role-configuration + (roles + (list (postgresql-role + (name "test") + (create-database? #t)))))) +@end lisp + +This service can be extended with extra roles, as in this +example: + +@lisp +(service-extension postgresql-role-service-type + (const (postgresql-role + (name "alice") + (create-database? #t)))) +@end lisp +@end deffn + +@deftp {Data Type} postgresql-role +PostgreSQL manages database access permissions using the concept of +roles. A role can be thought of as either a database user, or a group +of database users, depending on how the role is set up. Roles can own +database objects (for example, tables) and can assign privileges on +those objects to other roles to control who has access to which objects. + +@table @asis +@item @code{name} +The role name. + +@item @code{permissions} (default: @code{'(createdb login)}) +The role permissions list. Supported permissions are @code{bypassrls}, +@code{createdb}, @code{createrole}, @code{login}, @code{replication} and +@code{superuser}. + +@item @code{create-database?} (default: @code{#f}) +Whether to create a database with the same name as the role. + +@end table +@end deftp + +@deftp {Data Type} postgresql-role-configuration +Data type representing the configuration of +@var{postgresql-role-service-type}. + +@table @asis +@item @code{host} (default: @code{"/var/run/postgresql"}) +The PostgreSQL host to connect to. + +@item @code{log} (default: @code{"/var/log/postgresql_roles.log"}) +File name of the log file. + +@item @code{roles} (default: @code{'()}) +The initial PostgreSQL roles to create. +@end table +@end deftp + @subsubheading MariaDB/MySQL @defvr {Scheme Variable} mysql-service-type diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index 0d60616156..c11898693f 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -58,6 +58,18 @@ postgresql-service postgresql-service-type + postgresql-role + postgresql-role? + postgresql-role-name + postgresql-role-permissions + postgresql-role-create-database? + postgresql-role-configuration + postgresql-role-configuration? + postgresql-role-configuration-host + postgresql-role-configuration-roles + + postgresql-role-service-type + memcached-service-type memcached-configuration memcached-configuration? @@ -343,6 +355,96 @@ and stores the database cluster in @var{data-directory}." (data-directory data-directory) (extension-packages extension-packages)))) +(define-record-type* + postgresql-role make-postgresql-role + postgresql-role? + (name postgresql-role-name) ;string + (permissions postgresql-role-permissions + (default '(createdb login))) ;list + (create-database? postgresql-role-create-database? ;boolean + (default #f))) + +(define-record-type* + postgresql-role-configuration make-postgresql-role-configuration + postgresql-role-configuration? + (host postgresql-role-configuration-host ;string + (default "/var/run/postgresql")) + (log postgresql-role-configuration-log ;string + (default "/var/log/postgresql_roles.log")) + (roles postgresql-role-configuration-roles + (default '()))) ;list + +(define (postgresql-create-roles config) + ;; See: https://www.postgresql.org/docs/current/sql-createrole.html for the + ;; complete permissions list. + (define (format-permissions permissions) + (let ((dict '(bypassrls createdb createrole login replication superuser))) + (string-join (filter-map (lambda (permission) + (and (member permission dict) + (string-upcase + (symbol->string permission)))) + permissions) + " "))) + + (define (roles->queries roles) + (apply mixed-text-file "queries" + (append-map + (lambda (role) + (match-record role + (name permissions create-database?) + `("SELECT NOT(EXISTS(SELECT 1 FROM pg_catalog.pg_roles WHERE \ +rolname = '" ,name "')) as not_exists;\n" +"\\gset\n" +"\\if :not_exists\n" +"CREATE ROLE " ,name +" WITH " ,(format-permissions permissions) +";\n" +,@(if create-database? + `("CREATE DATABASE " ,name + " OWNER " ,name ";\n") + '()) +"\\endif\n"))) + roles))) + + (let ((host (postgresql-role-configuration-host config)) + (roles (postgresql-role-configuration-roles config))) + (program-file + "postgresql-create-roles" + #~(begin + (let ((psql #$(file-append postgresql "/bin/psql"))) + (execl psql psql "-a" + "-h" #$host + "-f" #$(roles->queries roles))))))) + +(define (postgresql-role-shepherd-service config) + (match-record config + (log) + (list (shepherd-service + (requirement '(postgres)) + (provision '(postgres-roles)) + (one-shot? #t) + (start #~(make-forkexec-constructor + (list #$(postgresql-create-roles config)) + #:user "postgres" #:group "postgres" + #:log-file #$log)) + (documentation "Create PostgreSQL roles."))))) + +(define postgresql-role-service-type + (service-type (name 'postgresql-role) + (extensions + (list (service-extension shepherd-root-service-type + postgresql-role-shepherd-service))) + (compose concatenate) + (extend (lambda (config extended-roles) + (match-record config + (host roles) + (postgresql-role-configuration + (host host) + (roles (append roles extended-roles)))))) + (default-value (postgresql-role-configuration)) + (description "Ensure the specified PostgreSQL roles are +created after the PostgreSQL database is started."))) + ;;; ;;; Memcached diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index d881a8c3ee..e831d69f5a 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm @@ -217,6 +217,9 @@ (define %postgresql-log-directory "/var/log/postgresql") +(define %role-log-file + "/var/log/postgresql_roles.log") + (define %postgresql-os (simple-operating-system (service postgresql-service-type @@ -229,7 +232,13 @@ ("random_page_cost" 2) ("auto_explain.log_min_duration" "100 ms") ("work_mem" "500 MB") - ("debug_print_plan" #t))))))))) + ("debug_print_plan" #t))))))) + (service postgresql-role-service-type + (postgresql-role-configuration + (roles + (list (postgresql-role + (name "root") + (create-database? #t)))))))) (define (run-postgresql-test) "Run tests in %POSTGRESQL-OS." @@ -282,6 +291,39 @@ #t)) marionette)) + (test-assert "database ready" + (begin + (marionette-eval + '(begin + (let loop ((i 10)) + (unless (or (zero? i) + (and (file-exists? #$%role-log-file) + (string-contains + (call-with-input-file #$%role-log-file + get-string-all) + ";\nCREATE DATABASE"))) + (sleep 1) + (loop (- i 1))))) + marionette))) + + (test-assert "database creation" + (marionette-eval + '(begin + (use-modules (gnu services herd) + (ice-9 popen)) + (current-output-port + (open-file "/dev/console" "w0")) + (let* ((port (open-pipe* + OPEN_READ + #$(file-append postgresql "/bin/psql") + "-tAh" "/var/run/postgresql" + "-c" "SELECT 1 FROM pg_database WHERE + datname='root'")) + (output (get-string-all port))) + (close-pipe port) + (string-contains output "1"))) + marionette)) + (test-end) (exit (= (test-runner-fail-count (test-runner-current)) 0))))) -- cgit 1.4.1 From 4a480147336ba0c1073e20c1abdee8844451bd5a Mon Sep 17 00:00:00 2001 From: Joshua Branson Date: Wed, 27 Jan 2021 10:19:55 -0500 Subject: doc: Fix mapped devices example in the manual. Reported by Raghav Gururajan and Mikhail Tsykalov . * doc/guix.texi (Mapped Devices): Replace target with targets. Signed-off-by: Leo Famulari --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 6ea782fd23..ff9e8da2e0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14066,7 +14066,7 @@ be declared as follows: @lisp (mapped-device (source "vg0") - (target (list "vg0-alpha" "vg0-beta")) + (targets (list "vg0-alpha" "vg0-beta")) (type lvm-device-mapping)) @end lisp -- cgit 1.4.1 From 784048c27b90e32814f6d06363f94fb3f9bf0a6d Mon Sep 17 00:00:00 2001 From: Hartmut Goebel Date: Thu, 30 Apr 2020 22:53:47 +0200 Subject: doc: Update guidance about Rust package naming. * doc/contributing.texi (Rust Crates): Explain versions suffix based on packages version and Crate "caret" versioning. --- doc/contributing.texi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/contributing.texi b/doc/contributing.texi index d1619d3a65..f167df067c 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -802,10 +802,10 @@ To prevent namespace collisions we prefix all other Rust packages with the dashes should remain in place. In the rust ecosystem it is common for multiple incompatible versions of a -package to be used at any given time, so all packages should have a versioned -suffix. If a package has passed version 1.0.0 then just the major version -number is sufficient (e.g.@: @code{rust-clap-2}), otherwise the version suffix -should contain both the major and minor version (e.g.@: @code{rust-rand-0.6}). +package to be used at any given time, so all package definitions should have a +versioned suffix. The versioned suffix is the left-most non-zero digit (and +any leading zeros, of course). This follows the ``caret'' version scheme +intended by Cargo. Examples@: @code{rust-clap-2}, @code{rust-rand-0.6}. Because of the difficulty in reusing rust packages as pre-compiled inputs for other packages the Cargo build system (@pxref{Build Systems, -- cgit 1.4.1 From a23b384f3f200c3771c8dfef0661f687fadda807 Mon Sep 17 00:00:00 2001 From: nixo Date: Mon, 18 Jan 2021 23:56:54 +0100 Subject: build-system/julia: Enable tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/build-system/julia.scm (julia-build): Set tests? default to #t. * guix/build/julia-build-system.scm (check): Respect tests? and fix julia invocation. (%standard-phases): Add check phase after install. * doc/guix.texi (julia-build-system): Update accordingly. Signed-off-by: Ludovic Courtès --- doc/guix.texi | 2 +- guix/build-system/julia.scm | 2 +- guix/build/julia-build-system.scm | 27 +++++++++++++++++---------- 3 files changed, 19 insertions(+), 12 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index ff9e8da2e0..219617e266 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -7616,7 +7616,7 @@ implements the build procedure used by @uref{https://julialang.org/, julia} packages, which essentially is similar to running @samp{julia -e 'using Pkg; Pkg.add(package)'} in an environment where @env{JULIA_LOAD_PATH} contains the paths to all Julia package inputs. -Tests are run with @code{Pkg.test}. +Tests are run by calling @code{/test/runtests.jl}. Julia packages require the source @code{file-name} to be the real name of the package, correctly capitalized. diff --git a/guix/build-system/julia.scm b/guix/build-system/julia.scm index 488fe9bb1d..d3cb41c054 100644 --- a/guix/build-system/julia.scm +++ b/guix/build-system/julia.scm @@ -75,7 +75,7 @@ (define* (julia-build store name inputs #:key source - (tests? #f) + (tests? #t) (phases '(@ (guix build julia-build-system) %standard-phases)) (outputs '("out")) diff --git a/guix/build/julia-build-system.scm b/guix/build/julia-build-system.scm index e8ebcf8ba0..61817e0b47 100644 --- a/guix/build/julia-build-system.scm +++ b/guix/build/julia-build-system.scm @@ -69,15 +69,22 @@ (string-append "pushfirst!(DEPOT_PATH, pop!(DEPOT_PATH)); using " package))) #t) -(define* (check #:key source inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (package (strip-store-file-name source)) - (builddir (string-append out "/share/julia/"))) - ;; With a patch, SOURCE_DATE_EPOCH is honored - (setenv "SOURCE_DATE_EPOCH" "1") - (setenv "JULIA_DEPOT_PATH" builddir) - (setenv "JULIA_LOAD_PATH" (string-append builddir "packages/")) - (invoke-julia (string-append "using Pkg;Pkg.test(\"" package "\")"))) +(define* (check #:key tests? source inputs outputs #:allow-other-keys) + (when tests? + (let* ((out (assoc-ref outputs "out")) + (package (strip-store-file-name source)) + (builddir (string-append out "/share/julia/"))) + ;; With a patch, SOURCE_DATE_EPOCH is honored + (setenv "SOURCE_DATE_EPOCH" "1") + (setenv "JULIA_DEPOT_PATH" builddir) + (setenv "JULIA_LOAD_PATH" + (string-append builddir "packages/" ":" + (or (getenv "JULIA_LOAD_PATH") + ""))) + (setenv "HOME" "/tmp") + (invoke "julia" + (string-append builddir "packages/" + package "/test/runtests.jl")))) #t) (define (julia-create-package-toml outputs source @@ -112,7 +119,7 @@ version = \"" version "\" (delete 'check) ; tests must be run after installation (replace 'install install) (add-after 'install 'precompile precompile) - ;; (add-after 'install 'check check) + (add-after 'install 'check check) ;; TODO: In the future we could add a "system-image-generation" phase ;; where we use PackageCompiler.jl to speed up package loading times (delete 'configure) -- cgit 1.4.1 From ba093a6d27557766b999b2f29ea6706bb8697db9 Mon Sep 17 00:00:00 2001 From: nixo Date: Thu, 28 Jan 2021 16:13:33 +0100 Subject: build-system/julia: Don't rely on file name to set module name. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/build/julia-build-system.scm (project.toml->name): New procedure. (precompile, check, julia-build): Accept new key argument #:julia-package-name. * guix/build-system/julia.scm (julia-build): ... add it. * doc/guix.texi (julia-build-system): Update julia-package-name accordingly. Signed-off-by: Ludovic Courtès --- doc/guix.texi | 5 +++-- guix/build-system/julia.scm | 4 +++- guix/build/julia-build-system.scm | 35 ++++++++++++++++++++++++++++------- 3 files changed, 34 insertions(+), 10 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 219617e266..9b65be3c9c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -7618,8 +7618,9 @@ julia} packages, which essentially is similar to running @samp{julia -e @env{JULIA_LOAD_PATH} contains the paths to all Julia package inputs. Tests are run by calling @code{/test/runtests.jl}. -Julia packages require the source @code{file-name} to be the real name of the -package, correctly capitalized. +The Julia package name is read from the file @file{Project.toml}. This +value can be overridden by passing the argument @code{#:julia-file-name} +(which must be correctly capitalized). For packages requiring shared library dependencies, you may need to write the @file{/deps/deps.jl} file manually. It's usually a line of @code{const diff --git a/guix/build-system/julia.scm b/guix/build-system/julia.scm index d3cb41c054..63cb7cd864 100644 --- a/guix/build-system/julia.scm +++ b/guix/build-system/julia.scm @@ -82,6 +82,7 @@ (search-paths '()) (system (%current-system)) (guile #f) + (julia-package-name #f) (imported-modules %julia-build-system-modules) (modules '((guix build julia-build-system) (guix build utils)))) @@ -103,7 +104,8 @@ #:outputs %outputs #:search-paths ',(map search-path-specification->sexp search-paths) - #:inputs %build-inputs))) + #:inputs %build-inputs + #:julia-package-name ,julia-package-name))) (define guile-for-build (match guile diff --git a/guix/build/julia-build-system.scm b/guix/build/julia-build-system.scm index 61817e0b47..8f57045a8c 100644 --- a/guix/build/julia-build-system.scm +++ b/guix/build/julia-build-system.scm @@ -21,6 +21,8 @@ #:use-module ((guix build gnu-build-system) #:prefix gnu:) #:use-module (guix build utils) #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #:use-module (ice-9 rdelim) #:export (%standard-phases julia-create-package-toml julia-build)) @@ -37,18 +39,34 @@ ;; subpath where we store the package content (define %package-path "/share/julia/packages/") -(define* (install #:key source inputs outputs #:allow-other-keys) +(define (project.toml->name file) + "Look for Julia package name in the TOML file FILE (usually named +Project.toml)." + (call-with-input-file file + (lambda (in) + (let loop ((line (read-line in 'concat))) + (if (eof-object? line) + #f + (let ((m (string-match "name\\s*=\\s*\"(.*)\"" line))) + (if m (match:substring m 1) + (loop (read-line in 'concat))))))))) + +(define* (install #:key source inputs outputs julia-package-name + #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (package-dir (string-append out %package-path - (strip-store-file-name source)))) + (or + julia-package-name + (project.toml->name "Project.toml"))))) (mkdir-p package-dir) (copy-recursively (getcwd) package-dir)) #t) -(define* (precompile #:key source inputs outputs #:allow-other-keys) +(define* (precompile #:key source inputs outputs julia-package-name + #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (builddir (string-append out "/share/julia/")) - (package (strip-store-file-name source))) + (package (or julia-package-name (project.toml->name "Project.toml")))) (mkdir-p builddir) ;; With a patch, SOURCE_DATE_EPOCH is honored (setenv "SOURCE_DATE_EPOCH" "1") @@ -69,10 +87,11 @@ (string-append "pushfirst!(DEPOT_PATH, pop!(DEPOT_PATH)); using " package))) #t) -(define* (check #:key tests? source inputs outputs #:allow-other-keys) +(define* (check #:key tests? source inputs outputs julia-package-name + #:allow-other-keys) (when tests? (let* ((out (assoc-ref outputs "out")) - (package (strip-store-file-name source)) + (package (or julia-package-name (project.toml->name "Project.toml"))) (builddir (string-append out "/share/julia/"))) ;; With a patch, SOURCE_DATE_EPOCH is honored (setenv "SOURCE_DATE_EPOCH" "1") @@ -127,9 +146,11 @@ version = \"" version "\" (delete 'patch-usr-bin-file) (delete 'build))) -(define* (julia-build #:key inputs (phases %standard-phases) +(define* (julia-build #:key inputs julia-package-name + (phases %standard-phases) #:allow-other-keys #:rest args) "Build the given Julia package, applying all of PHASES in order." (apply gnu:gnu-build #:inputs inputs #:phases phases + #:julia-package-name julia-package-name args)) -- cgit 1.4.1 From 95f72dcd7aece05e9252c93bef5a831f96cb5393 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Fri, 22 Jan 2021 20:06:55 +0100 Subject: services: shepherd: Allow custom 'shepherd' package. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/shepherd.scm (): New record. (shepherd-boot-gexp, shepherd-root-service-type): Use it. (scm->go, shepherd-configuration-file): Allow passing custom shepherd package. * gnu/system.scm (operating-system-shepherd-service-names): Use the new record. * guix/scripts/system.scm (export-shepherd-graph): Adjust accordingly. * doc/guix.texi (Shepherd Services). Document it. Co-authored-by: Ludovic Courtès --- doc/guix.texi | 17 ++++++++++++++- gnu/services/shepherd.scm | 53 +++++++++++++++++++++++++++++++++++------------ gnu/system.scm | 10 +++++---- guix/scripts/system.scm | 3 ++- 4 files changed, 64 insertions(+), 19 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 9b65be3c9c..405b218289 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -32782,9 +32782,24 @@ The service type for the Shepherd ``root service''---i.e., PID@tie{}1. This is the service type that extensions target when they want to create shepherd services (@pxref{Service Types and Services}, for an example). -Each extension must pass a list of @code{}. +Each extension must pass a list of @code{}. Its +value must be a @code{shepherd-configuration}, as described below. @end defvr +@deftp {Data Type} shepherd-configuration +This data type represents the Shepherd's configuration. + +@table @code +@item shepherd (default: @code{shepherd}) +The Shepherd package to use. + +@item services (default: @code{'()}) +A list of @code{} to start. +You should probably use the service extension +mechanism instead (@pxref{Shepherd Services}). +@end table +@end deftp + @defvr {Scheme Variable} %shepherd-root-service This service represents PID@tie{}1. @end defvr diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index d2f9776288..e2ec59f5aa 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2017 Clément Lassieur ;;; Copyright © 2018 Carlo Zancanaro ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -36,7 +37,12 @@ #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) - #:export (shepherd-root-service-type + #:export (shepherd-configuration + shepherd-configuration? + shepherd-configuration-shepherd + shepherd-configuration-services + + shepherd-root-service-type %shepherd-root-service shepherd-service-type @@ -76,7 +82,18 @@ ;;; Code: -(define (shepherd-boot-gexp services) +(define-record-type* + shepherd-configuration make-shepherd-configuration + shepherd-configuration? + (shepherd shepherd-configuration-shepherd + (default shepherd)) ; package + (services shepherd-configuration-services + (default '()))) ; list of + +(define (shepherd-boot-gexp config) + "Return a gexp starting the shepherd service." + (let ((shepherd (shepherd-configuration-shepherd config)) + (services (shepherd-configuration-services config))) #~(begin ;; Keep track of the booted system. (false-if-exception (delete-file "/run/booted-system")) @@ -95,7 +112,10 @@ ;; Start shepherd. (execl #$(file-append shepherd "/bin/shepherd") "shepherd" "--config" - #$(shepherd-configuration-file services)))) + #$(shepherd-configuration-file services shepherd))))) + +(define shepherd-packages + (compose list shepherd-configuration-shepherd)) (define shepherd-root-service-type (service-type @@ -103,20 +123,25 @@ ;; Extending the root shepherd service (aka. PID 1) happens by ;; concatenating the list of services provided by the extensions. (compose concatenate) - (extend append) + (extend (lambda (config extra-services) + (shepherd-configuration + (inherit config) + (services (append (shepherd-configuration-services config) + extra-services))))) (extensions (list (service-extension boot-service-type shepherd-boot-gexp) (service-extension profile-service-type - (const (list shepherd))))) + shepherd-packages))) + (default-value (shepherd-configuration)) (description "Run the GNU Shepherd as PID 1---i.e., the operating system's first process. The Shepherd takes care of managing services such as daemons by ensuring they are started and stopped in the right order."))) (define %shepherd-root-service - ;; The root shepherd service, aka. PID 1. Its parameter is a list of - ;; objects. - (service shepherd-root-service-type '())) + ;; The root shepherd service, aka. PID 1. Its parameter is a + ;; . + (service shepherd-root-service-type)) (define-syntax shepherd-service-type (syntax-rules (description) @@ -270,9 +295,9 @@ stored." #~(#$name #$doc #$proc))) (shepherd-service-actions service)))))))) -(define (scm->go file) +(define (scm->go file shepherd) "Compile FILE, which contains code to be loaded by shepherd's config file, -and return the resulting '.go' file." +and return the resulting '.go' file. SHEPHERD is used as shepherd package." (let-system (system target) (with-extensions (list shepherd) (computed-file (string-append (basename (scheme-file-name file) ".scm") @@ -294,11 +319,13 @@ and return the resulting '.go' file." #:options '(#:local-build? #t #:substitutable? #f))))) -(define (shepherd-configuration-file services) - "Return the shepherd configuration file for SERVICES." +(define (shepherd-configuration-file services shepherd) + "Return the shepherd configuration file for SERVICES. SHEPHERD is used +as shepherd package." (assert-valid-graph services) - (let ((files (map shepherd-service-file services))) + (let ((files (map shepherd-service-file services)) + (scm->go (cute scm->go <> shepherd))) (define config #~(begin (use-modules (srfi srfi-34) diff --git a/gnu/system.scm b/gnu/system.scm index 90ad368664..5bf2a85272 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -12,6 +12,7 @@ ;;; Copyright © 2020 Maxim Cournoyer ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2020 Efraim Flashner +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -1134,10 +1135,11 @@ we're running in the final root." (define (operating-system-shepherd-service-names os) "Return the list of Shepherd service names for OS." (append-map shepherd-service-provision - (service-value - (fold-services (operating-system-services os) - #:target-type - shepherd-root-service-type)))) + (shepherd-configuration-services + (service-value + (fold-services (operating-system-services os) + #:target-type + shepherd-root-service-type))))) (define* (operating-system-derivation os) "Return a derivation that builds OS." diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 66225bff35..19b8c5163c 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -915,7 +915,8 @@ Run 'herd status' to view the list of services on your system.\n")))))) (let* ((services (operating-system-services os)) (pid1 (fold-services services #:target-type shepherd-root-service-type)) - (shepherds (service-value pid1)) ;list of + ;; Get the list of . + (shepherds (shepherd-configuration-services (service-value pid1))) (sinks (filter (lambda (service) (null? (shepherd-service-requirement service))) shepherds))) -- cgit 1.4.1 From 041a9466ea23d6ae811491bcf529bf9487317b48 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 29 Jan 2021 13:48:44 +0100 Subject: guix: channels: Introduce "channel-with-substitutes-available". * guix/channels.scm (find-latest-commit-with-substitutes, channel-with-substitutes-available): New procedures. * guix/scripts/pull.scm (guix-pull): Move "channel-list" call inside the %current-system parameter scope. * doc/guix.texi (Channels with substitutes): New section. --- doc/guix.texi | 28 +++++++++++++- guix/channels.scm | 1 + guix/ci.scm | 38 ++++++++++++++++++- guix/scripts/pull.scm | 103 +++++++++++++++++++++++++------------------------- 4 files changed, 117 insertions(+), 53 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 405b218289..aca4657d6a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -40,7 +40,7 @@ Copyright @copyright{} 2016, 2017, 2018, 2019, 2020 Julien Lepiller@* Copyright @copyright{} 2016 Alex ter Weele@* Copyright @copyright{} 2016, 2017, 2018, 2019 Christopher Baines@* Copyright @copyright{} 2017, 2018, 2019 Clément Lassieur@* -Copyright @copyright{} 2017, 2018, 2020 Mathieu Othacehe@* +Copyright @copyright{} 2017, 2018, 2020, 2021 Mathieu Othacehe@* Copyright @copyright{} 2017 Federico Beffa@* Copyright @copyright{} 2017, 2018 Carlo Zancanaro@* Copyright @copyright{} 2017 Thomas Danckaert@* @@ -245,6 +245,7 @@ Channels * Specifying Channel Authorizations:: Defining channel authors authorizations. * Primary URL:: Distinguishing mirror to original. * Writing Channel News:: Communicating information to channel's users. +* Channels with Substitutes:: Using channels with available substitutes. Development @@ -4919,6 +4920,7 @@ updates. * Specifying Channel Authorizations:: Defining channel authors authorizations. * Primary URL:: Distinguishing mirror to original. * Writing Channel News:: Communicating information to channel's users. +* Channels with Substitutes:: Using channels with available substitutes. @end menu @node Specifying Additional Channels @@ -5390,6 +5392,30 @@ xgettext -o news.po -l scheme -ken etc/news.txt To sum up, yes, you could use your channel as a blog. But beware, this is @emph{not quite} what your users might expect. +@node Channels with Substitutes +@section Channels with Substitutes + +When running @command{guix pull}, Guix will first compile the +definitions of every available package. This is an expensive operation +for which substitutes (@pxref{Substitutes}) may be available. The +following snippet in @file{channels.scm} will ensure that @command{guix +pull} uses the latest commit with available substitutes for the package +definitions: this is done by querying the continuous integration +server at @url{https://ci.guix.gnu.org}. + +@lisp +(use-modules (guix ci)) + +(list (channel-with-substitutes-available + %default-guix-channel + "https://ci.guix.gnu.org")) +@end lisp + +Note that this does not mean that all the packages that you will +install after running @command{guix pull} will have available +substitutes. It only ensures that @command{guix pull} will not try to +compile package definitions. This is particularly useful when using +machines with limited resources. @c ********************************************************************* @node Development diff --git a/guix/channels.scm b/guix/channels.scm index 0c84eed477..9ab8cd8749 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -20,6 +20,7 @@ (define-module (guix channels) #:use-module (git) + #:use-module (guix ci) #:use-module (guix git) #:use-module (guix git-authenticate) #:use-module ((guix openpgp) diff --git a/guix/ci.scm b/guix/ci.scm index f429bf198f..95325b4bfe 100644 --- a/guix/ci.scm +++ b/guix/ci.scm @@ -19,9 +19,11 @@ (define-module (guix ci) #:use-module (guix http-client) + #:use-module (guix utils) #:use-module (json) #:use-module (srfi srfi-1) #:use-module (ice-9 match) + #:autoload (guix channels) (channel) #:export (build-product? build-product-id build-product-type @@ -52,7 +54,9 @@ latest-builds evaluation latest-evaluations - evaluations-for-commit)) + evaluations-for-commit + + channel-with-substitutes-available)) ;;; Commentary: ;;; @@ -165,3 +169,35 @@ as one of their inputs." (string=? (checkout-commit checkout) commit)) (evaluation-checkouts evaluation))) (latest-evaluations url limit))) + +(define (find-latest-commit-with-substitutes url) + "Return the latest commit with available substitutes for the Guix package +definitions at URL. Return false if no commit were found." + (let* ((job-name (string-append "guix." (%current-system))) + (build (match (latest-builds url 1 + #:job job-name + #:status 0) ;success + ((build) build) + (_ #f))) + (evaluation (and build + (evaluation url (build-evaluation build)))) + (commit (and evaluation + (match (evaluation-checkouts evaluation) + ((checkout) + (checkout-commit checkout)))))) + commit)) + +(define (channel-with-substitutes-available chan url) + "Return a channel inheriting from CHAN but which commit field is set to the +latest commit with available substitutes for the Guix package definitions at +URL. The current system is taken into account. + +If no commit with available substitutes were found, the commit field is set to +false and a warning message is printed." + (let ((commit (find-latest-commit-with-substitutes url))) + (unless commit + (warning (G_ "could not find available substitutes at ~a~%") + url)) + (channel + (inherit chan) + (commit commit)))) diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 83cdc1d1eb..4e0ab5d341 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -765,60 +765,61 @@ Use '~/.config/guix/channels.scm' instead.")) #:argument-handler no-arguments)) (substitutes? (assoc-ref opts 'substitutes?)) (dry-run? (assoc-ref opts 'dry-run?)) - (channels (channel-list opts)) (profile (or (assoc-ref opts 'profile) %current-profile)) (current-channels (profile-channels profile)) (validate-pull (assoc-ref opts 'validate-pull)) (authenticate? (assoc-ref opts 'authenticate-channels?))) - (cond ((assoc-ref opts 'query) - (process-query opts profile)) - ((assoc-ref opts 'generation) - (process-generation-change opts profile)) - (else - (with-store store - (with-status-verbosity (assoc-ref opts 'verbosity) - (parameterize ((%current-system (assoc-ref opts 'system)) - (%graft? (assoc-ref opts 'graft?))) - (with-build-handler (build-notifier #:use-substitutes? - substitutes? - #:verbosity - (assoc-ref opts 'verbosity) - #:dry-run? dry-run?) - (set-build-options-from-command-line store opts) - (ensure-default-profile) - (honor-x509-certificates store) - - (let ((instances - (latest-channel-instances store channels - #:current-channels - current-channels - #:validate-pull - validate-pull - #:authenticate? - authenticate?))) - (format (current-error-port) - (N_ "Building from this channel:~%" - "Building from these channels:~%" - (length instances))) - (for-each (lambda (instance) - (let ((channel - (channel-instance-channel instance))) - (format (current-error-port) - " ~10a~a\t~a~%" - (channel-name channel) - (channel-url channel) - (string-take - (channel-instance-commit instance) - 7)))) - instances) - (parameterize ((%guile-for-build - (package-derivation - store - (if (assoc-ref opts 'bootstrap?) - %bootstrap-guile - (default-guile))))) - (with-profile-lock profile - (run-with-store store - (build-and-install instances profile))))))))))))))) + (cond + ((assoc-ref opts 'query) + (process-query opts profile)) + ((assoc-ref opts 'generation) + (process-generation-change opts profile)) + (else + (with-store store + (with-status-verbosity (assoc-ref opts 'verbosity) + (parameterize ((%current-system (assoc-ref opts 'system)) + (%graft? (assoc-ref opts 'graft?))) + (with-build-handler (build-notifier #:use-substitutes? + substitutes? + #:verbosity + (assoc-ref opts 'verbosity) + #:dry-run? dry-run?) + (set-build-options-from-command-line store opts) + (ensure-default-profile) + (honor-x509-certificates store) + + (let* ((channels (channel-list opts)) + (instances + (latest-channel-instances store channels + #:current-channels + current-channels + #:validate-pull + validate-pull + #:authenticate? + authenticate?))) + (format (current-error-port) + (N_ "Building from this channel:~%" + "Building from these channels:~%" + (length instances))) + (for-each (lambda (instance) + (let ((channel + (channel-instance-channel instance))) + (format (current-error-port) + " ~10a~a\t~a~%" + (channel-name channel) + (channel-url channel) + (string-take + (channel-instance-commit instance) + 7)))) + instances) + (parameterize ((%guile-for-build + (package-derivation + store + (if (assoc-ref opts 'bootstrap?) + %bootstrap-guile + (default-guile))))) + (with-profile-lock profile + (run-with-store store + (build-and-install instances profile))))))))))))))) ;;; pull.scm ends here -- cgit 1.4.1 From a1ea2acb376c8a74f41ce0e683680417207b365a Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 17 Jan 2021 09:03:07 -0500 Subject: build: test-driver.scm: Add test cases filtering options. * build-aux/test-driver.scm (show-help): Add help text for the new --select and --exclude options. (%options): Add the new select and exclude options. (test-runner-gnu): Pass them to the test runner. Update doc. (test-match-name*, test-match-name*/negated, %test-match-all): New variables. (main): Compute the test specifier based on the values of the new options and apply it to the current test runner when running the test file. * doc/guix.texi (Running the Test Suite): Document the new options. --- build-aux/test-driver.scm | 74 ++++++++++++++++++++++++++++++++++++++++------- doc/guix.texi | 12 ++++++++ 2 files changed, 75 insertions(+), 11 deletions(-) (limited to 'doc') diff --git a/build-aux/test-driver.scm b/build-aux/test-driver.scm index fe7e9c8807..2a5362a9fb 100644 --- a/build-aux/test-driver.scm +++ b/build-aux/test-driver.scm @@ -27,6 +27,8 @@ (use-modules (ice-9 getopt-long) (ice-9 pretty-print) + (ice-9 regex) + (srfi srfi-1) (srfi srfi-26) (srfi srfi-64)) @@ -34,14 +36,19 @@ (display "Usage: test-driver --test-name=NAME --log-file=PATH --trs-file=PATH [--expect-failure={yes|no}] [--color-tests={yes|no}] + [--select=REGEXP] [--exclude=REGEXP] [--enable-hard-errors={yes|no}] [--brief={yes|no}}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] -The '--test-name' option is mandatory.\n")) +The '--test-name' option is mandatory. The '--select' and '--exclude' options +allow selecting or excluding individual test cases via a regexp, +respectively.\n")) (define %options '((test-name (value #t)) (log-file (value #t)) (trs-file (value #t)) + (select (value #t)) + (exclude (value #t)) (color-tests (value #t)) (expect-failure (value #t)) ;XXX: not implemented yet (enable-hard-errors (value #t)) ;not implemented in SRFI-64 @@ -76,14 +83,22 @@ The '--test-name' option is mandatory.\n")) "") ;no color result))) + +;;; +;;; SRFI 64 custom test runner. +;;; + (define* (test-runner-gnu test-name #:key color? brief? (out-port (current-output-port)) - (trs-port (%make-void-port "w"))) + (trs-port (%make-void-port "w")) + select exclude) "Return an custom SRFI-64 test runner. TEST-NAME is a string specifying the file name of the current the test. COLOR? specifies whether to use colors, and BRIEF?, well, you know. OUT-PORT and TRS-PORT must be output ports. OUT-PORT defaults to the current output port, while TRS-PORT defaults to a -void port, which means no TRS output is logged." +void port, which means no TRS output is logged. SELECT and EXCLUDE may take a +regular expression to select or exclude individual test cases based on their +names." (define (test-on-test-begin-gnu runner) ;; Procedure called at the start of an individual test case, before the @@ -148,6 +163,34 @@ void port, which means no TRS output is logged." (test-runner-on-bad-end-name! runner test-on-bad-end-name-simple) runner)) + +;;; +;;; SRFI 64 test specifiers. +;;; +(define (test-match-name* regexp) + "Return a test specifier that matches a test name against REGEXP." + (lambda (runner) + (string-match regexp (test-runner-test-name runner)))) + +(define (test-match-name*/negated regexp) + "Return a negated test specifier version of test-match-name*." + (lambda (runner) + (not (string-match regexp (test-runner-test-name runner))))) + +;;; XXX: test-match-all is a syntax, which isn't convenient to use with a list +;;; of test specifiers computed at run time. Copy this SRFI 64 internal +;;; definition here, which is the procedural equivalent of 'test-match-all'. +(define (%test-match-all . pred-list) + (lambda (runner) + (let ((result #t)) + (let loop ((l pred-list)) + (if (null? l) + result + (begin + (if (not ((car l) runner)) + (set! result #f)) + (loop (cdr l)))))))) + ;;; ;;; Entry point. @@ -160,13 +203,20 @@ void port, which means no TRS output is logged." ((option 'help #f) (show-help)) ((option 'version #f) (format #t "test-driver.scm ~A" script-version)) (else - (let ((log (and=> (option 'log-file #f) (cut open-file <> "w0"))) - (trs (and=> (option 'trs-file #f) (cut open-file <> "wl"))) - (out (duplicate-port (current-output-port) "wl")) - (test-name (option 'test-name #f)) - (color-tests (if (assoc 'color-tests opts) - (option->boolean opts 'color-tests) - #t))) + (let* ((log (and=> (option 'log-file #f) (cut open-file <> "w0"))) + (trs (and=> (option 'trs-file #f) (cut open-file <> "wl"))) + (out (duplicate-port (current-output-port) "wl")) + (test-name (option 'test-name #f)) + (select (option 'select #f)) + (exclude (option 'exclude #f)) + (test-specifiers (filter-map + identity + (list (and=> select test-match-name*) + (and=> exclude test-match-name*/negated)))) + (test-specifier (apply %test-match-all test-specifiers)) + (color-tests (if (assoc 'color-tests opts) + (option->boolean opts 'color-tests) + #t))) (when log (redirect-port log (current-output-port)) (redirect-port log (current-warning-port)) @@ -176,7 +226,9 @@ void port, which means no TRS output is logged." #:color? color-tests #:brief? (option->boolean opts 'brief) #:out-port out #:trs-port trs) - (load-from-path test-name)) + (test-apply test-specifier + (lambda _ + (load-from-path test-name)))) (and=> log close-port) (and=> trs close-port) (close-port out)))) diff --git a/doc/guix.texi b/doc/guix.texi index aca4657d6a..b58fdad282 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -921,6 +921,18 @@ the @code{SCM_LOG_DRIVER_FLAGS} makefile variable as in this example: make check TESTS="tests/base64.scm" SCM_LOG_DRIVER_FLAGS="--brief=no" @end example +The underlying SRFI 64 custom Automake test driver used for the 'check' +test suite (located at @file{build-aux/test-driver.scm}) also allows +selecting which test cases to run at a finer level, via its +@option{--select} and @option{--exclude} options. Here's an example, to +run all the test cases from the @file{tests/packages.scm} test file +whose names start with ``transaction-upgrade-entry'': + +@example +export SCM_LOG_DRIVER_FLAGS="--select=^transaction-upgrade-entry" +make check TESTS="tests/packages.scm" +@end example + Upon failure, please email @email{bug-guix@@gnu.org} and attach the @file{test-suite.log} file. Please specify the Guix version being used as well as version numbers of the dependencies (@pxref{Requirements}) in -- cgit 1.4.1 From 93a628c4e4f4a7f6665190f3c52a417daebaf28a Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Mon, 18 Jan 2021 00:19:06 -0500 Subject: build: test-driver.scm: Add a new '--errors-only' option. * build-aux/test-driver.scm (show-help): Add the help text for the new '--errors-only' option. (%options): Add the errors-only option. (test-runner-gnu): Add the errors-only? parameter and update doc. Move the logging of the test data after the test has completed, so a choice can be made whether to keep it or discard it based on the value of the test result. (main): Pass the errors-only? option to the driver. * doc/guix.texi (Running the Test Suite): Document the new option. --- build-aux/test-driver.scm | 75 +++++++++++++++++++++++++++-------------------- doc/guix.texi | 12 ++++++++ 2 files changed, 55 insertions(+), 32 deletions(-) (limited to 'doc') diff --git a/build-aux/test-driver.scm b/build-aux/test-driver.scm index 2a5362a9fb..763ba457d8 100644 --- a/build-aux/test-driver.scm +++ b/build-aux/test-driver.scm @@ -36,12 +36,15 @@ (display "Usage: test-driver --test-name=NAME --log-file=PATH --trs-file=PATH [--expect-failure={yes|no}] [--color-tests={yes|no}] - [--select=REGEXP] [--exclude=REGEXP] + [--select=REGEXP] [--exclude=REGEXP] [--errors-only={yes|no}] [--enable-hard-errors={yes|no}] [--brief={yes|no}}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] The '--test-name' option is mandatory. The '--select' and '--exclude' options -allow selecting or excluding individual test cases via a regexp, -respectively.\n")) +allow selecting or excluding individual test cases via a regexp, respectively. +The '--errors-only' option can be set to \"yes\" to limit the logged test case +metadata to only those test cases that failed. When set to \"yes\", the +'--brief' option disables printing the individual test case result to the +console.\n")) (define %options '((test-name (value #t)) @@ -49,6 +52,7 @@ respectively.\n")) (trs-file (value #t)) (select (value #t)) (exclude (value #t)) + (errors-only (value #t)) (color-tests (value #t)) (expect-failure (value #t)) ;XXX: not implemented yet (enable-hard-errors (value #t)) ;not implemented in SRFI-64 @@ -88,27 +92,26 @@ respectively.\n")) ;;; SRFI 64 custom test runner. ;;; -(define* (test-runner-gnu test-name #:key color? brief? +(define* (test-runner-gnu test-name #:key color? brief? errors-only? (out-port (current-output-port)) (trs-port (%make-void-port "w")) select exclude) "Return an custom SRFI-64 test runner. TEST-NAME is a string specifying the -file name of the current the test. COLOR? specifies whether to use colors, -and BRIEF?, well, you know. OUT-PORT and TRS-PORT must be output ports. -OUT-PORT defaults to the current output port, while TRS-PORT defaults to a -void port, which means no TRS output is logged. SELECT and EXCLUDE may take a -regular expression to select or exclude individual test cases based on their -names." - - (define (test-on-test-begin-gnu runner) - ;; Procedure called at the start of an individual test case, before the - ;; test expression (and expected value) are evaluated. - (let ((result (cute assq-ref (test-result-alist runner) <>))) - (format #t "test-name: ~A~%" (result 'test-name)) - (format #t "location: ~A~%" - (string-append (result 'source-file) ":" - (number->string (result 'source-line)))) - (test-display "source" (result 'source-form) #:pretty? #t))) +file name of the current the test. COLOR? specifies whether to use colors. +When BRIEF? is true, the individual test cases results are masked and only the +summary is shown. ERRORS-ONLY? reduces the amount of test case metadata +logged to only that of the failed test cases. OUT-PORT and TRS-PORT must be +output ports. OUT-PORT defaults to the current output port, while TRS-PORT +defaults to a void port, which means no TRS output is logged. SELECT and +EXCLUDE may take a regular expression to select or exclude individual test +cases based on their names." + + (define (test-skipped? runner) + (eq? 'skip (test-result-kind runner))) + + (define (test-failed? runner) + (not (or (test-passed? runner) + (test-skipped? runner)))) (define (test-on-test-end-gnu runner) ;; Procedure called at the end of an individual test case, when the result @@ -116,21 +119,29 @@ names." (let* ((results (test-result-alist runner)) (result? (cut assq <> results)) (result (cut assq-ref results <>))) - (unless brief? + (unless (or brief? (and errors-only? (test-skipped? runner))) ;; Display the result of each test case on the console. (format out-port "~A: ~A - ~A~%" (result->string (test-result-kind runner) #:colorize? color?) test-name (test-runner-test-name runner))) - (when (result? 'expected-value) - (test-display "expected-value" (result 'expected-value))) - (when (result? 'expected-error) - (test-display "expected-error" (result 'expected-error) #:pretty? #t)) - (when (result? 'actual-value) - (test-display "actual-value" (result 'actual-value))) - (when (result? 'actual-error) - (test-display "actual-error" (result 'actual-error) #:pretty? #t)) - (format #t "result: ~a~%" (result->string (result 'result-kind))) - (newline) + + (unless (and errors-only? (not (test-failed? runner))) + (format #t "test-name: ~A~%" (result 'test-name)) + (format #t "location: ~A~%" + (string-append (result 'source-file) ":" + (number->string (result 'source-line)))) + (test-display "source" (result 'source-form) #:pretty? #t) + (when (result? 'expected-value) + (test-display "expected-value" (result 'expected-value))) + (when (result? 'expected-error) + (test-display "expected-error" (result 'expected-error) #:pretty? #t)) + (when (result? 'actual-value) + (test-display "actual-value" (result 'actual-value))) + (when (result? 'actual-error) + (test-display "actual-error" (result 'actual-error) #:pretty? #t)) + (format #t "result: ~a~%" (result->string (result 'result-kind))) + (newline)) + (format trs-port ":test-result: ~A ~A~%" (result->string (test-result-kind runner)) (test-runner-test-name runner)))) @@ -157,7 +168,6 @@ names." #f)) (let ((runner (test-runner-null))) - (test-runner-on-test-begin! runner test-on-test-begin-gnu) (test-runner-on-test-end! runner test-on-test-end-gnu) (test-runner-on-group-end! runner test-on-group-end-gnu) (test-runner-on-bad-end-name! runner test-on-bad-end-name-simple) @@ -225,6 +235,7 @@ names." (test-runner-gnu test-name #:color? color-tests #:brief? (option->boolean opts 'brief) + #:errors-only? (option->boolean opts 'errors-only) #:out-port out #:trs-port trs) (test-apply test-specifier (lambda _ diff --git a/doc/guix.texi b/doc/guix.texi index b58fdad282..7393cc8ecd 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -933,6 +933,18 @@ export SCM_LOG_DRIVER_FLAGS="--select=^transaction-upgrade-entry" make check TESTS="tests/packages.scm" @end example +Those wishing to inspect the results of failed tests directly from the +command line can add the @option{--errors-only=yes} option to the +@code{SCM_LOG_DRIVER_FLAGS} makefile variable and set the @code{VERBOSE} +Automake makefile variable, as in: + +@example +make check SCM_LOG_DRIVER_FLAGS="--brief=no --errors-only=yes" VERBOSE=1 +@end example + +@xref{Parallel Test Harness,,,automake,GNU Automake} for more +information about the Automake Parallel Test Harness. + Upon failure, please email @email{bug-guix@@gnu.org} and attach the @file{test-suite.log} file. Please specify the Guix version being used as well as version numbers of the dependencies (@pxref{Requirements}) in -- cgit 1.4.1 From 9fd7b050e2198c89f0763fe79f5c541b77b8e5c9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 10 Jan 2021 15:50:30 +0100 Subject: guix package: Add '--export-manifest'. * guix/scripts/package.scm (export-manifest): New procedure. (show-help, %options): Add '--export-manifest'. (process-query): Honor it. * guix/build/profiles.scm (build-profile): Mention it. * tests/guix-package.sh: Test it. * doc/guix.texi (Invoking guix package): Document it. --- doc/guix.texi | 21 ++++++++++++++++++ guix/build/profiles.scm | 6 +++-- guix/scripts/package.scm | 57 +++++++++++++++++++++++++++++++++++++++++++++++- tests/guix-package.sh | 10 ++++++++- 4 files changed, 90 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 7393cc8ecd..e5872b5f24 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3294,6 +3294,9 @@ objects, like this: '("emacs" "guile@@2.2" "guile@@2.2:debug")) @end lisp +@xref{export-manifest, @option{--export-manifest}}, to learn how to +obtain a manifest file from an existing profile. + @item --roll-back @cindex rolling back @cindex undoing transactions @@ -3596,6 +3599,24 @@ zeroth generation is never deleted. Note that deleting generations prevents rolling back to them. Consequently, this command must be used with care. +@cindex manifest, exporting +@anchor{export-manifest} +@item --export-manifest +Write to standard output a manifest suitable for @option{--manifest} +corresponding to the chosen profile(s). + +This option is meant to help you migrate from the ``imperative'' +operating mode---running @command{guix install}, @command{guix upgrade}, +etc.---to the declarative mode that @option{--manifest} offers. + +Be aware that the resulting manifest @emph{approximates} what your +profile actually contains; for instance, depending on how your profile +was created, it can refer to packages or package versions that are not +exactly what you specified. + +Keep in mind that a manifest is purely symbolic: it only contains +package names and possibly versions, and their meaning varies over time. + @end table Finally, since @command{guix package} may actually start build diff --git a/guix/build/profiles.scm b/guix/build/profiles.scm index 67ee9b665a..b42f498a80 100644 --- a/guix/build/profiles.scm +++ b/guix/build/profiles.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -169,7 +169,9 @@ SEARCH-PATHS." (lambda (p) (display "\ ;; This file was automatically generated and is for internal use only. -;; It cannot be passed to the '--manifest' option.\n\n" +;; It cannot be passed to the '--manifest' option. +;; Run 'guix package --export-manifest' if to export a file suitable +;; for '--manifest'.\n\n" p) (pretty-print manifest p))) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 6faf2adb7a..2b52016c67 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2013 Nikita Karetnikov ;;; Copyright © 2013, 2015 Mark H Weaver ;;; Copyright © 2014, 2016 Alex Kost @@ -48,6 +48,7 @@ #:select (directory-exists? mkdir-p)) #:use-module (ice-9 format) #:use-module (ice-9 match) + #:autoload (ice-9 pretty-print) (pretty-print) #:use-module (ice-9 regex) #:use-module (ice-9 vlist) #:use-module (srfi srfi-1) @@ -320,6 +321,48 @@ GUIX_PROFILE=\"~a\" Alternately, see @command{guix package --search-paths -p ~s}.") profile profile))))) + +;;; +;;; Export a manifest. +;;; + +(define* (export-manifest manifest + #:optional (port (current-output-port))) + "Write to PORT a manifest corresponding to MANIFEST." + (define (version-spec entry) + (let ((name (manifest-entry-name entry))) + (match (map package-version (find-packages-by-name name)) + ((_) + ;; A single version of NAME is available, so do not specify the + ;; version number, even if the available version doesn't match ENTRY. + "") + (versions + ;; If ENTRY uses the latest version, don't specify any version. + ;; Otherwise return the shortest unique version prefix. Note that + ;; this is based on the currently available packages, which could + ;; differ from the packages available in the revision that was used + ;; to build MANIFEST. + (let ((current (manifest-entry-version entry))) + (if (every (cut version>? current <>) + (delete current versions)) + "" + (version-unique-prefix (manifest-entry-version entry) + versions))))))) + + (match (manifest->code manifest + #:entry-package-version version-spec) + (('begin exp ...) + (format port (G_ "\ +;; This \"manifest\" file can be passed to 'guix package -m' to reproduce +;; the content of your profile. This is \"symbolic\": it only specifies +;; package names. To reproduce the exact same profile, you also need to +;; capture the channels being used, as returned by \"guix describe\". +;; See the \"Replicating Guix\" section in the manual.\n")) + (for-each (lambda (exp) + (newline port) + (pretty-print exp port)) + exp)))) + ;;; ;;; Command-line options. @@ -373,6 +416,8 @@ Install, remove, or upgrade packages in a single transaction.\n")) (display (G_ " -S, --switch-generation=PATTERN switch to a generation matching PATTERN")) + (display (G_ " + --export-manifest print a manifest for the chosen profile")) (display (G_ " -p, --profile=PROFILE use PROFILE instead of the user's default profile")) (display (G_ " @@ -507,6 +552,10 @@ kind of search path~%") (values (cons `(query search-paths ,kind) result) #f)))) + (option '("export-manifest") #f #f + (lambda (opt name arg result arg-handler) + (values (cons `(query export-manifest) result) + #f))) (option '(#\p "profile") #t #f (lambda (opt name arg result arg-handler) (values (alist-cons 'profile (canonicalize-profile arg) @@ -827,6 +876,12 @@ processed, #f otherwise." (format #t "~{~a~%~}" settings) #t)) + (('export-manifest) + (let* ((manifest (concatenate-manifests + (map profile-manifest profiles)))) + (export-manifest manifest (current-output-port)) + #t)) + (_ #f)))) diff --git a/tests/guix-package.sh b/tests/guix-package.sh index 3e5fa71d20..7eaad6823f 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +# Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès # Copyright © 2013 Nikita Karetnikov # # This file is part of GNU Guix. @@ -395,6 +395,14 @@ EOF guix package --bootstrap -m "$module_dir/manifest.scm" guix package -I | grep guile test `guix package -I | wc -l` -eq 1 + +# Export a manifest, instantiate it, and make sure we get the same profile. +profile_directory="$(readlink -f "$default_profile")" +guix package --export-manifest > "$tmpfile" +guix package --rollback --bootstrap +guix package --bootstrap -m "$tmpfile" +test "$(readlink -f "$default_profile")" = "$profile_directory" + guix package --rollback --bootstrap # Applying two manifests. -- cgit 1.4.1 From aedbc5ff32a62f45aeed74c6833399a6cf2c22dc Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 10 Jan 2021 22:13:04 +0100 Subject: guix package: Add '--export-channels'. * guix/channels.scm (sexp->channel): Export. * guix/describe.scm: Use (guix channels). (manifest-entry-provenance): New procedure. * guix/scripts/package.scm (channel=?, export-channels): New procedures. (show-help, %options): Add '--export-channels'. (process-query): Honor it. * build-aux/build-self.scm (build-program)[select?]: Exclude (guix channels) to account for the (guix describe) change above. * doc/guix.texi (Invoking guix package): Document it. --- build-aux/build-self.scm | 3 +++ doc/guix.texi | 26 ++++++++++++++++++++- guix/channels.scm | 1 + guix/describe.scm | 34 +++++++++++++++++++++++++-- guix/scripts/package.scm | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 122 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm index 4b6e2bfae5..d5bc5fb46e 100644 --- a/build-aux/build-self.scm +++ b/build-aux/build-self.scm @@ -245,8 +245,11 @@ interface (FFI) of Guile.") "Return a program that computes the derivation to build Guix from SOURCE." (define select? ;; Select every module but (guix config) and non-Guix modules. + ;; Also exclude (guix channels): it is autoloaded by (guix describe), but + ;; only for peripheral functionality. (match-lambda (('guix 'config) #f) + (('guix 'channels) #f) (('guix _ ...) #t) (('gnu _ ...) #t) (_ #f))) diff --git a/doc/guix.texi b/doc/guix.texi index e5872b5f24..9e62da438e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3616,7 +3616,31 @@ exactly what you specified. Keep in mind that a manifest is purely symbolic: it only contains package names and possibly versions, and their meaning varies over time. - +If you wish to ``pin'' channels to the revisions that were used to build +the profile(s), see @option{--export-channels} below. + +@cindex pinning, channel revisions of a profile +@item --export-channels +Write to standard output the list of channels used by the chosen +profile(s), in a format suitable for @command{guix pull --channels} or +@command{guix time-machine --channels} (@pxref{Channels}). + +Together with @option{--export-manifest}, this option provides +information allowing you to replicate the current profile +(@pxref{Replicating Guix}). + +However, note that the output of this command @emph{approximates} what +was actually used to build this profile. In particular, a single +profile might have been built from several different revisions of the +same channel. In that case, @option{--export-manifest} chooses the last +one and writes the list of other revisions in a comment. If you really +need to pick packages from different channel revisions, you can use +inferiors in your manifest to do so (@pxref{Inferiors}). + +Together with @option{--export-manifest}, this is a good starting point +if you are willing to migrate from the ``imperative'' model to the fully +declarative model consisting of a manifest file along with a channels +file pinning the exact channel revision(s) you want. @end table Finally, since @command{guix package} may actually start build diff --git a/guix/channels.scm b/guix/channels.scm index cdef77637d..e7e1eb6fd0 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -92,6 +92,7 @@ profile-channels manifest-entry-channel + sexp->channel channel->code channel-news-entry? diff --git a/guix/describe.scm b/guix/describe.scm index 05bf99eb58..ac89fc0d7c 100644 --- a/guix/describe.scm +++ b/guix/describe.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2018, 2019, 2020, 2021 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +23,7 @@ #:use-module ((guix utils) #:select (location-file)) #:use-module ((guix store) #:select (%store-prefix store-path?)) #:use-module ((guix config) #:select (%state-directory)) + #:autoload (guix channels) (sexp->channel) #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:export (current-profile @@ -31,7 +32,8 @@ package-path-entries package-provenance - manifest-entry-with-provenance)) + manifest-entry-with-provenance + manifest-entry-provenance)) ;;; Commentary: ;;; @@ -166,3 +168,31 @@ there." (#f properties) (sexp `((provenance ,@sexp) ,@properties))))))))) + +(define (manifest-entry-provenance entry) + "Return the list of channels ENTRY comes from. Return the empty list if +that information is missing." + (match (assq-ref (manifest-entry-properties entry) 'provenance) + ((main extras ...) + ;; XXX: Until recently, channel sexps lacked the channel name. For + ;; entries created by 'manifest-entry-with-provenance', the first sexp + ;; is known to be the 'guix channel, and for the other ones, invent a + ;; fallback name (it's OK as the name is just a "pet name"). + (match (sexp->channel main 'guix) + (#f '()) + (channel + (let loop ((extras extras) + (counter 1) + (channels (list channel))) + (match extras + (() + (reverse channels)) + ((head . tail) + (let* ((name (string->symbol + (format #f "channel~a" counter))) + (extra (sexp->channel head name))) + (if extra + (loop tail (+ 1 counter) (cons extra channels)) + (loop tail counter channels))))))))) + (_ + '()))) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 2b52016c67..8234a1703d 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -43,6 +43,7 @@ #:use-module (guix scripts build) #:use-module (guix transformations) #:use-module (guix describe) + #:autoload (guix channels) (channel-name channel-commit channel->code) #:autoload (guix store roots) (gc-roots user-owned?) #:use-module ((guix build utils) #:select (directory-exists? mkdir-p)) @@ -363,6 +364,54 @@ Alternately, see @command{guix package --search-paths -p ~s}.") (pretty-print exp port)) exp)))) +(define (channel=? a b) + (and (channel-commit a) (channel-commit b) + (string=? (channel-commit a) (channel-commit b)))) + +(define* (export-channels manifest + #:optional (port (current-output-port))) + (define channels + (delete-duplicates + (append-map manifest-entry-provenance (manifest-entries manifest)) + channel=?)) + + (define channel-names + (delete-duplicates (map channel-name channels))) + + (define table + (fold (lambda (channel table) + (vhash-consq (channel-name channel) channel table)) + vlist-null + channels)) + + (when (null? channels) + (leave (G_ "no provenance information for this profile~%"))) + + (format port (G_ "\ +;; This channel file can be passed to 'guix pull -C' or to +;; 'guix time-machine -C' to obtain the Guix revision that was +;; used to populate this profile.\n")) + (newline port) + (display "(list\n" port) + (for-each (lambda (name) + (define indent " ") + (match (vhash-foldq* cons '() name table) + ((channel extra ...) + (unless (null? extra) + (display indent port) + (format port (G_ "\ +;; Note: these other commits were also used to install \ +some of the packages in this profile:~%")) + (for-each (lambda (channel) + (format port "~a;; ~s~%" + indent (channel-commit channel))) + extra)) + (pretty-print (channel->code channel) port + #:per-line-prefix indent)))) + channel-names) + (display ")\n" port) + #t) + ;;; ;;; Command-line options. @@ -418,6 +467,8 @@ Install, remove, or upgrade packages in a single transaction.\n")) switch to a generation matching PATTERN")) (display (G_ " --export-manifest print a manifest for the chosen profile")) + (display (G_ " + --export-channels print channels for the chosen profile")) (display (G_ " -p, --profile=PROFILE use PROFILE instead of the user's default profile")) (display (G_ " @@ -556,6 +607,10 @@ kind of search path~%") (lambda (opt name arg result arg-handler) (values (cons `(query export-manifest) result) #f))) + (option '("export-channels") #f #f + (lambda (opt name arg result arg-handler) + (values (cons `(query export-channels) result) + #f))) (option '(#\p "profile") #t #f (lambda (opt name arg result arg-handler) (values (alist-cons 'profile (canonicalize-profile arg) @@ -882,6 +937,12 @@ processed, #f otherwise." (export-manifest manifest (current-output-port)) #t)) + (('export-channels) + (let ((manifest (concatenate-manifests + (map profile-manifest profiles)))) + (export-channels manifest (current-output-port)) + #t)) + (_ #f)))) -- cgit 1.4.1 From 847c816ddd3a38c865da460cb7b22cf665db162f Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Mon, 1 Feb 2021 01:49:00 +0300 Subject: doc: Explain how to set custom Shepherd package. * doc/guix.texi (Shepherd Services): Give example on how to set custom Shepherd package. --- doc/guix.texi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 9e62da438e..beff276f9d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -32895,6 +32895,25 @@ mechanism instead (@pxref{Shepherd Services}). @end table @end deftp +The following example specifies the Shepherd package for the operating +system: + +@lisp +(operating-system + ;; ... + (services (append (list openssh-service-type)) + ;; ... + %desktop-services) + ;; ... + ;; Use own Shepherd package. + (essential-services + (modify-services (operating-system-default-essential-services + this-operating-system) + (shepherd-root-service-type config => (shepherd-configuration + (inherit config) + (shepherd my-shepherd)))))) +@end lisp + @defvr {Scheme Variable} %shepherd-root-service This service represents PID@tie{}1. @end defvr -- cgit 1.4.1 From 5e652e94a9203e0cfa27e93a89878439b7900001 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Tue, 2 Feb 2021 00:28:49 -0500 Subject: build: Add a --show-duration option to the SCM test-driver. * build-aux/test-driver.scm (script-version): Update. (show-help): Document it. (%options): Add the 'show-duration' option. (test-runner-gnu): Pass as a new argument. [test-cases-start-time]: New inner variable. [test-on-test-begin-gnu]: New hook, used to record the start time. [test-on-test-end-gnu]: Conditionally print elapsed time. Record it as the optional metadata in the test result file (.trs). * doc/guix.texi (Running the Test Suite): Document it. --- build-aux/test-driver.scm | 43 ++++++++++++++++++++++++++++++++++--------- doc/guix.texi | 10 +++++++++- 2 files changed, 43 insertions(+), 10 deletions(-) (limited to 'doc') diff --git a/build-aux/test-driver.scm b/build-aux/test-driver.scm index ac21783d41..1cdd4ff8f7 100755 --- a/build-aux/test-driver.scm +++ b/build-aux/test-driver.scm @@ -3,7 +3,7 @@ exec guile --no-auto-compile -e main -s "$0" "$@" !# ;;;; test-driver.scm - Guile test driver for Automake testsuite harness -(define script-version "2021-01-26.20") ;UTC +(define script-version "2021-02-02.05") ;UTC ;;; Copyright © 2015, 2016 Mathieu Lirzin ;;; Copyright © 2021 Maxim Cournoyer @@ -28,10 +28,12 @@ exec guile --no-auto-compile -e main -s "$0" "$@" ;;; ;;;; Code: -(use-modules (ice-9 getopt-long) +(use-modules (ice-9 format) + (ice-9 getopt-long) (ice-9 pretty-print) (ice-9 regex) (srfi srfi-1) + (srfi srfi-19) (srfi srfi-26) (srfi srfi-64)) @@ -40,14 +42,16 @@ exec guile --no-auto-compile -e main -s "$0" "$@" test-driver --test-name=NAME --log-file=PATH --trs-file=PATH [--expect-failure={yes|no}] [--color-tests={yes|no}] [--select=REGEXP] [--exclude=REGEXP] [--errors-only={yes|no}] - [--enable-hard-errors={yes|no}] [--brief={yes|no}}] [--] + [--enable-hard-errors={yes|no}] [--brief={yes|no}}] + [--show-duration={yes|no}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] The '--test-name' option is mandatory. The '--select' and '--exclude' options allow selecting or excluding individual test cases via a regexp, respectively. The '--errors-only' option can be set to \"yes\" to limit the logged test case metadata to only those test cases that failed. When set to \"yes\", the '--brief' option disables printing the individual test case result to the -console.\n")) +console. When '--show-duration' is set to \"yes\", the time elapsed per test +case is shown.\n")) (define %options '((test-name (value #t)) @@ -60,6 +64,7 @@ console.\n")) (expect-failure (value #t)) ;XXX: not implemented yet (enable-hard-errors (value #t)) ;not implemented in SRFI-64 (brief (value #t)) + (show-duration (value #t)) (help (single-char #\h) (value #f)) (version (single-char #\V) (value #f)))) @@ -96,6 +101,7 @@ console.\n")) ;;; (define* (test-runner-gnu test-name #:key color? brief? errors-only? + show-duration? (out-port (current-output-port)) (trs-port (%make-void-port "w")) select exclude) @@ -109,6 +115,15 @@ defaults to a void port, which means no TRS output is logged. SELECT and EXCLUDE may take a regular expression to select or exclude individual test cases based on their names." + (define test-cases-start-time (make-hash-table)) + + (define (test-on-test-begin-gnu runner) + ;; Procedure called at the start of an individual test case, before the + ;; test expression (and expected value) are evaluated. + (let ((test-case-name (test-runner-test-name runner)) + (start-time (current-time time-monotonic))) + (hash-set! test-cases-start-time test-case-name start-time))) + (define (test-skipped? runner) (eq? 'skip (test-result-kind runner))) @@ -121,12 +136,19 @@ cases based on their names." ;; of the test is available. (let* ((results (test-result-alist runner)) (result? (cut assq <> results)) - (result (cut assq-ref results <>))) + (result (cut assq-ref results <>)) + (test-case-name (test-runner-test-name runner)) + (start (hash-ref test-cases-start-time test-case-name)) + (end (current-time time-monotonic)) + (time-elapsed (time-difference end start)) + (time-elapsed-seconds (+ (time-second time-elapsed) + (* 1e-9 (time-nanosecond time-elapsed))))) (unless (or brief? (and errors-only? (test-skipped? runner))) ;; Display the result of each test case on the console. - (format out-port "~A: ~A - ~A~%" + (format out-port "~a: ~a - ~a ~@[[~,3fs]~]~%" (result->string (test-result-kind runner) #:colorize? color?) - test-name (test-runner-test-name runner))) + test-name test-case-name + (and show-duration? time-elapsed-seconds))) (unless (and errors-only? (not (test-failed? runner))) (format #t "test-name: ~A~%" (result 'test-name)) @@ -145,9 +167,9 @@ cases based on their names." (format #t "result: ~a~%" (result->string (result 'result-kind))) (newline)) - (format trs-port ":test-result: ~A ~A~%" + (format trs-port ":test-result: ~A ~A [~,3fs]~%" (result->string (test-result-kind runner)) - (test-runner-test-name runner)))) + (test-runner-test-name runner) time-elapsed-seconds))) (define (test-on-group-end-gnu runner) ;; Procedure called by a 'test-end', including at the end of a test-group. @@ -171,6 +193,7 @@ cases based on their names." #f)) (let ((runner (test-runner-null))) + (test-runner-on-test-begin! runner test-on-test-begin-gnu) (test-runner-on-test-end! runner test-on-test-end-gnu) (test-runner-on-group-end! runner test-on-group-end-gnu) (test-runner-on-bad-end-name! runner test-on-bad-end-name-simple) @@ -239,6 +262,8 @@ cases based on their names." #:color? color-tests #:brief? (option->boolean opts 'brief) #:errors-only? (option->boolean opts 'errors-only) + #:show-duration? (option->boolean + opts 'show-duration) #:out-port out #:trs-port trs) (test-apply test-specifier (lambda _ diff --git a/doc/guix.texi b/doc/guix.texi index beff276f9d..598d3d6773 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -48,7 +48,7 @@ Copyright @copyright{} 2017 humanitiesNerd@* Copyright @copyright{} 2017 Christopher Allan Webber@* Copyright @copyright{} 2017, 2018, 2019, 2020 Marius Bakke@* Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@* -Copyright @copyright{} 2017, 2019, 2020 Maxim Cournoyer@* +Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@* Copyright @copyright{} 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice@* Copyright @copyright{} 2017 George Clemmer@* Copyright @copyright{} 2017 Andy Wingo@* @@ -942,6 +942,14 @@ Automake makefile variable, as in: make check SCM_LOG_DRIVER_FLAGS="--brief=no --errors-only=yes" VERBOSE=1 @end example +The @option{--show-duration=yes} option can be used to print the +duration of the individual test cases, when used in combination with +@option{--brief=no}: + +@example +make check SCM_LOG_DRIVER_FLAGS="--brief=no --show-duration=yes" +@end example + @xref{Parallel Test Harness,,,automake,GNU Automake} for more information about the Automake Parallel Test Harness. -- cgit 1.4.1 From 0319f9fac2fcbb93219d4ee4eab6e476907f8cae Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Tue, 2 Feb 2021 11:08:12 +1100 Subject: services: postgresql: Update documented socket directory to match code. This is a follow-up of 6c0679215f4ffa534c1eb2e8c8a6e043a0c993fe. * doc/guix.texi (Database Services): Update it. Signed-off-by: Mathieu Othacehe --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 598d3d6773..e0f6921a90 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19539,7 +19539,7 @@ configuration. @item @code{ident-file} (default: @code{%default-postgres-ident}) Filename or G-expression for the user name mapping configuration. -@item @code{socket-directory} (default: @code{"/var/lib/postgresql"}) +@item @code{socket-directory} (default: @code{"/var/run/postgresql"}) Specifies the directory of the Unix-domain socket(s) on which PostgreSQL is to listen for connections from client applications. If set to @code{#false} PostgreSQL does not listen on any Unix-domain sockets, in -- cgit 1.4.1