summaryrefslogtreecommitdiff
path: root/guix/scripts
Commit message (Collapse)AuthorAge
* style: Gracefully handle errors such as EACCES when opening files.Ludovic Courtès2021-12-18
| | | | | * guix/scripts/style.scm (guix-style): Wrap body in 'with-error-handling'.
* style: Refer to source files by absolute file names.Ludovic Courtès2021-12-18
| | | | | | | | | Previously, "guix style PACKAGE" would end up modifying a file looked up under the current directory since the location associated with PACKAGE is usually a relative file name. * guix/scripts/style.scm (absolute-location): New procedure. (simplify-package-inputs): Use it.
* guix hash: Add git serializer.zimoun2021-12-17
| | | | | | | | | * guix/scripts/hash.scm (git-hash): New procedure. (%options): Use it. * tests/guix-hash.sh: Test it. * doc/guix.texi: Update. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* guix hash: Add 'serializer' option.zimoun2021-12-17
| | | | | | | | | | | | | * guix/scripts/hash.scm (%options): Deprecate 'recursive', add 'serializer'. (%default-options): Add 'serializer'. (nar-hash): New procedure. (default-hash): New procedure. (guix-hash)[file-hash]: Use them. (show-help): Adjust. * tests/guix-hash.scm: Adjust. * doc/guix.texi: Update. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* guix hash: Support several files.zimoun2021-12-17
| | | | | | | | | | * guix/scripts/hash.scm (guix-hash): Allow several files. [file-hash]: Catch system-error. [formatted-hash]: New procedure. * tests/guix-hash.sh: Add test. * doc/guix.texi (Invoking guix hash): Mention "one or more files". Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* offload: Autoload Guile-SSH.Ludovic Courtès2021-12-15
| | | | | | | | | | | | | This halves the number of syscalls made by "guix offload" during startup and delays loading of Guile-SSH until there are actually machines to offload to. * guix/scripts/offload.scm: Remove unused module imports. Autoload many modules. (check-ssh-zlib-support): New procedure. (process-request): Call it when accepting. (guix-offload): Remove 'zlib-support?' check, now moved to 'check-ssh-zlib-support'.
* offload: Delay call to 'read-derivation-from-file'.Ludovic Courtès2021-12-15
| | | | | | | | | This significantly reduces the amount of work done by "guix offload" when there's no machine to offload to. * guix/scripts/offload.scm (process-request): Add call to 'read-derivation-from-file', moved from... (guix-offload): ... here.
* Merge branch 'master' into core-updates-frozenLudovic Courtès2021-12-13
|\
| * challenge: Store item contents are returned in canonical order.Ludovic Courtès2021-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the 'delete-duplicates' call in 'differing-files' to have the intended effect. Before that, a "guix challenge" invocation with three builds of a store item, two of which are identical, would lead 'differing-files' to not print anything, as in this example: $ ./pre-inst-env guix challenge python-numpy /gnu/store/…-python-numpy-1.17.3 contents differ: local hash: 07var0wn8fywxchldz5pjqpnlavrlbc8s81aqwsqyi0i7qlh6ka7 https://ci.guix.gnu.org/nar/lzip/…-python-numpy-1.17.3: 07var0wn8fywxchldz5pjqpnlavrlbc8s81aqwsqyi0i7qlh6ka7 https://bordeaux.guix.gnu.org/nar/lzip/…-python-numpy-1.17.3: 0cbl3q19bshb6ddz8xkcrjzkcmillsqii4z852ybzixyp7rg40qa 1 store items were analyzed: - 0 (0.0%) were identical - 1 (100.0%) differed - 0 (0.0%) were inconclusive With this change, 'differing-files' prints additional info as intended: differing file: /lib/python3.8/site-packages/numpy/distutils/fcompiler/__pycache__/vast.cpython-38.pyc * guix/scripts/challenge.scm (archive-contents): Add tail call to 'reverse'. (store-item-contents): Rewrite to use 'scandir' and recursive calls instead of 'file-system-fold'.
| * challenge: Use SRFI-71 instead of SRFI-11.Ludovic Courtès2021-12-12
| | | | | | | | * guix/scripts/challenge.scm (port-sha256*, call-with-nar): Use SRFI-71.
* | Merge remote-tracking branch 'signed/master' into core-updatesMathieu Othacehe2021-12-10
|\|
| * environment: Suggestion code gracefully handles empty "/bin" directories.Ludovic Courtès2021-12-10
| | | | | | | | | | * guix/scripts/environment.scm (suggest-command-name): Handle the case where 'scandir' returns #f.
| * shell: When using '-D -f', '-D' has no effect on remaining packages.Ludovic Courtès2021-12-10
| | | | | | | | | | | | | | | | | | Fixes <https://issues.guix.gnu.org/52093>. Reported by Konrad Hinsen <konrad.hinsen@fastmail.net>. * guix/scripts/shell.scm (%options): In "--file" handler, add call to 'ensure-ad-hoc'. * tests/guix-shell.sh: Add test.
| * shell: Fix '--file' description in '--help' output.Ludovic Courtès2021-12-10
| | | | | | | | | | | | Reported by pinoaffe on #guix. * guix/scripts/shell.scm (show-help): Fix '--file' description.
* | Merge remote-tracking branch 'origin/master' into core-updates-frozenRicardo Wurmus2021-12-05
|\|
| * guix system vm: Add --no-graphic CLI argument.Attila Lendvai2021-12-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It configures QEMU to use the tty it was started in for IO (as opposed to opening a separate graphical window). This enables copy-pasting and scrollback. Exit QEMU with C-a x. * gnu/system/vm.scm (system-qemu-image/shared-store-script): Also add the '-nographic' QEMU argument when called with #:graphic? #false. * guix/scripts/system.scm (system-derivation-for-action): Propagate the #:graphic? keyword arg. (perform-action): Add and propagate the #:graphic? keyword arg. (show-help): Add --no-graphic CLI arg. (%options): Process the new --no-graphic CLI arg. (process-action): Feed in the CLI arg through the #:graphic? keyword arg. * doc/guix.texi (Invoking guix system): Add example to combine guix system and invoking the vm start script into one command. Split the description of the various options into separate paragraphs. Add a paragraph to describe --no-graphic. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
* | style: Add '--dry-run'.Ludovic Courtès2021-11-23
| | | | | | | | | | | | | | * guix/scripts/style.scm (edit-expression/dry-run): New procedure. (simplify-package-inputs): Add #:edit-expression parameter. (%options, show-help): Add '--dry-run'. (guix-style): Honor '--dry-run'.
* | Merge branch 'master' into core-updates-frozenLudovic Courtès2021-11-23
|\|
| * guix graph: Show '-M' in '--help' output.Ludovic Courtès2021-11-23
| | | | | | | | * guix/scripts/graph.scm (show-help): Add -M shorthand.
| * scripts: home: Make ‘guix home import’ write home-configuration.scm.Xinglu Chen2021-11-17
| | | | | | | | | | | | | | | | | | | | * guix/scripts/home.scm (process-command): Populate ‘home-configuration.scm’ in the destination directory instead of printing to stdout. * doc/guix.texi (Declaring the Home Environment): Adjust accordingly. (Invoking guix home): Likewise. Suggested-by: Ludovic Courtès <ludo@gnu.org> Co-authored-by: Ludovic Courtès <ludo@gnu.org>
| * import: Replace texlive importer.Ricardo Wurmus2021-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | * guix/import/texlive.scm (fetch-sxml, sxml->package): Remove procedures. (tlpdb-file, tlpdb, files->directories, tlpdb->package): New procedures. (string->license): Add case for lpplgpl license combination. (guix-name): Remove COMPONENT argument. (texlive->guix-package): Use new procedures. (texlive-recursive-import): New procedure. * guix/scripts/import/texlive.scm (show-help, %options): Remove --archive option. (guix-import-texlive): Adjust call of texlive->guix-package. * doc/guix.texi (Invoking guix import): Update documentation.
* | Merge branch 'master' into core-updates-frozenLudovic Courtès2021-11-17
|\|
| * environment: Fix ‘--check’ with exported PS1 variable.Thiago Jung Bauermann2021-11-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If your .bashrc (unnecessarily) exports PS1 and you’re in a non-login shell, Guix crashes: user@popigai:~$ guix shell --check coreutils guix shell: checking the environment variables visible from shell '/bin/bash'... Backtrace: 14 (primitive-load "/home/user/.config/guix/current/bin/g…") In guix/ui.scm: 2206:7 13 (run-guix . _) 2169:10 12 (run-guix-command _ . _) In ice-9/boot-9.scm: 1752:10 11 (with-exception-handler _ _ #:unwind? _ # _) 1752:10 10 (with-exception-handler _ _ #:unwind? _ # _) In guix/store.scm: 658:37 9 (thunk) 1320:8 8 (call-with-build-handler _ _) 1320:8 7 (call-with-build-handler #<procedure 7fe393b7c420 at g…> …) In guix/status.scm: 800:4 6 (call-with-status-report _ _) In guix/scripts/environment.scm: 951:12 5 (_) In guix/store.scm: 2119:24 4 (run-with-store #<store-connection 256.99 7fe39627e500> …) In guix/scripts/environment.scm: 521:35 3 (_ _) In unknown file: 2 (string=? ("PS1" . "${debian_chroot:+($debian_chroot)…") …) In ice-9/boot-9.scm: 1685:16 1 (raise-exception _ #:continuable? _) 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure string=: Wrong type argument in position 1 (expecting string): ("PS1" . "${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]${EXTRA}\\$ ") user@popigai:~$ This is because the match pattern doesn’t expect `(vhash-assoc "PS1" actual)` to return a pair. * guix/scripts/environment.scm (validate-child-shell-environment): Change match pattern to expect a pair. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * import: cran: Allow imports of a specific version.Ludovic Courtès2021-11-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * guix/import/cran.scm (download): Handle the case where URL is a list. (fetch-description-from-tarball): New procedure. (fetch-description): Add #:version parameter. Honor it when REPOSITORY is 'cran. Use 'fetch-description-from-tarball' when REPOSITORY is 'bioconductor. (description->package): SOURCE-URL may now be a list. (cran->guix-package): Pass VERSION to 'fetch-description'. (cran-recursive-import): Add #:version parameter. * guix/scripts/import/cran.scm (guix-import-cran): Expect a spec rather than a mere package name. * doc/guix.texi (Invoking guix import): Document it.
| * import: pypi: Allow imports of a specific version.Ludovic Courtès2021-11-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * guix/import/pypi.scm (latest-version): New procedure. (latest-source-release): Rename to... (source-release): ... this. Add 'version' parameter. (latest-wheel-release): Rename to... (wheel-release): ... this. Add 'version' parameter. (pypi->guix-package): Honor 'version' parameter. (pypi-recursive-import): Add 'version' parameter and honor it. * guix/scripts/import/pypi.scm (guix-import-pypi): Expect a spec. Pass it to 'package-name->name+version'. Pass the 'version' parameter. * tests/pypi.scm ("pypi->guix-package, no wheel"): Exercise the #:version parameter. * doc/guix.texi (Invoking guix import): Document it.
* | Merge remote-tracking branch 'origin/master' into core-updates-frozenEfraim Flashner2021-11-08
|\|
| * shell: Actually clean up the profile cache.Ludovic Courtès2021-11-07
| | | | | | | | | | | | | | | | | | Previously, most actions would leave the cache as-is because 'guix-environment*' would indirectly call 'exit', and thus its continuation was never reached. * guix/scripts/shell.scm (guix-shell): Move call to 'maybe-remove-expired-cache-entries' to EXIT-HOOK.
| * import: egg: Allow imports of a specific version.Xinglu Chen2021-11-07
| | | | | | | | | | | | | | | | | | | | | | | | * guix/import/egg.scm (eggs-repository): Change URL. (egg-metadata): Accept optional #:version keyword argument. (egg->guix-package): Accept ‘version’ argument. (egg-recursive-import): Add ‘version’ argument and honor it. * guix/scripts/import/egg.scm (guix-import-egg): Parse a specification instead of just a package name. * doc/guix.texi (Invoking guix import): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * home: services: bash: Add ‘aliases’ field.Xinglu Chen2021-11-07
| | | | | | | | | | | | | | | | | | | | | | * doc/guix.texi (Shells Home Services): Document it. * gnu/home/services/shells.scm (bash-serialize-aliases): New procedure. (home-bash-configuration, home-bash-extension): Add ‘aliases’ field. (home-bash-extensions): Adjust accordingly. * guix/scripts/home/import.scm (generate-bash-configuration+modules): Populate the ‘alias’ field. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * environment: Suggest command upon 'execlp' failure.Ludovic Courtès2021-11-06
| | | | | | | | | | | | | | | | | | * guix/scripts/environment.scm (launch-environment): Call 'primitive-_exit' upon 'system-error. (suggest-command-name, validate-exit-status): New procedures. (launch-environment/fork): Call 'validate-exit-status'. (launch-environment/container)[exit/status*]: New procedure. Use it instead of 'exit/status'.
* | Merge remote-tracking branch 'origin/master' into core-updates-frozenEfraim Flashner2021-10-31
|\|
| * home: import: Avoid duplication of 'manifest->code'.Ludovic Courtès2021-10-31
| | | | | | | | | | | | | | | | | | | | * guix/scripts/home/import.scm (manifest->code): Remove. (manifest+configuration-files->code): New procedure. (import-manifest): Use 'manifest+configuration-files->code' instead of 'manifest->code'. * tests/home-import.scm (eval-test-with-home-environment): Likewise. (match-home-environment-transformations): New procedure. ("manifest->code: No services, package transformations"): New test.
| * home: import: Factorize triplicated 'version-spec' procedure.Ludovic Courtès2021-10-31
| | | | | | | | | | | | | | | | | | | | * guix/scripts/package.scm (manifest-entry-version-prefix): New procedure, moved from... (export-manifest)[version-spec]: ... here. Adjust caller. * tests/home-import.scm (version-spec): Remove. (eval-test-with-home-environment): Use 'manifest-entry-version-prefix' instead. * guix/scripts/home/import.scm (import-manifest): Likewise.
| * home: import: Clarify "destination directory".Ludovic Courtès2021-10-31
| | | | | | | | | | | | | | | | Suggested by Liliana Marie Prikler <liliana.prikler@gmail.com>. * guix/scripts/home/import.scm (configurations+modules): Rename 'destination-directory' to 'configuration-directory'. Improve docstring.
| * home: import: Compare procedures with 'eq?'.Ludovic Courtès2021-10-31
| | | | | | | | | | | | | | | | 'procedure-name' is a debugging aid and cannot be reliably used to check for procedure equality. * guix/scripts/home/import.scm (configurations+modules): Remove use of 'procedure-name'.
| * guix home: import: Call ‘local-file’ with ‘name’Xinglu Chen2021-10-31
| | | | | | | | | | | | | | | | | | | | | | | | Set the name of the file to just the basename of the file passed to ‘local-file’. * guix/scripts/home/import.scm (basename+remove-dots): New procedure. (generate-bash-configuration+modules): Use it. * tests/home-import.scm (match-home-environment-bash-service): Adjust accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * Add tests for ‘guix home import’.Xinglu Chen2021-10-31
| | | | | | | | | | | | | | * tests/home-import.scm: New file. * Makefile.am (SCM_TESTS): Add it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * guix home: import: Delete duplicate modules when importing.Xinglu Chen2021-10-31
| | | | | | | | | | | | | | | | | | Two different services might require the same module(s), so delete duplicates when generating the ‘use-modules’ form. * import.scm (manifest->code): Delete duplicate modules. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * guix home: import: Don’t use 'slurp-file-gexp'.Xinglu Chen2021-10-31
| | | | | | | | | | | | | | | | | | ‘slurp-file-gexp’ is not a bound procedure. * guix/scripts/home/import.scm (generate-bash-configuration+modules): Don’t use ‘slurp-file-gexp’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * guix home: import: Fix module name for Bash service.Xinglu Chen2021-10-31
| | | | | | | | | | | | | | * guix/scripts/home/import.scm (generate-bash-configuration+modules): Change (gnu home-services bash) to (gnu home-services shells); add (guix gexp). Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * guix home: import: Allow multiple modules to be imported for each service.Xinglu Chen2021-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, only one module could be imported for each service, e.g., only (gnu home-services shell) could be imported when generating the Bash service declaration. However, for some services, multiple modules might need to be imported in order for it to work. * guix/scripts/home/import.scm (generate-bash-module+configuration): Rename to ... (generate-bash-configuration+modules): ... this. (%files-configurations-alist): Rename to ... (%files+configurations-alist): ... this. (modules+configurations): Rename to ... (configurations+modules): ... this. (manifest->code): Adjust accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * guix home: import: Make the user to specify a destination directory.Xinglu Chen2021-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Copy the appropriate the relevant configuration files to the destination directory, and call ‘local-file’ on them. Without this, ‘guix home import’ will generate a service declaration like this (service home-bash-service-type (home-bash-configuration (bashrc (list (slurp-file-gexp (local-file "/home/yoctocell/.bashrc")))))) but when running ‘guix home reconfigure’, the ~/.bashrc file would be moved, so when running ‘guix home reconfigure’ for the second time, it would read the ~/.bashrc which is itself a symlink to a file the store. * guix/scripts/home/import.scm (generate-bash-module+configuration): Take ‘destination-directory’ parameter (modules+configurations): Copy the user’s configuration file to ‘%destination-directory’. * guix/scripts/home.scm (process-command): Adjust accordingly; create ‘destination’ if it doesn’t exist. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * shell: Error out when an unauthorized guix.scm/manifest.scm is found.Ludovic Courtès2021-10-30
| | | | | | | | | | | | | | | | | | | | | | The previous behavior was confusing: a warning would be printed and 'guix shell' would go on starting an empty environment. Reported by Tobias Geerinckx-Rice <me@tobias.gr>. * guix/scripts/shell.scm (auto-detect-manifest): Change "not loading" case from warning to error. * tests/guix-shell.sh: Adjust accordingly.
| * environment: Fix broken file-local variable.Zhu Zihao2021-10-28
| | | | | | | | | | | | * guix/scripts/environment.scm (Local Variables): Add missing eval. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| * shell: Suggest running '--check' once for interactive use.Ludovic Courtès2021-10-26
| | | | | | | | | | | | * guix/scripts/shell.scm (hint-directory, hint-file, record-hint) (hint-given?): New procedures. (guix-shell): Record and probe the 'shell-check' hint.
| * environment: Add '--check'.Ludovic Courtès2021-10-26
| | | | | | | | | | | | | | | | | | | | | | | | * guix/scripts/environment.scm (show-environment-options-help) (%options): Add '--check'. * guix/scripts/environment.scm (child-shell-environment) (validate-child-shell-environment): New procedures. (guix-environment*): Call 'validate-child-shell-environment' when 'check?' key is in OPTS. * doc/guix.texi (Invoking guix shell): Shorten footnote about Bash startup files. Document '--check' and mention startup files. (Invoking guix environment): Document '--check'.
| * shell: Maintain a profile cache.Ludovic Courtès2021-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | shell: Maintain a profile cache. With this change, running "guix shell" (no arguments) is equivalent to: guix environment -r ~/.cache/guix/profiles/some-root -l guix.scm This is the cache miss. On cache hit, it's equivalent to: guix environment -p ~/.cache/guix/profiles/some-root ... which can run in 0.1s. * guix/scripts/shell.scm (options-with-caching): New procedure. (parse-args): Use it. (%profile-cache-directory): New variable. (profile-cache-key, profile-cached-gc-root): New procedures. (show-help, %options): Add '--rebuild-cache'. (guix-shell)[cache-entries, entry-expiration]: New procedures. Add call to 'maybe-remove-expired-cache-entries'. * doc/guix.texi (Invoking guix shell): Document '--rebuild-cache'.
| * environment: Autoload some modules.Ludovic Courtès2021-10-25
| | | | | | | | | | | | This further speeds up the 'guix environment -p PROFILE' case. * guix/scripts/environment.scm: Autoload a bunch of modules.
| * environment: Do not connect to the daemon when '--profile' is used.Ludovic Courtès2021-10-25
| | | | | | | | | | | | | | | | | | This further speeds up the 'guix environment -p PROFILE' case. * guix/scripts/environment.scm (guix-environment*)[store-needed?]: New variable. [with-store/maybe]: New macro. Use it instead of 'with-store', and remove 'with-build-handler' form.
| * environment: Skip derivation computation when '--profile' is used.Ludovic Courtès2021-10-25
| | | | | | | | | | | | * guix/scripts/environment.scm (guix-environment*): Bypass calls to 'package-derivation' and to 'manifest->derivation' when PROFILE is true.