Commit Graph

6106 Commits

Author SHA1 Message Date
Ludovic Courtès 472a0e82a5
daemon: Do not deduplicate files smaller than 8 KiB.
Files smaller than 8 KiB typically represent ~70% of the entries in
/gnu/store/.links but only contribute to ~4% of the space savings
afforded by deduplication.

Not considering these files for deduplication speeds up file insertion
in the store and, more importantly, leaves 'removeUnusedLinks' with
fewer entries to traverse, thereby speeding it up proportionally.

Partly fixes <https://issues.guix.gnu.org/24937>.

* config-daemon.ac: Remove symlink hard link check and CAN_LINK_SYMLINK
definition.
* guix/store/deduplication.scm (%deduplication-minimum-size): New
variable.
(deduplicate)[loop]: Do not recurse when FILE's size is below
%DEDUPLICATION-MINIMUM-SIZE.
(dump-port): New procedure.
(dump-file/deduplicate)[hash]: Turn into...
[dump-and-compute-hash]: ... this thunk.
Call 'deduplicate' only when SIZE is greater than
%DEDUPLICATION-MINIMUM-SIZE; otherwise call 'dump-port'.
* nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Drop files where
st.st_size < deduplicationMinSize.
* nix/libstore/local-store.hh (deduplicationMinSize): New declaration.
* nix/libstore/optimise-store.cc (deduplicationMinSize): New variable.
(LocalStore::optimisePath_): Return when PATH is a symlink or smaller
than 'deduplicationMinSize'.
* tests/derivations.scm ("identical files are deduplicated"): Produce
files bigger than %DEDUPLICATION-MINIMUM-SIZE.
* tests/nar.scm ("restore-file-set with directories (signed, valid)"):
Likewise.
* tests/store-deduplication.scm ("deduplicate, below %deduplication-minimum-size"):
New test.
("deduplicate", "deduplicate, ENOSPC"): Produce files bigger than
%DEDUPLICATION-MINIMUM-SIZE.
* tests/store.scm ("substitute, deduplication"): Likewise.
2021-11-16 14:34:28 +01:00
Ludovic Courtès f39397b210
tests: Factorize 'file=?'.
* guix/tests.scm (file=?): Add optional 'stat' parameter.  Add fast
patch comparing inode numbers.
* tests/gexp.scm ("imported-files with file-like objects"): Remove
'file=?' procedure and use the one from (guix tests).
2021-11-16 14:34:28 +01:00
Jean-Baptiste Volatier 3af351a7de
build-system/julia: Enable Julia Pkg to find installed packages.
Julia's built-in package manager (Pkg) looks for packages in
JULIA_DEPOT_PATH/packages/PACKAGENAME/XXXX, where XXXX is a string
encoding package UUID and SHA1 of files.  The link-depot phase creates
a link at the correct location to allow Pkg to find packages that were
already installed by Guix.

