summaryrefslogtreecommitdiff
path: root/guix/scripts
AgeCommit message (Collapse)Author
2019-07-11guix gc: Correctly handle '--delete-generations' with no arguments.Ludovic Courtès
Previously, 'guix gc --delete-generations' would crash: the "" pattern would be passed to 'matching-generations', which would return #f instead of returning a list. Reported by Raghav Gururajan <rvgn@disroot.org> in <https://bugs.gnu.org/36466>. * guix/ui.scm (matching-generations): Raise an error when passed an invalid pattern. * guix/scripts/gc.scm (delete-old-generations): Check if PATTERN is true. (%options): Leave ARG as-is for 'delete-generations'. (guix-gc): Use 'assq' instead of 'assoc-ref' for 'delete-generations'. * guix/scripts/package.scm (delete-matching-generations): Replace (string-null? pattern) with (not pattern). Remove 'else' clause. (%options): Leave ARG as-is for 'delete-generations'. * guix/scripts/pull.scm (%options): Leave ARG as-is for 'list-generations'. (process-query): Replace (string-null? pattern) with (not pattern). * guix/scripts/system.scm (list-generations): Likewise, and remove 'else' clause. (process-command): Use #f instead of "" when no pattern is given.
2019-07-08scripts: environment: Add --no-cwd.Carl Dong
* doc/guix.texi (Invoking guix environment): Add --no-cwd. * guix/scripts/environment.scm (show-help, %options): Add --no-cwd. (launch-environment/container): Add 'map-cwd?' param; only add mapping for cwd if #t. Only change to cwd within container if #t, otherwise home. (guix-environment): Error if --no-cwd without --container. Provide '(not no-cwd?)' to launch-environment/container as 'map-cwd?'. * tests/guix-environment.sh: Add test for no-cwd. Co-authored-by: Mike Gerwitz <mtg@gnu.org>
2019-07-08scripts: environment: Only rewrite user-specified mappings.Carl Dong
* guix/scripts/environment.scm (launch-environment/container): Only apply override-user-mappings to user-mappings and cwd. Do not apply to network configuration mapping and inputs.
2019-07-06Add 'guix deploy'.Jakob L. Kreuze
* guix/scripts/deploy.scm: New file. * Makefile.am (MODULES): Add it.
2019-07-04pack: 'squashfs' backend records the profile's search paths.Ludovic Courtès
* guix/scripts/pack.scm (singularity-environment-file): New procedure. (squashfs-image): Use it, and create /.singularity/env/90-environment.sh. * gnu/tests/singularity.scm (run-singularity-test)["singularity run, with environment"]: New test, currently skipped. * gnu/tests/singularity.scm (build-tarball&run-singularity-test): Add GUILE-JSON to the profile.
2019-07-04pack: 'docker' backend records the profile's search paths.Ludovic Courtès
* guix/docker.scm (config): Add #:environment parameter and honor it. (build-docker-image): Likewise, and pass it to 'config'. * guix/scripts/pack.scm (docker-image): Import (guix profiles) and (guix search-paths). Call 'profile-search-paths' and pass #:environment to 'build-docker-image'. * gnu/tests/docker.scm (run-docker-test)["Load docker image and run it"]: Add example that expects (json) to be available. * gnu/tests/docker.scm (build-tarball&run-docker-test): Replace %BOOTSTRAP-GUILE by GUILE-2.2 and GUILE-JSON in the environment.
2019-07-04Add (guix repl).Ludovic Courtès
* guix/scripts/repl.scm: Use (guix repl). (self-quoting?, machine-repl): Remove. * guix/repl.scm: New file. * Makefile.am (MODULES): Add it.
2019-06-27graph: Use 'derivation-input-derivation'.Ludovic Courtès
* guix/scripts/graph.scm (derivation-dependencies): Use 'derivation-input-derivation'.
2019-06-27ui: Add 'display-search-results' and use it.Ludovic Courtès
* guix/ui.scm (display-search-results): New procedure. * guix/scripts/package.scm (find-packages-by-description): Remove 'unzip2' call and return a list of pairs. (process-query): Change to use 'display-search-results'. * guix/scripts/system/search.scm (find-service-types): Remove 'unzip2' call and return a list of pairs. (guix-system-search): Use 'display-search-results'.
2019-06-24publish: Work around Guile 2.2.5 (web server) bug.Ludovic Courtès
* guix/scripts/publish.scm: Replace (@@ (web http) read-header-line) on Guile 2.2.5.
2019-06-23guix build: '--log-file' no longer returns several log files.Ludovic Courtès
Fixes a regression introduced in 9353b199c18caca4a429f20423e1a5e7bc26a8da whereby something like: guix build --log-file $(guix build -d guile) would return two log files. This led to a failure of 'tests/guix-build.sh'. * guix/scripts/build.scm (guix-build): Filter out derivation file names from ITEMS.
2019-06-23guix build: Use 'warning' for warnings.Ludovic Courtès
* guix/scripts/build.scm (options->derivations): Use 'warning' instead of 'format'.
2019-06-18guix build: '--log-file' looks for build logs of equivalent derivations.Ludovic Courtès
Previously, '--log-file' would look for log files only for the current derivation, and thus wouldn't find log files of equivalent derivations that produce the same output. * guix/scripts/build.scm (guix-build) <log-file?>: Replace 'derivation-file-name' by 'derivation->output-path'.
2019-06-10pack: Fix 'guix pack -f docker'.Ludovic Courtès
Regression introduced in a0f352b30f4869a7af7017b8a5011ac7602dd115. * guix/scripts/pack.scm (docker-image): Check whether ENTRY-POINT is true before returning (string-append #$profile ...).
2019-06-07pack: Add '--entry-point'.Ludovic Courtès
* guix/scripts/pack.scm (self-contained-tarball): Add #:entry-point and warn when it's true. (squashfs-image): Add #:entry-point and honor it. (docker-image): Add #:entry-point and honor it. (%options, show-help): Add '--entry-point'. (guix-pack): Honor '--entry-point' and pass #:entry-point to BUILD-IMAGE. * gnu/tests/docker.scm (run-docker-test): Test 'docker run' with the default entry point. (build-tarball&run-docker-test): Pass #:entry-point to 'docker-image'. * doc/guix.texi (Invoking guix pack): Document it. * gnu/tests/singularity.scm (run-singularity-test)["singularity run"]: New test. (build-tarball&run-singularity-test): Pass #:entry-point to 'squashfs-image'.
2019-06-05syscalls: Add 'with-file-lock' macro.Ludovic Courtès
* guix/scripts/offload.scm (lock-file, unlock-file, with-file-lock): Move to... * guix/build/syscalls.scm: ... here.
2019-06-05guix package: Do not list environment variables that need to be set.Ludovic Courtès
Fixes <https://bugs.gnu.org/35942>. * guix/scripts/package.scm (display-search-paths): Rename to... (display-search-path-hint): ... this. Adjust callers. Remove #:kind parameter. Replace the list of environment variables with an invitation to source $GUIX_PROFILE/etc/profile or run 'guix package --search-paths'.
2019-06-02substitute: Select the best compression methods.Ludovic Courtès
When a server publishes several URLs with different compression methods, 'guix substitute' can now choose the best one among the compression methods that it supports. * guix/scripts/substitute.scm (<narinfo>)[uri]: Replace with... [uris]: ... this. [compression]: Replace with... [compressions]: ... this. [file-size]: Replace with... [file-sizes]: ... this. [file-hash]: Replace with... [file-hashes]: ... this. (narinfo-maker): Adjust accordingly. Ensure 'file-sizes' and 'file-hashes' have the right length. (assert-valid-signature, valid-narinfo?): Use the first element of 'narinfo-uris' in error messages. (read-narinfo): Expect "URL", "Compression", "FileSize", and "FileHash" to occur multiple times. (display-narinfo-data): Call 'select-uri' to determine the file size. (%compression-methods): New variable. (supported-compression?, compresses-better?, select-uri): New procedures. (process-substitution): Call 'select-uri' to select the URI and compression. * guix/scripts/weather.scm (report-server-coverage): Account for all the values returned by 'narinfo-file-sizes'. * tests/substitute.scm ("substitute, narinfo with several URLs"): New test.
2019-06-02publish: '--compression' can be repeated.Ludovic Courtès
This allows 'guix publish' to compress and advertise multiple compression methods from which users can choose. * guix/scripts/publish.scm (actual-compression): Rename to... (actual-compressions): ... this. Expect REQUESTED to be a list, and always return a list. (%default-options): Remove 'compression. (store-item->recutils): New procedure. (narinfo-string): Change #:compression to #:compressions (plural). Adjust accordingly. (render-narinfo, render-narinfo/cached): Likewise. (bake-narinfo+nar): Change #:compression to #:compressions. [compressed-nar-size]: New procedure. Call 'compress-nar' for each item returned by 'actual-compressions'. Create a narinfo for each compression. (effective-compression): New procedure. (make-request-handler): Change #:compression to #:compressions. Use 'effective-compression' to determine the applicable compression. (guix-publish): Adjust handling of '--compression'. Print a message for each compression that is enabled. * tests/publish.scm ("/*.narinfo"): Adjust to new narinfo field ordering. ("/*.narinfo with properly encoded '+' sign"): Likewise. ("/*.narinfo with lzip + gzip"): New test. ("with cache, lzip + gzip"): New test. * doc/guix.texi (Invoking guix publish): Document it.
2019-05-29publish: Factorize 'compress-nar'.Ludovic Courtès
* guix/scripts/publish.scm (compress-nar): New procedure. (bake-narinfo+nar): Use it.
2019-05-29publish: Remove outdated comment.Ludovic Courtès
* guix/scripts/publish.scm (make-request-handler): Remove outdated TODO.
2019-05-27publish: Display the compression method and level in use.Ludovic Courtès
* guix/scripts/publish.scm (guix-publish): Use 'info' instead of 'format' for the initial message. When COMPRESSION is true, display the method and level in use.
2019-05-27publish: Add support for lzip.Ludovic Courtès
* guix/scripts/publish.scm (show-help, %options): Support '-C METHOD' and '-C METHOD:LEVEL'. (default-compression): New procedure. (bake-narinfo+nar): Add lzip. (nar-response-port): Likewise. (string->compression-type): New procedure. (make-request-handler): Generalize /nar/gzip handler to handle /nar/lzip as well. * tests/publish.scm ("/nar/lzip/*"): New test. ("/*.narinfo with lzip compression"): New test. * doc/guix.texi (Invoking guix publish): Document it. (Requirements): Mention lzlib.
2019-05-26publish: Maintain a hash-part-to-store-item mapping in cache.Ludovic Courtès
Fixes <https://bugs.gnu.org/33897>. * guix/scripts/publish.scm (hash-part-mapping-cache-file) (hash-part->path*): New procedures. * guix/scripts/publish.scm (render-narinfo/cached)[delete-entry]: Delete the 'hash-part-mapping-cache-file'. Use 'hash-part->path*' instead of 'hash-part->path'. * tests/publish.scm ("with cache, vanishing item"): New test.
2019-05-22weather: Accept package specs on the command line.Ludovic Courtès
Previously, non-option arguments would be ignored. Now it puts them to good use. * guix/scripts/weather.scm (guix-weather)[package-list]: New procedure. Use it. * doc/guix.texi (Invoking guix weather): Adjust accordingly.
2019-05-22pack: Warn when building an empty pack.Ludovic Courtès
* guix/scripts/pack.scm (guix-pack): Warn when MANIFEST has zero entries.
2019-05-22pack: Add '--root'.Ludovic Courtès
* guix/scripts/pack.scm (%options, show-help): Add "--root". (guix-pack): Honor it. * tests/guix-pack.sh: Test it. * doc/guix.texi (Invoking guix pack): Document it.
2019-05-16guix system: Type-check the file or expression.Ludovic Courtès
Previously, users would get a wrong-type-arg exception down the road with an intimidating backtrace. * guix/scripts/system.scm (process-action)[ensure-operating-system]: New procedure. Use it.
2019-05-14guix build: Gracefully handle invalid '--with-git-url' specs.Ludovic Courtès
* guix/scripts/build.scm (transform-package-source-git-url): Add case for when 'string-split' does not return exactly two elements.
2019-05-13vm: Auto-detect if inputs should be registered.Maxim Cournoyer
The default value of the argument REGISTER-CLOSURE? of the ISO9660-IMAGE, QEMU-IMAGE and SYSTEM-DOCKER-IMAGE procedures can be computed automatically, since the operating-system definition is available in its context. When the operating-system definition does not contain the GUIX-SERVICE-TYPE, do not register the closure in the database of Guix, as it takes time and doesn't serve a purpose. * gnu/system/vm.scm (has-guix-service-type): Add predicate. (iso9660-image)[register-closures?]: Use it to compute the argument's default value. (qemu-image)[register-closures?]: Likewise, and update docstring. (system-docker-image)[register-closures?]: Likewise. (system-disk-image): Do not explicit a value for the REGISTER-CLOSURES? argument of the ISO9660-IMAGE and QEMU-IMAGE procedure calls, so that its default value is used instead. * guix/scripts/system.scm (system-derivation-for-action): Do not explicit a value for the REGISTER-CLOSURES? argument of the SYSTEM-DOCKER-IMAGE procedure call, so that its default value is used instead.
2019-05-14linux-container: Support container network sharing.Arun Isaac
* gnu/system/linux-container.scm (container-essential-services): If network is to be shared with the host, remove network configuration files from etc service. (containerized-operating-system): If network is to be shared with the host, remove nscd service and map host's /var/run/nscd if it exists. (container-script): If network is to be shared with the host, do not create network namespace. * guix/scripts/system.scm (system-derivation-for-action): Add #:container-shared-network? argument. (perform-action): Add #:container-shared-network? argument. (show-help): Add "-N, --network" help information. (%options): Add network option. (process-action): Call perform-action with #container-shared-network? argument. * doc/guix.texi (Invoking guix system): Document the "-N, --network" option. Co-authored-by: Christopher Baines <mail@cbaines.net>
2019-05-09pull: Display 'hash guix' hint when the new and old 'guix' are different.Ludovic Courtès
Fixes <https://bugs.gnu.org/35601>. Reported by Diego Nicola Barbato <dnbarbato@posteo.de>. Previously we were calling (which "guix") after the new profile had been built and symlinked, so in most cases the hint would not be triggered, even though it should have been triggered. * guix/scripts/pull.scm (build-and-install)[guix-command]: New variable. Compare PROFILE/bin/guix against GUIX-COMMAND.
2019-05-09ui: Make package outputs searchable.Chris Marusich
* guix/ui.scm (relevance): Allow the "field" procedure of a metric to return a list, and handle that case appropriately. Update docstring. (%package-metrics): Add a metric for package outputs. * guix/scripts/package.scm (find-packages-by-description): Update docstring. * tests/guix-package.sh: Add a test case to verify that package outputs are included in search results. Co-authored-by: Tobias Geerinckx-Rice <me@tobias.gr>
2019-05-07environment: Non ad-hoc mode also honors transformation options.Ludovic Courtès
Fixes <https://bugs.gnu.org/35618>. Reported by Florent Pruvost <florent.pruvost@inria.fr>. * guix/scripts/environment.scm (options/resolve-packages): Add call to TRANSFORM in non "ad-hoc" case. * tests/guix-environment.sh: Add test.
2019-05-01build: Change default substitute server to "ci.guix.gnu.org".Ludovic Courtès
* config-daemon.ac: Replace "ci.guix.info" with "ci.guix.gnu.org". * doc/guix.texi (SUBSTITUTE-SERVER): Likewise. * etc/substitutes/ci.guix.gnu.org.pub: New file. * Makefile.am (dist_pkgdata_DATA): Add it. * guix/scripts/build.scm (%default-log-urls): Update. * guix/scripts/substitute.scm (%default-substitute-urls): Likewise. * guix/store.scm (%default-substitute-urls): Likewise. * guix/self.scm (miscellaneous-files): Add "ci.guix.gnu.org".
2019-04-29processes: Gracefully handle daemons without clients.Ludovic Courtès
Fixes <https://bugs.gnu.org/34716>. Reported by Mark H Weaver <mhw@netris.org>. The problem could be reproduced by running, on one hand: sh -c 'exec -a guix-daemon sleep 777' and on the other hand: guix processes If there is no process with PID 777, 'guix processes' would barf as it stumbles upon a <daemon-session> record whose client is #f. * guix/scripts/processes.scm (daemon-sessions)[child-process->session]: New procedure, with lambda formerly passed to 'map'. Handle #f returns from 'lookup-process'. Call 'child-process->session' within 'filter-map', not just 'map'.
2019-04-29processes: 'process-open-files' ignores disappeared /proc/PID/fd entries.Ludovic Courtès
Previously, 'process-open-files' would throw ENOENT if an entry had vanished after the 'scandir' call and before the 'readlink' call. * guix/scripts/processes.scm (process-open-files): Catch ENOENT errors from 'readlink'.
2019-04-29guix package: Add 'guix search' alias.Ludovic Courtès
* guix/scripts/search.scm: New file. * Makefile.am (MODULES): Add it. * po/guix/POTFILES.in: Add it. * tests/guix-package-aliases.sh: Add test. * doc/guix.texi (Invoking guix package): Document it and use it in a couple of examples.
2019-04-29guix package: Add 'install', 'remove', and 'upgrade' aliases.Ludovic Courtès
* guix/scripts/install.scm, guix/scripts/remove.scm, guix/scripts/upgrade.scm, tests/guix-package-aliases.sh: New files. * Makefile.am (MODULES, SH_TESTS): Add them. * po/guix/POTFILES.in: Add them. * guix/scripts/package.scm (guix-package): Split with... (guix-package*): ... this. New procedure. * doc/guix.texi (Invoking guix package): Document them. (Binary Installation, Application Setup, Package Management) (Packages with Multiple Outputs, Package Modules) (X.509 Certificates, Installing Debugging Files): Use 'guix install' in simple examples. * etc/completion/bash/guix (_guix_complete): Handle "install", "remove", and "upgrade".
2019-04-28describe: Provide a hint when origin detection fails.Ludovic Courtès
* guix/scripts/describe.scm (display-checkout-info): Add call to 'display-hint' in the error case.
2019-04-23guix system: Compute 'bootcfg' only for 'init' and 'reconfigure'.Ludovic Courtès
Previously, 'guix system vm' would start by computing the bootcfg derivation, which itself depended on an incorrect OS derivation (for the original OS instead of the one passed through 'virtualized-operating-system'.) That added overhead and would force the user's config file to define a root file system, for example, even though it makes no sense in the case of a VM. * guix/scripts/system.scm (perform-action)[bootcfg]: Limit to the 'init' and 'reconfigure' actions.
2019-04-22pull: Create profile after the store connection has been opened.Ludovic Courtès
Fixes <https://bugs.gnu.org/35341>. Reported by Florian Pelz <pelzflorian@pelzflorian.de>. Previously, we'd call 'ensure-default-profile' before the connection to the daemon has been opened. On the first connection, the daemon ensures that /var/guix/profiles/per-user is world-writable. Since we were calling 'ensure-default-profile' before that, /var/guix/profiles/per-user was typically non-writable (555 and root-owned), and thus 'guix pull' would error out. * guix/scripts/pull.scm (guix-pull): Call 'ensure-default-profile' within 'with-store'.
2019-04-22pull: Add '--news'.Ludovic Courtès
Suggested by Tobias Geerinckx-Rice <me@tobias.gr>. * guix/scripts/pull.scm (%options, show-help): Add '--news'. (display-profile-news): Add #:current-is-newer? and #:concise?. Honor them. (build-and-install): Pass #:concise? #t. (display-new/upgraded-packages)[concise/max-item-count]: New variable. Add call to 'display-hint'. (process-query): Add clause for 'display-news'. * doc/guix.texi (Invoking guix pull): Add '--news'.
2019-04-19guix build: Accept multiple '-s' options.Ludovic Courtès
* guix/scripts/build.scm (%default-options): Remove 'system'. (%options) <--system>: Keep previous occurrences of 'system in RESULT. (options->derivations)[system]: Remove. [systems, things-to-build]: New variables. [compute-derivation]: New procedure. Iterate on all of SYSTEMS to compute the derivations of THINGS-TO-BUILD. * tests/guix-build.sh: Add test for one and multiple '-s' flags. * doc/guix.texi (Additional Build Options): Document this behavior.
2019-04-18lint: 'check-github-url' uses our own 'open-connection-for-uri'.Ludovic Courtès
Fixes <https://bugs.gnu.org/35053>. Reported by Efraim Flashner <efraim@flashner.co.il>. Previously 'check-github-url' would let Guile 2.2's (web client) module take care of opening the connection. Consequently, it wouldn't use the TLS priority strings that we use in (guix build download), 'open-connection-for-uri'. In particular, it would not disable TLSv1.3, which would trigger <https://bugs.gnu.org/34102> for github.com. * guix/scripts/lint.scm (check-github-url): Add #:timeout parameter. [follow-redirect]: Change parameter name to 'url' and pass it to 'string->uri'. Call 'guix:open-connection-for-uri' to open the connection and pass it to 'http-head' via #:port.
2019-04-17pull: '--url', '--commit', and '--branch' apply to the 'guix' channel.Ludovic Courtès
Suggested by pkill9 <pkill9@runbox.com>. * guix/scripts/pull.scm (channel-list): Apply REF and URL to the 'guix' channel. * doc/guix.texi (Invoking guix pull): Adjust accordingly.
2019-04-15guix build: Fix relative file name canonicalization for '--root'.Ludovic Courtès
Fixes <https://bugs.gnu.org/35271>. Reported by rendaw <7e9wc56emjakcm@s.rendaw.me>. * guix/scripts/build.scm (register-root): When ROOT is a relative file name, append the basename of ROOT, not ROOT itself. * tests/guix-build.sh: Add test.
2019-04-11guix gc: '-d' does not attempt to delete non-user-owned roots.Ludovic Courtès
* guix/scripts/gc.scm (guix-gc)[delete-generations]: Limit to user-owned roots, unless we're running as root.
2019-04-10guix gc: Add '--delete-generations'.Ludovic Courtès
* guix/scripts/gc.scm (show-help, %options): Add '--delete-generations'. Change '--delete' shorthand to '-D'. (delete-old-generations): New procedure. (guix-gc)[delete-generations]: New procedure. Call it when ACTION is 'collect-garbage' and OPTS contains 'delete-generations. * doc/guix.texi (Invoking guix gc): Document it.
2019-04-10guix gc: Add '--list-roots'.Ludovic Courtès
* guix/scripts/gc.scm (show-help, %options): Add '--list-roots'. (guix-gc)[list-roots]: New procedure. Handle '--list-roots'. * tests/guix-gc.sh: Test it. * doc/guix.texi (Invoking guix gc): Document it.