* guix/store/database.scm (%default-database-file): New variable.
(path-id): Export.
* guix/nar.scm (finalize-store-file): Use 'with-database' instead of
'with-store', and use 'path-id' instead of 'valid-path?'.
Fixes <http://bugs.gnu.org/19610>.
Reported by Mark H Weaver <mhw@netris.org>.
* guix/nar.scm (restore-one-item): Use 'read-latin1-string' to read the
signature.
* guix/pk-crypto.scm (string->canonical-sexp, sign, generate-key): Pass
the procedure name as the first argument to 'throw'.
(gcrypt-error-printer): New procedure.
<top level>: Add call to 'set-exception-printer!'.
* guix/nar.scm (restore-one-item): Add 'proc' parameter to 'catch'
handler for 'gcry-error.
* guix/scripts/archive.scm (%options, generate-key-pair, authorize-key):
Likewise.
* guix/scripts/substitute-binary.scm (narinfo-signature->canonical-sexp):
Likewise.
Prevents garbage collection of the temporary store directory while
restoring a file set, as it could previously happen:
<https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00167.html>.
* guix/nar.scm (temporary-store-directory): Rename to...
(temporary-store-file): ... this. Use 'add-permanent-root' instead of
'add-indirect-root'.
(with-temporary-store-file): New macro.
(restore-one-item): New procedure, with code formerly in
'restore-file-set'. Use 'with-temporary-store-file'.
(restore-file-set): Use it.
Problem reported by John Darrington <john@darrington.wattle.id.au>.
* guix/nar.scm (write-file): Filter out "." and ".." from the result of
'scandir'. Previously we did this by passing a suitable predicate.
* guix/nar.scm (restore-file-set)[assert-valid-signature]: Rewrite in
terms of 'signature-case'.
* guix/scripts/substitute-binary.scm (narinfo-signature->canonical-sexp):
Call 'leave' instead of 'raise' when SIGNATURE is invalid.
(&nar-signature-error, &nar-invalid-hash-error): Remove.
(assert-valid-signature): Add 'narinfo' parameter; remove 'port'.
Rewrite in terms of 'signature-case' and 'leave'. Mention NARINFO's
URI in error messages. Adjust caller.
(narinfo-sha256): New procedure.
(assert-valid-narinfo): Use it.
(valid-narinfo?): Rewrite using 'narinfo-sha256' and
'signature-case'.
* tests/substitute-binary.scm (assert-valid-signature,
test-error-condition): Remove.
("corrupt signature data", "unauthorized public key", "invalid
signature"): Remove.
* guix/nar.scm (write-file) <directory>: Pass 'string<?' as the second
argument to 'scandir'.
* tests/nar.scm ("write-file puts file in C locale collation order"):
New test.
* guix/scripts/hash.scm (show-help): Add --recursive.
(%options): Likewise.
(guix-hash)[file-hash]: New procedure. Honor --recursive.
Use it.
* guix/nar.scm (write-file): Add missing field to the &nar-error
condition raised upon unsupported file type; change its message to be
more descriptive.
* tests/guix-hash.sh: Add tests with -r.
* doc/guix.texi (Invoking guix hash): Document --recursive.
* guix/nar.scm (write-file): Add case for type `symlink'.
(restore-file): Likewise.
* tests/nar.scm (random-file-size, make-file-tree, delete-file-tree,
with-file-tree, file-tree-equal?, make-random-bytevector,
populate-file): New procedures.
(%test-dir): New variable.
("write-file + restore-file"): Use `%test-dir' and `file-tree-equal?'.
("write-file + restore-file with symlinks"): New test.
* guix/nar.scm (&nar-error, &nar-read-error): New condition types.
(dump): New procedure.
(write-contents)[dump]: Remove. Use the one above instead.
(read-contents, write-file, restore-file): New procedures.
(%archive-version-1): New variable.