* guix/build/julia-build-system.scm (link-depot): New phase.
(%package-path): Modified package path from packages/ to loadpath/.
(project.toml->uuid): New procedure, retrive package uuid from TOML file.
(precompile, check): Adjust to the change in paths.
(%standard-phases): Add link-depot phase.
(julia-build): Add julia-package-uuid keyword.
* guix/build-system/julia.scm (julia-build): Also use the
julia-package-uuid keyword.
* gnu/packages/julia-jll.scm (julia-bzip2-jll, julia-cairo-jll,
julia-compilersupportlibraries-jll, julia-expat-jll, julia-ffmpeg-jll,
julia-fontconfig-jll, julia-freetype2-jll, julia-fribidi-jll,
julia-gettext-jll, julia-glib-jll, julia-gr-jll, julia-gumbo-jll,
julia-imagemagick-jll, julia-jllwrappers-jll, julia-jpegturbo-jll,
julia-lame-jll, julia-libass-jll, julia-libfdk-aac-jll,
julia-libffi-jll, julia-libgcrypt-jll, julia-libglvnd-jll,
julia-libgpg-error-jll, juli-libiconv-jll, julia-libmount-jll,
julia-libpng-jll, julia-libsass-jll, julia-libtiff-jll,
julia-libuuid-jll, julia-libvorbis-jll, julia-lzo-jll,
julia-mbedtls-jll, julia-ogg-jll, julia-openspecfun-jll,
julia-openssl-jll, julia-opus-jll, julia-pcre-jll, julia-pixman-jll,
julia-qt5base-jll, julia-wayland-jll, julia-wayland-protocols-jll,
julia-x264-jll, julia-x265-jll, julia-xkbcommon-jll, julia-xml2-jll,
julia-xorg-libpthread-stubs-jll, julia-xorg-libx11-jll,
julia-xorg-libxau-jll, julia-xorg-libxcb-jll, julia-xorg-libxcursor-jll,
julia-xorg-libxdmcp-jll, julia-xorg-libxext-jll,
julia-xorg-libxfixes-jll, julia-xorg-libxi-jll,
julia-xorg-libxinerama-jll, julia-xorg-libxkbfile-jll,
julia-xorg-libxrandr-jll, julia-xorg-libxrender-jll,
julia-xorg-xcb-util-jll, julia-xorg-xcb-util-keysyms-jll,
julia-xorg-xcb-util-renderutil-jll, julia-xorg-xcb-util-wm-jll,
julia-xorg-xkbcomp-jll, julia-xorg-xkeyboard-config-jll,
julia-xorg-xtrans-jll, julia-xslt-jll, julia-zlib-jll, julia-zstd-jll)
[argument]: Adjust the order of the phases to the change in the
julia-build-system.
* gnu/packages/julia-xyz.scm (julia-bufferedstreams, julia-calculus,
julia-dataframes, julia-datavalues, julia-distances, julia-documenter,
julia-dualnumbers, julia-ellipsisnotation, julia-expronicon,
julia-fileio, julia-fixedpointnumbers, julia-functionwrappers,
julia-fuzzycompletions, julia-genericlinearalgebra, julia-genericschur,
julia-geometrybasics, julia-imagemagick, julia-infinity,
julia-matrixfactorizations, julia-media, julia-missings, julia-nnlib,
julia-optimtestproblems, julia-orderedcollections, julia-prettytables,
julia-pycall, julia-quadmath, julia-safetests, julia-stackviews)
[arguments]: Correct paths to reflect change of %package-path modify
order of phases as link-depot needs to run on an unmodified src
directory add package-name-uuid keyword argument to packages without
Project.toml file.
* gnu/packages/julia.scm (julia)[native-search-paths]: Correct paths to
reflect change of %package-path modify order of phases as link-depot
needs to run on an unmodified src directory.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2021-11-16 14:39:51 +02:00
Vagrant Cascadian 75cae188ad
build: wrap-qt-program: Fix typo.
* gnu/build/qt-utils.scm (wrap-qt-program): Fix spelling of "program".
2021-11-14 18:02:22 -08:00
Thiago Jung Bauermann 12c06847f0
environment: Fix ‘--check’ with exported PS1 variable.
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>
2021-11-14 23:18:08 +01:00
jgart 193d7b5b45
guix: packages: Clarify that list is a list of <license> records.
* guix/packages/packages.scm (<package>): Clarify that the license
field takes a list of licenses rather than a generic list.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2021-11-13 09:52:19 +01:00
Attila Lendvai 0c21ec1c79
import: utils: Add more licenses and extend their detection.
* guix/import/utils.scm (spdx-string->license): Identify more
licenses (CC-BY-4.0, Freetype, HPND).
* guix/licenses.scm: Add a comment that mentions "MIT" so that people
who grep for MIT end up there.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-11-12 23:34:18 +01:00
Ludovic Courtès 3756ce3267
import: print: Replace packages and origins in 'arguments'.
* guix/import/print.scm (package->code)[variable-reference]
[object->code]: New procedures.
[package-lists->code]: Rewrite in terms of 'object->code'.
Pass the 'arguments' field through 'object->code'.
* tests/print.scm (pkg-with-arguments, pkg-with-arguments-source): New
variables.
("package with arguments"): New test.
2021-11-11 00:14:31 +01:00
Ludovic Courtès b2ed40c29f
import: print: Handle patches that are origins.
* guix/import/print.scm (package->code)[source->code]: Handle patches
that are origins.
* tests/print.scm (pkg-with-origin-input): Add 'patches' field.
(pkg-with-origin-patch, pkg-with-origin-patch-source): New variables.
("package with origin patch"): New test.
2021-11-11 00:14:31 +01:00
Ludovic Courtès b3240ae846
import: print: Correctly handle URI lists.
* guix/import/print.scm (package->code)[factorized-uri-code]: New
procedure.
[source->code]: Use it, and factorize URI when it's a list.
* tests/print.scm (pkg-with-origin-input): Check origin URI to a list.
2021-11-11 00:14:31 +01:00
Ludovic Courtès 04d929570a
import: print: Properly render packages with origins as inputs.
* guix/import/print.scm (package->code)[source->code]: Check whether
VERSION is true before calling 'factorize-uri'.
[package-lists->code]: Add clause for inputs that are origins.
* tests/print.scm (pkg-with-origin-input, pkg-with-origin-input-source):
New variables.
("package with origin input"): New test.
2021-11-11 00:14:31 +01:00
Ludovic Courtès 450e1dd52e
import: cran: Allow imports of a specific version.
* 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.
2021-11-11 00:14:30 +01:00
Ludovic Courtès b20cd80ff1
import: pypi: Allow imports of a specific version.
* 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.
2021-11-11 00:14:30 +01:00
Ricardo Wurmus 22b568de43
guix: Upgrade to Bioconductor 3.14.
* guix/build-system/r.scm (bioconductor-uri): Bump Bioconductor version to
3.14.
* guix/import/cran.scm (%bioconductor-version): Same.
2021-11-07 22:34:34 +00:00
Ludovic Courtès 859122e5ab
shell: Actually clean up the profile cache.
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.
2021-11-07 23:10:41 +01:00
Xinglu Chen b999c80c2e
import: egg: Allow imports of a specific version.
* 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>
2021-11-07 23:10:41 +01:00
Xinglu Chen 4b96998292
home: services: bash: Add ‘aliases’ field.
* 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>
2021-11-07 23:10:41 +01:00
Ludovic Courtès 4d59596a1c
ui: 'load*' correctly reports 'read-error' in all cases.
Previously, 'read-error' exceptions other than "missing closing paren"
would not be reported; instead, we'd directly call (exit 1) without
printing anything.

