Commit Graph

71 Commits

Author SHA1 Message Date
Ludovic Courtès bb31e0a3ee store: Change #:store parameter to #:prefix.
* guix/store.scm (register-path): Change #:store to #:prefix.
2014-05-18 22:27:22 +02:00
Ludovic Courtès e901ef297d store: Add #:store parameter to 'register-path'.
* guix/store.scm (register-path): Add #:store and honor it.
2014-05-17 00:08:39 +02:00
Ludovic Courtès eee2127109 store: (direct-store-path? (%store-prefix)) returns #f.
* guix/store.scm (direct-store-path?): Return #f if PATH
  is (%store-prefix).
* tests/store.scm ("direct-store-path?"): Add test.
2014-04-28 23:24:18 +02:00
Ludovic Courtès a9d2a10546 store: Add 'add-permanent-root' and 'remove-permanent-root'.
* guix/store.scm (add-indirect-root): Improve docstring.
  (%gc-roots-directory): New variable.
  (add-permanent-root, remove-permanent-root): New procedures.
* tests/store.scm ("permanent root"): New test.
2014-04-12 22:32:10 +02:00
Ludovic Courtès 11e7a6cf46 store: Add 'hash-part->path'.
* guix/store.scm (hash-part->path): New procedure.
* tests/store.scm ("hash-part->path"): New test.
2014-03-14 17:16:10 +01:00
Ludovic Courtès 6c20d1d0c3 store: Add #:timeout build option.
* guix/serialization.scm (write-string-pairs): New procedure.
* guix/store.scm (write-arg): Add 'string-pairs' case.
  (set-build-options): Add 'timeout' keyword parameter.  Honor it.
* tests/derivations.scm ("build-expression->derivation and timeout"):
  New test.
