summaryrefslogtreecommitdiff
path: root/guix/store.scm
AgeCommit message (Expand)Author
2022-05-30store: 'map/accumulate-builds' preserves caches....Fixes <https://issues.guix.gnu.org/55721>. Starting from the switch to functional object caches ca. 9e5812ac59b01ff011ec0c5b0f437dfe85d6fcc7, we would be losing accumulated caches when aborting to the build handler. This patch fixes that. In particular, by preserving '%reference-cache-id', we avoid redundant 'query-references' RPCs, which accounted for a large part of the extra processing time. * guix/store.scm (build-accumulator): When returning an <unresolved> node, call 'set-store-connection-caches!' before and after to preserve caches. (map/accumulate-builds): Pass STORE as the first argument to the <unresolved> continuation. Ludovic Courtès
2022-05-29store: Record cache lookups in 'references/cached'....* guix/store.scm (references/cached): Add call to 'record-cache-lookup!'. Ludovic Courtès
2022-05-20guix: Remove duplicate definitions of dump-port....* guix/store.scm (dump-port): Remove procedure; autoload from (guix build utils) instead. * guix/store/deduplication.scm (dump-port): Remove procedure; unhide dump-port from (guix build utils). Ricardo Wurmus
2022-05-18store: Use a decaying cutoff in 'map/accumulate-builds'....This reduces the wall-clock time of: ./pre-inst-env guix system vm gnu/system/examples/desktop.tmpl -n from 2m13s to 53s (the timings depend on which derivations have already been built and are in store; in this case, many were missing). * guix/store.scm (default-cutoff): New variable. (map/accumulate-builds): Use it. Parameterize it in recursive calls to have decaying cutoff. Ludovic Courtès
2022-05-18store: 'mcached' users can specify a cache ID....Users of 'mcached' can now specify a cache ID; furthermore, the cache hit rate is automatically recorded for all the caches accessed with 'mcached'. * guix/store.scm (%max-store-connection-caches) (%store-connection-cache-names): New variables. (recorder-for-cache): New procedure. (record-cache-lookup!): Add 'cache-id' parameter and rewrite in terms of 'recorder-for-cache'. (lookup-cached-object): Add 'cache-id' parameter and honor it. (%mcached): Add #:cache parameter and honor it. (mcached): Add '=>' keyword and corresponding clauses. Ludovic Courtès
2022-02-08deprecation: Refine the old daemon deprecation warning message....* guix/deprecation.scm (warn-about-old-daemon): Mention a direct consequence of failing to upgrade the daemon. * guix/store.scm (build-things): Add a comment explaining the rationale to emit a deprecation warning for a daemon older than version 0x163. Suggested-by: Ricardo Wurmus <rekado@elephly.net> Maxim Cournoyer
2022-02-08store: Warn about daemon deprecation....* guix/deprecation.scm (warn-about-old-daemon): New procedure. * guix/store.scm (build-things): Use it to warn about old daemons. Mathieu Othacehe
2021-11-10store: 'mapm/accumulate-builds' does not compare stores with 'eq?'....Fixes <https://issues.guix.gnu.org/51732>. Regression introduced in 2015d3f042870860efef10e801b93eacc0742d38. The (eq? store expected-store) comparison doesn't work on this branch where the functional cache, with 'cache-object-mapping', is used extensively, thereby changing the store's object identity. * guix/store.scm (build-accumulator): Compare the socket of STORE and EXPECTED-STORE rather than the store themselves. Ludovic Courtès
2021-10-28store: 'map/accumulate-builds' handler checks the store received....This is a followup to b19250eec6f92308f237a09a43e8e3e2355345b9, providing a proper fix for <https://issues.guix.gnu.org/46756>. * guix/remote.scm (remote-eval): Revert b19250eec6f92308f237a09a43e8e3e2355345b9. * 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. Ludovic Courtès
2021-09-15store: 'map/accumulate-builds' processes the whole list in case of cutoff....Fixes <https://issues.guix.gnu.org/50264>. Reported by Lars-Dominik Braun <lars@6xq.net>. This fixes a regression introduced in fa81971cbae85b39183ccf8f51e8d96ac88fb4ac whereby 'map/accumulate-builds' would return REST (the tail of LST) without applying PROC on it. The effect would be that 'lower-inputs' in (guix gexp) would dismiss those elements, leading to derivations with correct builders but only a subset of the inputs they should have had. * guix/store.scm (map/accumulate-builds): Add #:cutoff parameter and remove 'accumulation-cutoff' variable. Call PROC on the elements of REST. * tests/store.scm ("map/accumulate-builds cutoff"): New test. Ludovic Courtès
2021-08-10store: Add 'map/accumulate-builds' cutoff to address pathological cases....Fixes <https://bugs.gnu.org/49439>. Reported by Ricardo Wurmus <rekado@elephly.net>. Previously, a command such as: guix environment pigx-scrnaseq could lead to unbounded memory growth and could even fail to complete when some items are missing from the store. This was because 'map/accumulate-builds' callees would keep making .drv build requests that were turned into <unresolved> nodes; in this case, there are often many identical build requests. Stopping accumulation earlier allows us to unlock the situation by proceeding with the first few build requests instead of spinning until we've accumulated all the build requests. * guix/store.scm (map/accumulate-builds): Define 'accumulation-cutoff'. Use a loop when iterating over LST and maintain a counter of unresolved nodes met so far; return when the counter exceeds ACCUMULATION-CUTOFF. Ludovic Courtès
2021-06-18Start enabling substitutes from bordeaux.guix.gnu.org....In addition to substitutes from ci.guix.gnu.org. There are more changes that can be made in the future, but these changes seem like a good start. * config-daemon.ac (guix_substitute_urls): Add https://bordeaux.guix.gnu.org. * guix/scripts/substitute.scm (%default-substitute-urls): Add http://bordeaux.guix.gnu.org. * guix/store.scm (%default-substitute-urls): Add bordeaux.guix.gnu.org. * doc/guix.texi: Adjust accordingly. * doc/contributing.texi: Adjust accordingly. Christopher Baines
2021-06-08store: 'references/cached' now uses a per-session cache....* guix/store.scm (%reference-cache): Remove. (%reference-cache-id): New variable. (references/cached): Rewrite in terms of it. Ludovic Courtès
2021-06-08store: Remove 'references/substitutes'....This procedure lost its only user in commit 710854304b1ab29332edcb76f3de532e0724c197. * guix/store.scm (references/substitutes): Remove. * tests/store.scm ("references/substitutes missing reference info") ("references/substitutes with substitute info"): Remove. Ludovic Courtès
2021-06-08store: Generalize cache lookup recording....* guix/store.scm (cache-lookup-recorder): New procedure. (record-cache-lookup!): Define in terms of it. Ludovic Courtès
2021-06-08store: Support dynamic allocation of per-connection caches....* guix/store.scm (<store-connection>)[object-cache]: Remove. [caches]: New field. (open-connection, port->connection): Adjust '%make-store-connection' calls accordingly. (%store-connection-caches, %object-cache-id): New variables. (allocate-store-connection-cache, vector-set) (store-connection-cache, set-store-connection-cache) (set-store-connection-caches!, set-store-connection-cache!): New procedures. (cache-object-mapping): Add #:cache parameter. (set-store-connection-object-cache!): Remove. (lookup-cached-object): Use 'store-connection-cache'. (run-with-store): Use 'store-connection-caches' and 'set-store-connection-caches!'. Ludovic Courtès
2021-06-01maint: Require Guile 3.0....* configure.ac: Require Guile 3.0. * doc/guix.texi (Requirements): Adjust accordingly. * gnu/packages/package-management.scm (guile2.2-guix): Remove. * guix/lint.scm (exception-with-kind-and-args?): Remove 'cond-expand'. * guix/scripts/deploy.scm (deploy-machine*): Likewise. * guix/store.scm (call-with-store): Likewise. * guix/swh.scm (http-get*, http-post*): Likewise. * guix/ui.scm (without-compiler-optimizations, guard*) (call-with-error-handling): Likewise. Ludovic Courtès
2021-05-08store: Export 'connect-to-daemon'....* guix/store.scm (connect-to-daemon): Make public. Improve docstring. Ludovic Courtès
2021-05-08store: 'open-connection' never returns #f....* guix/store.scm (open-connection)[handshake-error]: New procedure. Call it in code paths that would previously return #f. Ludovic Courtès
2021-02-23store: Micro-optimize object cache lookup....This avoids a closure allocation when 'lookup-cached-object' is called. * guix/store.scm (lookup-cached-object): Avoid optional/keyword arguments and inline. (%mcached): Adjust accordingly. Ludovic Courtès
2021-02-23store: Object cache profiling shows the number of entries....* guix/store.scm (record-cache-lookup!): Add 'size' variable; keep it up-to-date and display it. Ludovic Courtès
2021-02-04store: 'store-path-hash-part' really returns false for invalid file names....The "store-path-hash-part #f", due to a SRFI-64 bug, was marked as successful even though 'store-path-hash-part' was throwing an exception. * guix/store.scm (store-path-hash-part): Really return #f. Ludovic Courtès
2021-01-22store: Add 'find-roots' RPC....* guix/serialization.scm (read-string-pairs): New procedure. * guix/store.scm (read-arg): Add support for 'string-pairs'. (find-roots): New procedure. * tests/store.scm ("add-indirect-root and find-roots"): New test. Ludovic Courtès
2020-11-23store: Fix ensure-path docstring....Suggested by Ludovic Courtès. * guix/store.scm (ensure-path): Fix the docstring. Mathieu Othacehe
2020-11-22guix: store: Add ensure-path....* guix/store.scm (ensure-path): New procedure. Mathieu Othacehe
2020-09-02store: 'set-build-options' sends LC_MESSAGES, not LC_ALL....* guix/store.scm (set-build-options): Change #:locale default value to (setlocale LC_MESSAGES). Ludovic Courtès
2020-08-31ssh: 'send-files' displays a progress bar....* guix/store.scm (export-paths): Add #:start, #:progress, and #:finish parameters and honor them. * guix/ssh.scm (prepare-to-send, notify-transfer-progress) (notify-transfer-completion): New procedures. (send-files): Pass #:start, #:progress, and #:finish to 'export-paths'. Ludovic Courtès
2020-08-28store: 'with-store' returns as many values as its body....Fixes <https://bugs.gnu.org/42912>. Reported by Ricardo Wurmus <rekado@elephly.net>. * guix/store.scm (call-with-store)[thunk]: Wrap call to PROC in 'call-with-values'. * tests/store.scm ("with-store, multiple values"): New test. Ludovic Courtès
2020-06-26store: Use '=' instead of 'eqv?'....Fixes <https://bugs.gnu.org/42047>. Reported by Jan Nieuwenhuizen <janneke@gnu.org>. * guix/store.scm (open-connection): Use '=' instead of 'eqv?'. This works around <https://bugs.gnu.org/42060> while also being more accurate since the arguments are known to be integers. Ludovic Courtès
2020-06-09store: Use buffered I/O for all protocol writes...* guix/store.scm (run-gc) Use buffered output port. (export-path) Same. (add-file-tree-to-store) Same. (set-build-options): Same. Add explicit flush. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Lars-Dominik Braun
2020-05-14store: 'mapm/accumulate-builds' preserves '%current-target-system'....Fixes <https://bugs.gnu.org/41182>. * guix/store.scm (mapm/accumulate-builds): Pass #:system and #:target to 'run-with-store'. * tests/store.scm ("mapm/accumulate-builds, %current-target-system"): New test. * tests/guix-pack.sh: Add 'guix pack -d --target' test. Ludovic Courtès
2020-04-08Merge branch 'master' into core-updates... Conflicts: etc/news.scm gnu/local.mk gnu/packages/check.scm gnu/packages/cross-base.scm gnu/packages/gimp.scm gnu/packages/java.scm gnu/packages/mail.scm gnu/packages/sdl.scm gnu/packages/texinfo.scm gnu/packages/tls.scm gnu/packages/version-control.scm Marius Bakke
2020-04-05store: 'with-store' uses 'with-exception-handler'....This ensures the stack is not unwound before the exception is re-thrown, as was the case since 8ed597f4a261fe188de82cd1f5daed83dba948eb, leading to '&store-protocol-error' being uncaught by 'with-error-handling' in (guix scripts build) & co. * guix/store.scm (call-with-store): Define 'thunk'. Add 'cond-expand' to use 'with-exception-handler' on 'guile-3' and 'catch' otherwise. Ludovic Courtès
2020-04-04store: 'with-store' doesn't close the store upon abort....Fixes <https://bugs.gnu.org/40428>. Reported by Marius Bakke <mbakke@fastmail.com> and 白い熊. Regression introduced with the first uses of 'with-build-handler' in commit 62195b9a8fd6846117c5d7698842748300d13e31 and subsequent. * guix/store.scm (call-with-store): Use 'catch #t' instead of 'dynamic-wind'. This ensures STORE remains open when a non-local exit other than an exception occurs, such as an abort to the build handler prompt. * tests/store.scm ("with-build-handler + with-store"): New test. Ludovic Courtès
2020-03-30Merge branch 'master' into core-updates... Conflicts: gnu/packages/admin.scm gnu/packages/commencement.scm gnu/packages/guile.scm gnu/packages/linux.scm gnu/packages/package-management.scm gnu/packages/pulseaudio.scm gnu/packages/web.scm Marius Bakke
2020-03-29store: Add 'references/cached'....* guix/store.scm (references/cached): New procedure. Ludovic Courtès
2020-03-29store: Add 'map/accumulate-builds'....* guix/store.scm (<unresolved>): New record type. (build-accumulator, map/accumulate-builds, mapm/accumulate-builds): New procedures. * tests/store.scm ("map/accumulate-builds", "mapm/accumulate-builds"): New tests. Ludovic Courtès
2020-03-27Merge branch 'master' into core-updates... Conflicts: gnu/packages/icu4c.scm gnu/packages/man.scm gnu/packages/python-xyz.scm guix/scripts/environment.scm guix/scripts/pack.scm guix/scripts/package.scm guix/scripts/pull.scm guix/store.scm Marius Bakke
2020-03-22store: Add 'with-build-handler'....* guix/store.scm (current-build-prompt): New variable. (call-with-build-handler, invoke-build-handler): New procedures. (with-build-handler): New macro. * tests/store.scm ("with-build-handler"): New test. Ludovic Courtès
2020-03-18Merge branch 'master' into core-updatesMarius Bakke
2020-03-14store: Fix many guix commands failing on some locales....Partly fixes <https://bugs.gnu.org/39970>. At least 'guix environment', 'guix install' and 'guix pull' on 'az_AZ.utf8' and 'tr_TR.utf8' were affected. * guix/store.scm (store-path-hash-part): Move base path detection to ... (store-path-base): ... this new exported procedure. (store-path-package-name): Use it instead of locale-dependent regexps. (store-regexp*): Remove. Florian Pelz
2020-03-08store: Add set-current-target procedure....* guix/store.scm (set-current-target): New exported procedure. Mathieu Othacehe
2020-03-06store: Add set-current-target procedure....* guix/store.scm (set-current-target): New exported procedure. Mathieu Othacehe
2020-01-30gexp: Move 'file-mapping->tree' to (guix store)....* guix/gexp.scm (%not-slash): Remove. (file-mapping->tree): Move to... * guix/store.scm (file-mapping->tree): ... here. Ludovic Courtès
2019-12-29profiles: Fix profile-derivation cross-compilation....* guix/store.scm (current-target-system): New exported monadic procedure. * guix/profiles.scm (profile-derivation): Set target at bind time using the above procedure. Mathieu Othacehe
2019-12-26profiles: Fix profile-derivation cross-compilation....* guix/store.scm (current-target-system): New exported monadic procedure. * guix/profiles.scm (profile-derivation): Set target at bind time using the above procedure. Mathieu Othacehe
2019-11-26Use 'offload?' instead of 'build-hook?' internally....* guix/scripts/archive.scm (%default-options): Replace 'build-hook?' with 'offload?'. * guix/scripts/build.scm (set-build-options-from-command-line): Pass #:offload? instead of #:use-build-hook?. (%standard-build-options): Use the 'offload? key instead of 'build-hook?. (%default-options): Replace 'build-hook?' with 'offload?'. * guix/scripts/copy.scm (%default-options): Likewise. * guix/scripts/deploy.scm (%default-options): Likewise. * guix/scripts/environment.scm (%default-options): Likewise. * guix/scripts/pack.scm (%default-options): Likewise. * guix/scripts/package.scm (%default-options): Likewise. * guix/scripts/pull.scm (%default-options): Likewise. * guix/scripts/system.scm (%default-options): Likewise. * guix/scripts/time-machine.scm (%default-options): Likewise. * guix/store.scm (set-build-options): Have #:use-build-hook? default to *unspecified*. Add #:offload?. Add call to 'warn-about-deprecation' when #:use-build-hook? is specified. Ludovic Courtès
2019-10-27store: Allow objects in the cache to be inserted and search for with 'equal?'....* guix/store.scm (cache-object-mapping): Add #:vhash-cons parameter and honor it. (lookup-cached-object): Add #:vhash-fold* parameter and honor it. (%mcached): Add #:vhash-fold* and #:vhash-cons and honor them. (mcached): Add clauses with 'eq?' and 'equal?' as the first argument. Ludovic Courtès
2019-10-16daemon: Make 'profiles/per-user' non-world-writable....Fixes <https://bugs.gnu.org/37744>. Reported at <https://www.openwall.com/lists/oss-security/2019/10/09/4>. Based on Nix commit 5a303093dcae1e5ce9212616ef18f2ca51020b0d by Eelco Dolstra <edolstra@gmail.com>. * nix/libstore/local-store.cc (LocalStore::LocalStore): Set 'perUserDir' to #o755 instead of #o1777. (LocalStore::createUser): New function. * nix/libstore/local-store.hh (LocalStore): Add it. * nix/libstore/store-api.hh (StoreAPI): Add it. * nix/nix-daemon/nix-daemon.cc (performOp): In 'wopSetOptions', add condition to handle "user-name" property and honor it. (processConnection): Add 'userId' parameter. Call 'store->createUser' when userId is not -1. * guix/profiles.scm (ensure-profile-directory): Note that this is now handled by the daemon. * guix/store.scm (current-user-name): New procedure. (set-build-options): Add #:user-name parameter and pass it to the daemon. * tests/guix-daemon.sh: Test the creation of 'profiles/per-user' when listening on a TCP socket. * tests/store.scm ("profiles/per-user exists and is not writable") ("profiles/per-user/$USER exists"): New tests. Ludovic Courtès
2019-07-05store: 'run-with-store' gracefully deals with #f store....This is a followup to dd0ee954c4fa965023fd887452927c02edb8b52f, which introduced a failure in tests/graph.scm. * guix/store.scm (run-with-store): Check whether STORE and NEW-STORE are true before calling 'store-connection-object-cache' etc. Fixes a failure in tests/graph.scm related to %REVERSE-PACKAGE-NODE-TYPE, which uses #f as the store. Ludovic Courtès