Fixes <https://issues.guix.gnu.org/51463>.
Reported by Alice BRENON <alice.brenon@ens-lyon.fr>.

* guix/ui.scm (report-load-error): Report the error without re-throwing
upon 'read-error'.
* tests/guix-build.sh: Add test.
2021-11-07 23:10:41 +01:00
Maxime Devos b0519cc4b0
utils: Define a target-x86-32? and target-x86-64? predicate.
* guix/utils.scm (target-x86-32?, target-x86-64?): New predicates.
* tests/utils.scm ("target-x86-32?", "target-x86-64?"): New tests.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-11-07 01:38:23 -04:00
Ludovic Courtès 5d2d87fed7
environment: Suggest command upon 'execlp' failure.
* 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'.
2021-11-06 23:01:21 +01:00
Ludovic Courtès 3c1158ac4e
profiles: Build the man database only if 'man-db' is in the profile.
This allows us to skip the expensive man-db profile hook in most cases.

Suggested by Liliana Marie Prikler <liliana.prikler@gmail.com>.

* guix/profiles.scm (manual-database/optional): New procedure.
(%default-profile-hooks): Use it instead of 'manual-database'.
* doc/guix.texi (Documentation): Add footnote about 'man -k' database
creation.
2021-11-06 23:01:21 +01:00
Ludovic Courtès d21353adea
import: elpa: Work around Guile 3.0.[5-7] compiler bug.
Fixes <https://issues.guix.gnu.org/49006>.
Reported by Xinglu Chen <public@yoctocell.xyz>.

