summaryrefslogtreecommitdiff
path: root/guix/scripts
AgeCommit message (Collapse)Author
2021-03-10Revert "inferior: Break cached-channel-instance into two procedures."Mathieu Othacehe
This reverts commit 7d63b775513e7049047222dbe403a4181f63828d because it raises some concerns, see: https://lists.gnu.org/archive/html/guix-devel/2021-03/msg00124.html.
2021-03-10inferior: Break cached-channel-instance into two procedures.Mathieu Othacehe
Break cached-channel-instance into two different procedures: channels->cached-profile and instances->cached-profile operating respectively on channels and channels instances. * guix/inferior.scm (cached-channel-instance): Rename it into ... (cached-profile): ... this new procedure. (channels->cached-profile, instances->cached-profile): New procedures. * guix/scripts/time-machine.scm (guix-time-machine): Adapt accordingly.
2021-03-09weather: Call lookup-narinfos with a custom progress reporter.Christopher Baines
This means there's a useful progress bar when running guix weather. * guix/scripts/weather.scm (report-server-coverage): Pass #:make-progress-reporter to lookup-narinfos.
2021-03-09guix: substitutes: Make progress reporting configurable.Christopher Baines
Rather than always outputting to (current-error-port) in lookup-narinfos (which is called from within lookup-narinfos/diverse), take a procedure which should return a progress reporter, and defer any output to that. As this is now general purpose code, make the default behaviour to output nothing. Maintain the current behaviour of the substitute script by moving the progress reporter implementation there, and passing it in when calling lookup-narinfos/diverse. These changes should be generally useful, but I'm particularly looking at getting guix weather to do progress reporting differently, with this new flexibility. * guix/substitutes.scm (fetch-narinfos): Take a procedure to make a progress-reporter, and use that rather than the hardcoded behaviour. (lookup-narinfos): Add #:make-progress-reporter keyword argument, and pass this through to fetch-narinfos. (lookup-narinfos/diverse): Add a #:make-progress-reporter keyword argument, and pass this through to lookup-narinfos. * guix/scripts/substitute.scm (process-query): Pass a progress-reporter to lookup-narinfos/diverse.
2021-03-09scripts: system: Activate system when switching generations.Brice Waegeneire
Fixes <https://bugs.gnu.org/38884>. * guix/scripts/system.scm (switch-to-system-generation): Load the activate script for that generation. squash! scripts: system: Activate system when switching generations.
2021-03-05guix: Split (guix substitutes) from (guix scripts substitute).Christopher Baines
This means there's a module for working with substitutes, rather than all the code sitting in the script. The need for this can be seen with the weather and challenge scripts, that now don't have to use code from the substitute script, but can instead use the substitute module. The separation here between the actual functionality of the substitute script and the underlying functionality used both there and elsewhere should make maintenance easier moving forward. This commit just moves code, none of the code should have been changed significantly. * guix/scripts/substitute.scm (%narinfo-cache-directory, %narinfo-ttl, %narinfo-negative-ttl, %narinfo-transient-error-ttl, %unreachable-hosts): Move variables to guix/substitutes.scm. (narinfo-cache-file, cached-narinfo, cache-narinfo!, narinfo-request, read-to-eof, call-with-connection-error-handling, fetch-narinfos, lookup-narinfos, lookup-narinfos/diverse): Move procedures to guix/substitutes.scm. * guix/substitutes.scm: New file. * Makefile.am: Add it. * guix/narinfo.scm: Remove redundant module. * guix/scripts/challenge.scm: Change (guix scripts substitute) to (guix substitutes). * guix/scripts/weather.scm: Change (guix scripts substitute) to (guix substitutes).
2021-03-05pull: Expand help text for --{url,commit,branch}.Tobias Geerinckx-Rice
* guix/scripts/pull.scm (show-help): Document that ‘--url’, ‘--commit’, and ‘--branch’ affect only the ‘guix’ channel (for now?).
2021-03-05profiles: 'package->manifest-entry' preserves transformations by default.Ludovic Courtès
Previously, transformations applied from a manifest (rather than via "guix install") would be lost. This change fixes that and simplifies things. Reported by zimoun at <https://lists.gnu.org/archive/html/guix-devel/2021-02/msg00153.html>. * guix/profiles.scm (default-properties): New procedure. (package->manifest-entry): Use it for #:properties. * guix/scripts/pack.scm (guix-pack)[with-transformations]: Remove. Remove caller. * guix/scripts/package.scm (transaction-upgrade-entry): Remove calls to 'manifest-entry-with-transformations'. * tests/guix-package.sh: Add test. * tests/transformations.scm ("options->transformation + package->manifest-entry"): New test.
2021-03-01environment: Allow compilation with Guile 2.2.Ludovic Courtès
Fixes <https://bugs.gnu.org/46826>. Reported by cage <cage-dev@twistfold.it>. * guix/scripts/environment.scm (guix-environment): Move 'manifest' definition before expression.
2021-02-24substitute: Ensure backtraces go to file descriptor 4.Ludovic Courtès
Fixes <https://bugs.gnu.org/46362>. Reported by Zhu Zihao <all_but_last@163.com>. Previously, backtraces due to uncaught exceptions would always to go file descriptor 2; the daemon would read it and error out with something like: error: got unexpected path `Backtrace:' from substituter This patch fixes that by ensuring backtraces are properly displayed on file descriptor 4. * guix/scripts/substitute.scm (with-redirected-error-port): New macro. (guix-substitute): Use 'with-redirected-error-port' instead of 'parameterize'.
2021-02-24substitute: Do not unwind stack traces upon uncaught exceptions.Ludovic Courtès
This is similar to commit a168c3e4f8d580f70e1c26bcdfc5b8378b2fa42d. * guix/scripts/substitute.scm (with-networking): Use 'with-throw-handler' instead of 'catch'.
2021-02-22substitute: Rework connection error handling.Christopher Baines
This is part of trying to reduce the interdependency of code within the substitute module. This commit addresses some of the error handling that was performed through open-connection-for-uri/maybe. The new approach is to use call-with-connection-error-handling, and wrap calls to http-multiple-get and http-fetch with that procedure, which takes care of handling connection errors. I think this is even slightly more rigerous than the previous setup, because this approach handles connection errors that occur when http-multiple-get reconnects to a host. * guix/scripts/substitute.scm (open-connection-for-uri/maybe): Transform in to call-with-connection-error-handling. (fetch-narinfos): Use call-with-connection-error-handling. (process-query): Replace open-connection-for-uri/maybe with open-connection-for-uri/cached. (open-connection-for-uri/cached): Set a default timeout, matching the behaviour in open-connection-for-uri/maybe. (process-substitution): Use call-with-connection-error-handling.
2021-02-22substitute: Remove fetch-narinfos use open-connection-for-uri/maybe.Christopher Baines
At least by default. Instead, make the open-connection procedure a parameter, and make the default guix:open-connection-for-uri. Do so similarly for lookup-narinfos and lookup-narinfos/diverse which work towards calling fetch-narinfos. This means this code can be moved to a different module, without having use/move the connection caching code. * guix/scripts/substitute.scm (fetch-narinfos): Add #:open-connection argument, and call http-multiple-get with it. (lookup-narinfos) Add #:open-connection argument, and call fetch-narinfos with it. (lookup-narinfos/diverse): Add #:open-connection argument, and call lookup-narinfos with it. (process-query): Call lookup-narinfos/diverse with #:open-connection open-connection-for-uri/maybe.
2021-02-22substitute: Inline fetch in to process-substitutes.Christopher Baines
As it's only called in one place, and this should make the code easier to read. * guix/scripts/substitute.scm (fetch): Move procedure inside… (process-substitution): …here.
2021-02-22substitute: Remove redundant fetch arguments.Christopher Baines
It's just called in one place, with hardcoded argument values, so just inline them. * guix/scripts/substitute.scm (fetch): Remove arguments that don't vary, copy the values from the call site in process-substitution. (process-substitution): Remove unnecessary argument values from fetch call.
2021-02-22substitute: Remove now redundant connection caching helpers.Christopher Baines
Failures now should be handled where they occur, and if there's a problem that's symptomatic of an issue with the connection, the port should be closed. * guix/scripts/substitute.scm (call-with-cached-connection): Remove procedure. (with-cached-connection): Remove syntax rule.
2021-02-22substitute: Change connection cache handling in process-substitution.Christopher Baines
Just pass open-connection-for-uri/maybe to http-fetch, this removes the need for with-cached-connection and passing the port in. * guix/scripts/substitute.scm (fetch): Don't take a port as an argument, and pass open-connection-for-uri/maybe to http-fetch. (process-substitution): Don't call fetch with with-cached-connection.
2021-02-22substitute: Stop using call-with-cached-connection in fetch-narinfos.Christopher Baines
Instead, just pass open-connection-for-uri/maybe to http-multiple-get. This code should be functionaly similar to the previous code. The eventual aim of this is to make the connection caching not mandatory in fetch-narinfos. * guix/scripts/substitute.scm (fetch-narinfos): Remove use of call-with-cached-connection.
2021-02-22substitute: open-connection-for-uri/maybe add #:verify-certificate?.Christopher Baines
As this is used by http-fetch and http-multiple-get when they call the specified open connection procedure. * guix/scripts/substitute.scm (open-connection-for-uri/maybe): Support #:verify-certificate?.
2021-02-22guix: Move http-multiple-get to (guix http-client).Christopher Baines
From (guix scripts substitute). This will make it easier to reuse this code. * guix/scripts/substitute.scm (http-multiple-get): Remove, and move to… * guix/http-client.scm (http-multiple-get): …here.
2021-02-22substitute: Remove redundant let block from fetch.Christopher Baines
* guix/scripts/substitute.scm (fetch): Remove redundant let block.
2021-02-22substitute: Remove connection handling from fetch.Christopher Baines
http-fetch does this, so just use that code instead. * guix/scripts/substitute.scm (fetch): Remove connection handling when the port is closed.
2021-02-22substitute: Remove buffer handling from fetch.Christopher Baines
http-fetch does this, so just set the right option. * guix/scripts/substitute.scm (fetch): Remove buffering code, and pass #:buffered? to http-fetch.
2021-02-17scripts: system: Accept <image> records as input.Mathieu Othacehe
* guix/scripts/system.scm (system-derivation-for-action): Replace "os" argument by "image". Remove "image-size", "image-type", "label" and "volatile-root?" arguments. (perform-action): Ditto. (process-action): Construct the <image> record and pass it to "perform-action" procedure. * tests/guix-system.sh: Adapt accordingly. * gnu/system/images/hurd.scm: Return the default image. * gnu/system/images/novena.scm: Ditto. * gnu/system/images/pine64.scm: Ditto. * gnu/system/images/pinebook-pro.scm Ditto.
2021-02-17scripts: system: Remove 'vm-image' command.Mathieu Othacehe
Remove the 'vm-image' command that has been superseded by the 'image' command. * gnu/system/vm.scm (system-qemu-image): Remove it. * guix/scripts/system.scm (system-derivation-for-action): Mark 'vm-image' command as deprecated and use the image API to produce the VM image. (perform-action, show-help): Adapt accordingly. * tests/guix-system.sh: Ditto. * doc/guix.texi (Invoking guix system, Running Guix in a VM): Ditto. * etc/completion/fish/guix.fish: Ditto. * etc/completion/zsh/_guix: Ditto.
2021-02-12pull: Create the "${XDG_CONFIG_HOME}/guix" directory when needed.宋文武
This fixes <https://bugs.gnu.org/46269>. * guix/scripts/pull.scm (ensure-default-profile): Add a 'mkdir-p' call before 'symlink'.
2021-02-11environment: Allow starting from existing profile.Lars-Dominik Braun
* guix/scripts/environment.scm (%options): Add -p/--profile switch. (show-help): Document new switch. (guix-environment): Handle new 'profile switch. Signed-off-by: 宋文武 <iyzsong@member.fsf.org>
2021-02-05guix describe: 'display-profile-content' checks the right generation.Ludovic Courtès
Fixes a regression introduced in 316fc2acbb112bfa572ae30f95a93bcd56621234, whereby 'guix pull -l' would always display channel information corresponding to the latest profile generation. Reported by Vagrant Cascadian. * guix/scripts/describe.scm (profile-generation-channels): New procedure. (display-profile-content): Change default value of 'channels'.
2021-02-04channels: Record 'guix' channel metadata in (guix config).Ludovic Courtès
Partially fixes <https://bugs.gnu.org/45896>. * guix/config.scm.in (%channel-metadata): New variable. * guix/describe.scm (channel-metadata): Use it. (current-channels): New procedure. (current-profile-entries): Clarify docstring. * guix/self.scm (compiled-guix): Add #:channel-metadata and pass it to 'make-config.scm'. (make-config.scm): Add #:channel-metadata and define '%channel-metadata' in the generated file. (guix-derivation): Add #:channel-metadata and pass it to 'compiled-guix'. * guix/channels.scm (build-from-source): Replace 'name', 'source', and 'commit' parameters with 'instance'. Pass #:channel-metadata to BUILD. (build-channel-instance): Adjust accordingly. * build-aux/build-self.scm (build-program): Add #:channel-metadata and pass it to 'guix-derivation'. (build): Add #:channel-metadata and pass it to 'build-program'. * guix/scripts/describe.scm (display-profile-info): Add optional 'channels' parameter. Pass it to 'display-profile-content'. (display-profile-content): Add optional 'channels' parameter and honor it. Iterate on CHANNELS rather than on the manifest entries of PROFILE. (guix-describe): When PROFILE is #f, call 'current-channels' and pass it to 'display-profile-info', unless it returns the empty list.
2021-02-01guix package: Add '--export-channels'.Ludovic Courtès
* 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.
2021-02-01channels: Add 'channel->code'.Ludovic Courtès
* guix/channels.scm (channel->code): New procedure, taken from... * guix/scripts/describe.scm (channel->sexp): ... here. Adjust callers accordingly.
2021-02-01guix describe: Use 'manifest-entry-channel'.Ludovic Courtès
* guix/channels.scm (manifest-entry-channel): Export. * guix/scripts/describe.scm (display-profile-content): Use it.
2021-02-01guix package: Add '--export-manifest'.Ludovic Courtès
* 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.
2021-01-31scripts: import: json: Fix error handling.zimoun
Fixes partially <https://bugs.gnu.org/44115>. * guix/scripts/import/json.scm (guix-import-json): Handle error. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-01-31guix: channels: Introduce "channel-with-substitutes-available".Mathieu Othacehe
* 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.
2021-01-30guix system: Adjust 'upgrade-shepherd-services' to shepherd service change.Ludovic Courtès
Fixes a regression introduced in 95f72dcd7aece05e9252c93bef5a831f96cb5393. * guix/scripts/system/reconfigure.scm (upgrade-shepherd-services)[target-services]: Add call to 'shepherd-configuration-services'.
2021-01-30services: shepherd: Allow custom 'shepherd' package.Maxime Devos
* gnu/services/shepherd.scm (<shepherd-configuration>): 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 <ludo@gnu.org>
2021-01-21Revert "substitute: Remove extra 'newline' call."Ludovic Courtès
This reverts commit d5a1b0e86f248edd53c785b910b5d51ee708b0fc. This change turned out to be misguided; it would lead to "substitute:" lines being printed on the client side, without anything beyond the colon sign.
2021-01-20archive: Note service type in ACL hint.Tobias Geerinckx-Rice
* guix/scripts/archive.scm (authorize-key): Mention guix-service-type.
2021-01-19environment: Fix '--root' option with relative file name.JOULAUD François
The path normalization of `--root` option of `guix environment` was buggy as it appended full argument after normalized directory. This patch fixes it. * guix/scripts/environment.scm (register-gc-root): Fix gc-root path normalization. * tests/guix-environment.sh: Add test. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-01-19system: Rename 'disk-image' command 'image'.Mathieu Othacehe
* 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.
2021-01-17image: Rename "raw" image-type to "efi-raw".Mathieu Othacehe
* 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 <othacehe@gnu.org>
2021-01-16guix: Move narinfo code from substitute script to module.Christopher Baines
This separation between the code for dealing with narinfos from the code doing that for a purpose should make things clearer, and better support components other that the substitute script in using this code. This is just moving the code around, no code should have been significantly changed. * guix/scripts/substitute.scm (<narinfo>): Move record type to (guix narinfo). (fields->alist, narinfo-hash-algorithm+value, narinfo-hash->sha256, narinfo-signature->canonical-sexp, narinfo-maker, read-narinfo, narinfo-sha256, valid-narinfo?, write-narinfo, narinfo->string, string->narinfo, equivalent-narinfo?, supported-compression?, compresses-better?, narinfo-best-uri): Move procedures to (guix narinfo). (%compression-methods): Move variable to (guix narinfo). * guix/narinfo.scm: New file. * Makefile.am (MODULES): Add it. * po/guix/POTFILES.in: Add 'guix/narinfo.scm'.
2021-01-16substitute: Untangle skipping authentication from valid-narinfo?.Christopher Baines
Rather than having valid-narinfo? evaluate to #t if %allow-unauthenticated-substitutes? is set to #t, just use (const #t) for valid-narinfo? when %allow-unauthenticated-substitutes? is set to #t. This will allow moving valid-narinfo? in to a (guix substitutes) module. * guix/scripts/substitute.scm (process-query, process-substitution): Change the authorized? argument to lookup-narinfo and lookup-narinfos/diverse based on %allow-unauthenticated-substitutes?. (valid-narinfo?): Remove use of %allow-unauthenticated-substitutes?.
2021-01-13substitute: Add zstd support.Ludovic Courtès
* guix/scripts/substitute.scm (%compression-methods): Add zstd. (compresses-better?): "lzip" always wins.
2021-01-13publish: Add support for zstd compression.Ludovic Courtès
* 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.
2021-01-13substitute: Remove extra 'newline' call.Ludovic Courtès
This led to extra "substitute:" lines since commit 79c6614f58a57b985daf8940766319e440311db0 or thereabouts. * guix/scripts/substitute.scm (fetch-narinfos): Remove extra 'newline' call, which can be traced back to d3a652037ef879f9279bc056c43d15ba7afcbb25 (2015).
2021-01-04guix system: Add '--graph-backend'.Ludovic Courtès
* guix/scripts/system.scm (lookup-backend): New procedure. (export-extension-graph, export-shepherd-graph): Add #:backend parameter and honor it. (show-help, %options): Add "--graph-backend". (%default-options): Add 'graph-backend'. (process-action): Pass #:backend to 'export-extension-graph' and 'export-shepherd-graph'. * doc/guix.texi (Invoking guix system): Document '--graph-backend'.
2021-01-04environment: Remove unused modules.guy fleury iteriteka
* guix/scripts/environment.scm: Do not use (ice-9 format) and (ice-9 rdelim). Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-01-04substitute: Handle "invalid session" GnuTLS errors on reused connections.Ludovic Courtès
Reported by Christopher Baines <mail@cbaines.net> at <https://issues.guix.gnu.org/45323#2>. * guix/scripts/substitute.scm (call-with-cached-connection): Handle 'gnutls-error and ERROR/INVALID-SESSION.