2014-03-09 23:01:18 +01:00
Ludovic Courtès f5768afa33 build: Change state and log directories to $localstatedir/.../guix.
* daemon.am (libstore_a_CPPFLAGS): Change /nix to /guix.
* guix/config.scm.in (%state-directory): Likewise.
* guix/store.scm (log-file): Likewise.
2014-03-09 22:10:01 +01:00
Ludovic Courtès cafb92d853 store: 'export-paths' doesn't export references of the given files.
This fixes a regression introduced in
99fbddf9a6 ("store: Change 'export-paths'
to always export in topological order.")

* guix/store.scm (export-paths): Define 'ordered' variable.  Iterate
  over it.
* tests/store.scm ("export/import paths, ensure topological order"): Add
  'file0'.  Adjust accordingly.
2014-03-07 00:19:03 +01:00
Ludovic Courtès 371e87d286 store: Use 'when' instead of 'if' in effectful context.
* guix/store.scm (set-build-options): Use 'when' instead of 'if'.
2014-02-27 22:24:02 +01:00
Ludovic Courtès d66b704b51 store: Add comments for the stracer.
* guix/store.scm (%worker-magic-1, %worker-magic-2): Add comments.
2014-02-12 00:03:20 +01:00
Ludovic Courtès 99fbddf9a6 store: Change 'export-paths' to always export in topological order.
* guix/store.scm (export-paths): Pass PATHS through
  'topologically-sorted' before iterating.
* tests/store.scm ("export/import paths, ensure topological order"): New
  test.
2014-02-10 23:36:42 +01:00
Ludovic Courtès 50add47748 store: Add 'topologically-sorted'.
* guix/store.scm (topologically-sorted): New procedure.
* tests/store.scm ("topologically-sorted, one item",
  "topologically-sorted, several items", "topologically-sorted, more
  difficult"): New tests.
2014-01-24 00:01:50 +01:00
Ludovic Courtès ce4a482983 store: Add 'with-store' convenience macro.
* guix/store.scm (with-store): New macro.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 6bfec3edf5 store: Add 'register-path' procedure.
* guix/store.scm (register-path): New procedure.
* tests/store.scm ("register-path"): New test.
* guix/config.scm.in (%guix-register-program): New variable.
* configure.ac: Compute and substitute 'guix_sbindir'.  Compute
  'guix_prefix'.
* pre-inst-env.in: Define 'GUIX_REGISTER'.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 5674a3fdb6 store: Add comments for the %stderr constants.
* guix/store.scm (process-stderr): Add comments for the various
  constants, to help when stracing.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 1d6816f98c config: '%store-directory' always honors $NIX_STORE_DIR.
* guix/config.scm.in (%store-directory): Honor $NIX_STORE_DIR.
* guix/store.scm (%store-prefix): Use %store-directory directly.
2014-01-08 21:37:06 +01:00
Ludovic Courtès 80d0447c95 config: '%state-directory' always honors $NIX_STATE_DIR.
* guix/config.scm.in (%state-directory): Honor $NIX_STATE_DIR.
* guix/scripts/package.scm (%profile-directory): Use %state-directory
  directly.
* guix/store.scm (%default-socket-path, log-file): Likewise.
2014-01-08 21:12:55 +01:00
Ludovic Courtès 021a201f29 store: Fix 'log-file' to support uncompressed logs.
* guix/store.scm (log-file): Report the file without '.bz2' if it
  exists.
2014-01-08 19:23:33 +01:00
Ludovic Courtès 526382ff92 daemon: Implement signed archive import/export.
* guix/scripts/authenticate.scm, nix/scripts/guix-authenticate.in,
  tests/signing-key.pub, tests/signing-key.sec: New files.
* po/POTFILES.in: Add 'guix/scripts/authenticate.scm'.
* guix/store.scm (dump-port): New procedure.
  (process-stderr): Add 'user-port' optional parameter.  Handle
  the %STDERR-WRITE and %STDERR-READ cases as expected.
  (import-paths, export-path, export-paths): New procedures.
* tests/store.scm ("export/import several paths", "import corrupt
  path"): New tests.
* Makefile.am (MODULES): Add 'guix/scripts/authenticate.scm'.
  (EXTRA_DIST): Add 'tests/signing-key.{pub,sec}'.
* daemon.am (libstore_a_CPPFLAGS)[-DNIX_CONF_DIR]: Change 'NIX_CONF_DIR'
  to .../guix.  Change 'OPENSSL_PATH' to 'guix-authenticate'.
* config-daemon.ac: Instantiate 'nix/scripts/guix-authenticate'.
* nix/nix-daemon/guix-daemon.cc (main): Augment $PATH to include
  'settings.nixLibexecDir'.
* test-env.in: Export 'NIX_CONF_DIR' and 'NIX_LIBEXEC_DIR'.  Populate
  $NIX_CONF_DIR.
2013-12-20 17:17:42 +01:00
Ludovic Courtès 5c0f184536 store: Optimize 'store-path-package-name' and 'store-path-hash-part'.
* guix/store.scm (store-regexp*): New procedure.
  (store-path-package-name, store-path-hash-part): Use it.
2013-12-11 00:19:27 +01:00
Ludovic Courtès 9336e5b5e7 store: Make 'direct-store-path?' public.
* guix/store.scm (direct-store-path?): New procedure.
* guix/derivations.scm (derivation)[direct-store-path?]: Remove.
* tests/store.scm ("direct-store-path?"): New test.
2013-11-13 00:29:05 +01:00
Ludovic Courtès eddd4077a5 store: Add 'log-file' procedure.
* guix/store.scm (log-file): New procedure.
* tests/store.scm ("log-file, derivation", "log-file, output file
  name"): New tests.
2013-11-12 01:06:45 +01:00
Ludovic Courtès cfbf916045 store: The 'references' parameter of 'add-text-to-store' is now optional.
* guix/store.scm (add-text-to-store): Make 'references' optional.
* tests/store.scm ("dead-paths", "references"): Use 'add-text-to-store'
  with no optional argument.
* doc/guix.texi (The Store): Adjust accordingly.
2013-09-11 01:07:49 +02:00
Ludovic Courtès bf8e7fc502 store: Add a printer for <nix-server>.
* guix/store.scm (<nix-server>): Set a printer.
2013-09-02 00:20:14 +02:00
Ludovic Courtès 8c95b27ce6 store: Deal with unsupported `setsockopt' operation on GNU/Hurd.
* guix/store.scm (open-connection): Silently ignore ENOPROTOOPT on
  `setsockopt' calls, for the sake of GNU/Hurd.
  Reported by Matthew Lien <bluet@bluet.org> at
  <http://lists.gnu.org/archive/html/bug-guix/2013-07/msg00020.html>.
2013-07-04 22:49:00 +02:00
Ludovic Courtès 3f1e69395c store: Add `requisites'.
* guix/store.scm (fold-path, requisites): New procedures.
* tests/store.scm ("requisites"): New test.
2013-06-13 22:03:42 +02:00
Ludovic Courtès c3eb878f0b store: Test the `fallback?' store option.
* guix/store.scm (set-build-options): Rename #:try-fallback? to #:fallback?.
* tests/store.scm ("substitute --fallback"): New test.
2013-05-29 23:22:05 +02:00
Ludovic Courtès 0ff3e3aa9b daemon: Gracefully handle cases where the daemon does not return a status code.
* guix/store.scm (process-stderr): Check for EOF before doing (read-int p).
2013-04-20 10:53:31 +02:00
Ludovic Courtès 9adb6934f4 store: Remove unneeded and conflicting import.
* guix/store.scm: Remove unneeded (ice-9 rdelim) import.  In Guile 2.0.9
  that module exports `read-string', which conflicts with that of (guix
  serialization).
2013-04-12 18:22:41 +02:00
Ludovic Courtès 0f41c26f9b Add (guix nar) and (guix serialization).
* guix/store.scm (write-int, read-int, write-long-long, read-long-long,
  write-padding, write-string, read-string, read-latin1-string,
  write-string-list, read-string-list, write-store-path,
  read-store-path, write-store-path-list, read-store-path-list): Move to
  serialization.scm.
  (write-contents, write-file): Move to nar.scm.
* guix/nar.scm, guix/serialization.scm: New files.
* Makefile.am (MODULES): Add them.
2013-04-04 22:29:08 +02:00
Ludovic Courtès f65cf81a3c Add preliminary binary substituter.
* guix/scripts/substitute-binary.scm: New file.
* Makefile.am (MODULES): Add it.
* nix/scripts/substitute-binary.in: New file.
* config-daemon.ac: Produce nix/scripts/substitute-binary.
* daemon.am (nodist_pkglibexec_SCRIPTS): Add
  nix/scripts/substitute-binary.
* guix/store.scm (substitutable-path-info): Use the
  `query-substitutable-path-infos' RPC.
* nix/nix-daemon/guix-daemon.cc (main): Honor `NIX_SUBSTITUTERS'.
* pre-inst-env.in: Set `NIX_SUBSTITUTERS'.
* test-env.in: Leave `NIX_SUBSTITUTERS' unchanged.  Set
  `GUIX_BINARY_SUBSTITUTE_URL, and create
  $NIX_STATE_DIR/substituter-data.
  Run `guix-daemon' within `./pre-inst-env'.
* tests/store.scm ("substitute query"): New test.
2013-04-03 22:44:39 +02:00
Ludovic Courtès 2c6ab6ccd4 store: Add `store-path-hash-part'.
* guix/store.scm (store-path-hash-part): New procedure.
* tests/store.scm ("store-path-hash-part", "store-path-hash-part #f"):
  New tests.
2013-04-01 17:35:27 +02:00
Ludovic Courtès 128663e4c8 store: Really disable file name canonicalization for derivation inputs.
* guix/store.scm (write-contents)[call-with-binary-input-file]: Set
  %FILE-PORT-NAME-CANONICALIZATION to #f.
* gnu/packages.scm (search-patch, search-bootstrap-binary): Leave
  %FILE-PORT-NAME-CANONICALIZATION unchanged.  This reverts 9776ebb.
2013-03-22 23:15:34 +01:00
Ludovic Courtès 238f739777 store: Use `sendfile' when available.
* guix/store.scm (write-contents)[call-with-binary-input-file]: New
  procedure.
  Use `sendfile' instead of `dump' when available.  Add `size'
  parameter.
  (write-file): Update caller.
2013-03-22 23:15:34 +01:00
Ludovic Courtès ef86c39f27 ui: Gracefully report failures to connect to the daemon.
* guix/store.scm (&nix-connection-error): New condition type.
  (open-connection): Translate `system-error' during the `connect' call
  into `&nix-connection-error'.
* guix/ui.scm (call-with-error-handling): Add case for `nix-connection-error?'.
* guix/scripts/package.scm (guix-package): Move `open-connection' call
  within `with-error-handling'.
* guix/scripts/pull.scm (guix-pull): Likewise.
* guix/scripts/download.scm (guix-download): Move body within
  `with-error-handling'.
2013-03-07 19:44:14 +01:00
Ludovic Courtès fae31edcec store: Add queries for references & co.
* guix/store.scm (operation-id)[query-valid-derivers]: New value.
  (references, referrers, valid-derivers, query-derivation-outputs): New
  procedures.
* tests/store.scm ("references", "derivers"): New tests.
2013-02-27 22:40:35 +01:00
Ludovic Courtès 9fd72fb1ff store: Add the `%daemon-socket-file' parameter.
* guix/store.scm (%daemon-socket-file): New variable.
  (open-connection): Use it as the default value for FILE.
2013-02-18 21:53:59 +01:00
Ludovic Courtès 0f3d2504f7 store: Add substitute-related procedures.
* guix/store.scm (has-substitutes?, substitutable-paths,
  read-substitutable-path-list, substitutable-path-info): New
  procedures.
  (<substitutable>): New record type.
  (read-arg): Add `substitutable-path-info'.  Change `hash' pattern
  variable to `base16' literal.
* tests/store.scm ("no substitutes"): New test.
2013-02-04 08:58:48 +01:00
Ludovic Courtès 63193ebfdc store: Update to protocol 1.12.
* guix/store.scm (%protocol-version): Bump.
  (operation-id): Comment out `query-substitutable-path-info'.
  Rename `query-valid-paths' to `query-all-valid-paths'.  Add
  `query-path-from-hash-part', `query-substitutable-path-infos',
  `query-valid-paths', and `query-substitutable-paths'.
  (set-build-options): Add `binary-caches' keyword parameter.  When
  using a server >= 1.12, send the list of binary caches.
  (query-path-hash): Use the `store-path' type, for clarity.
2013-02-04 08:58:48 +01:00
Ludovic Courtès 238e43b9fa store: Write string length as a 32-bit integer.
* guix/store.scm (write-string): Write L as a 32-bit integer.  Bug
  introduced in 82c38fe64c ("store:
  Micro-optimize `write-string'.")
2013-02-04 08:58:47 +01:00
Ludovic Courtès bbdb3ffaf3 store: Don't expect build logs to be UTF-8-encoded.
* guix/store.scm (read-latin1-string): New procedure.
  (process-stderr): Use it instead of `read-string'.
  Reported by Andreas Enge <andreas@enge.fr>.
2013-01-31 17:49:54 +01:00
Ludovic Courtès fce2394e7d store: Slightly improve memoization hashing.
* guix/store.scm (open-connection): Call `make-hash-table' with 100.
  (add-text-to-store): Move TEXT first in ARGS, for better `hash'
  results.
  (add-to-store): Likewise, move ST first.
2013-01-30 17:05:54 +01:00
Ludovic Courtès a9ebd9efd0 store: Remove the `fixed?' parameter from `add-to-store'.
* guix/store.scm (add-to-store): Remove the `fixed?' parameter from the
  public interface.
* gnu/packages/bootstrap.scm, guix-download.in, guix/derivations.scm,
  guix/packages.scm, tests/derivations.scm: Update all callers
  accordingly.
2013-01-30 16:30:49 +01:00
Ludovic Courtès fd060fd30d store: Avoid use of `set!'.
* guix/store.scm (operation): New macro.
  (define-operation): Define in terms of `operation'.
  (add-text-to-store): Define using `operation', and remove now
  unnecessary `set!'.
  (add-to-store): Likewise.
  (add-text-to-store/cached, add-to-store/cached): Remove.
2013-01-30 16:22:33 +01:00
Ludovic Courtès 82c38fe64c store: Micro-optimize `write-string'.
* guix/store.scm (write-string): Optimize to write the length, contents,
  and padding all at once.  This yields a 2% improvement on the
  execution time of "guix-build gdb".
2013-01-30 00:37:26 +01:00
Ludovic Courtès bdcf35a6b2 store: Cache `add-text-to-store' results.
* guix/store.scm (<nix-server>)[atts-cache]: New field.
  (add-text-to-store/cached): New procedure.  Use it as a wrapper around
  `add-text-to-store'.
  When running "guix-build gdb", this reduces the number of RPCs from
  3048 to 289, and execution time from 4.7s to 2.6s.
2013-01-30 00:09:32 +01:00
Ludovic Courtès 2c3f47ee3a store: Make the `add-to-store' cache per-connection.
* guix/store.scm (<nix-server>)[ats-cache]: New field.
  (open-connection): Update accordingly.
  (add-to-store/cached): Use (nix-server-add-to-store-cache SERVER)
  instead of a weak hash table.
2013-01-30 00:09:32 +01:00
Ludovic Courtès a7b6ffee68 store: Make `add-to-store' memoizing.
* guix/store.scm (add-to-store/cached): New variable.
  Use it as the new `add-to-store'.
  This reduces the number of RPCs when doing "guix-build gdb" from 5009
  to 3053, and the execution time from 7s to 3.9s.
2013-01-29 00:16:18 +01:00
Ludovic Courtès e531ac2ad9 doc: Start documenting (guix store).
* doc/guix.texi (The Store): Populate.
  (Introduction): Add cross-reference.  Change "package store" to "the
  store".
2013-01-15 23:32:13 +01:00
Ludovic Courtès 34fcbe3a10 store: In `open-connection', process all the server's stderr.
* guix/store.scm (open-connection): Loop until `process-stderr' returns #t.
2013-01-13 22:27:00 +01:00