* guix/import/elpa.scm (elpa-package->sexp)[melpa-recipe]: Add call to
'identity'.
2021-11-06 23:01:21 +01:00
Lars-Dominik Braun 5a9e7cdd32
import: stackage: Update to release 18.14.
* guix/import/stackage.scm (%default-lts-version): Update to 18.14.
2021-11-02 09:32:45 +01:00
Tobias Geerinckx-Rice 8f45555781
ui: Use DISPLAY in SHOW-GUIX-HELP.
* guix/ui.scm (show-guix-help): Use DISPLAY where FORMAT isn't needed.
2021-10-31 00:57:07 +02:00
Tobias Geerinckx-Rice 943dd59beb
ui: Add top-level options to help text.
This also makes automated ‘guix --h<Tab>’ completion possible.

* guix/ui.scm (show-guix-help): Document that an OPTION's an option,
and all valid options.
2021-10-31 00:57:07 +02:00
Ludovic Courtès 6f4ca78761
home: import: Avoid duplication of 'manifest->code'.
* 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.
2021-10-31 00:51:06 +02:00
Ludovic Courtès 96728c54df
home: import: Factorize triplicated 'version-spec' procedure.
* 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.
2021-10-31 00:51:06 +02:00
Ludovic Courtès f3933ae40d
home: import: Clarify "destination directory".
Suggested by Liliana Marie Prikler <liliana.prikler@gmail.com>.

* guix/scripts/home/import.scm (configurations+modules): Rename
'destination-directory' to 'configuration-directory'.  Improve
docstring.
2021-10-31 00:51:06 +02:00
Ludovic Courtès 341fba217f
home: import: Compare procedures with 'eq?'.
'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'.
2021-10-31 00:51:06 +02:00
Xinglu Chen ea19381bd9
guix home: import: Call ‘local-file’ with ‘name’
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>
2021-10-31 00:51:06 +02:00
Xinglu Chen 40acbaf078
Add tests for ‘guix home import’.
* tests/home-import.scm: New file.
* Makefile.am (SCM_TESTS): Add it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-31 00:51:05 +02:00
Xinglu Chen 256bd71264
guix home: import: Delete duplicate modules when importing.
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>
2021-10-31 00:51:05 +02:00
Xinglu Chen e12e8aad35
guix home: import: Don’t use 'slurp-file-gexp'.
‘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>
2021-10-31 00:51:05 +02:00
Xinglu Chen 3be1a982f3
guix home: import: Fix module name for Bash service.
* 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>
2021-10-31 00:51:05 +02:00
Xinglu Chen e4d09d25ae
guix home: import: Allow multiple modules to be imported for each service.
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>
2021-10-31 00:51:05 +02:00
Xinglu Chen d5eb05f01e
guix home: import: Make the user to specify a destination directory.
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>
2021-10-31 00:51:05 +02:00
Ludovic Courtès 98173af522
shell: Error out when an unauthorized guix.scm/manifest.scm is found.
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.
2021-10-30 19:12:40 +02:00
Ludovic Courtès e171182a20
packages: Optionally validate Texinfo markup at expansion time.
* guix/packages.scm (validate-texinfo): New macro.
(<package>)[synopsis, description]: Add 'sanitize' property.
2021-10-28 21:30:27 +02:00
Ludovic Courtès 6938d9f1c7
ui: Gracefully handle invalid Texinfo markup in package blurbs.
Previously 'guix search' & co. would crash when encountering invalid
Texinfo.

* guix/ui.scm (texi->plain-text*): New procedure.
(package-field-string, package->recutils): Use it.
2021-10-28 21:30:27 +02:00
Ludovic Courtès 2015d3f042
store: 'map/accumulate-builds' handler checks the store received.
This is a followup to b19250eec6,
providing a proper fix for <https://issues.guix.gnu.org/46756>.

* guix/remote.scm (remote-eval): Revert b19250eec6.
* guix/store.scm (build-accumulator): Turn into a procedure.  Call
CONTINUE when the store is not eq? to the initial store.
(map/accumulate-builds): Adjust accordingly.
* tests/store.scm ("map/accumulate-builds and different store"): New test.
2021-10-28 21:30:27 +02:00
Ludovic Courtès 219cf5093e
import: cran: Use the standard diagnostic procedures.
* guix/import/cran.scm (bioconductor-packages-list)
(fetch-description): Use 'warning' instead of 'format'.
2021-10-28 21:30:23 +02:00
Zhu Zihao bcc4aef0db
environment: Fix broken file-local variable.
* guix/scripts/environment.scm (Local Variables): Add missing eval.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-28 00:44:10 +02:00
Ludovic Courtès b19250eec6
remote: Really build things remotely when #:build-locally? is #false.
Fixes <https://issues.guix.gnu.org/46756>.
Reported by pkill9 <pkill9@runbox.com>,
Maxim Cournoyer <maxim.cournoyer@gmail.com>, and
Katherine Cox-Buday <cox.katherine.e@gmail.com>.

* guix/remote.scm (remote-eval): When BUILD-LOCALLY? is false, wrap
'build-derivations' call in 'with-build-handler'.
2021-10-28 00:44:10 +02:00
Ludovic Courtès 0a42998a50
syscalls: Gracefully handle failure to load libc's libutil.
In particular, libutil is not found when running code on a
statically-linked Guile.

Reported by mahmooz on #guix.

* guix/build/syscalls.scm (syscall->procedure): Add #:library parameter
and honor it.
(openpty, login-tty): Use 'syscall->procedure' instead of calling
'dynamic-link' directly.
2021-10-26 14:53:43 +02:00
Ludovic Courtès 409f538d65
shell: Suggest running '--check' once for interactive use.
* guix/scripts/shell.scm (hint-directory, hint-file, record-hint)
(hint-given?): New procedures.
(guix-shell): Record and probe the 'shell-check' hint.
2021-10-26 12:46:28 +02:00
Ludovic Courtès 9e46942c1c
environment: Add '--check'.
* 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'.
2021-10-26 12:46:27 +02:00
Ludovic Courtès f87371bf3e
syscalls: Add 'openpty' and 'login-tty'.
* guix/build/syscalls.scm (openpty, login-pty): New procedures.
* tests/syscalls.scm ("openpty", "openpty + login-tty"): New tests.
2021-10-26 12:46:27 +02:00
Ludovic Courtès b7b0ac8544
packages: Optimize 'package-transitive-supported-systems'.
With this change, the wall-clock time of:

  ./pre-inst-env guile -c '(use-modules (gnu) (guix)(ice-9 time)) (time (pk (fold-packages (lambda (p r)(supported-package? p)(+ 1 r)) 0)))'

goes from 3.2s to 2.0s, a 37% improvement.

* guix/packages.scm (package-transitive-supported-systems): Change
'supported-systems' to 'supported-systems-procedure', returning an
'mlambdaq' instead of the original 'mlambda'.  Add 'procs'.  Adjust body
accordingly.
2021-10-26 12:46:27 +02:00
Ludovic Courtès 9730692d9f
shell: Maintain a profile cache.
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'.
2021-10-25 19:02:33 +02:00
Ludovic Courtès 2cb0b3709a
cache: Gracefully handle non-existent cache.
* guix/cache.scm (maybe-remove-expired-cache-entries): Ignore ENOENT
when writing EXPIRY-FILE.
2021-10-25 19:02:33 +02:00