* guix/derivations.scm (%guile-for-build): Initialize to #f.
(imported-files, imported-modules, compiled-modules): Add `guile'
keyword parameter. Pass it down to `build-expression->derivation'.
(build-expression->derivation)[guile-drv]: New variable. Pass it as
the #:guile parameter for `imported-modules' and `compiled-modules'.
* tests/derivations.scm: Set %GUILE-FOR-BUILD to the derivation of
%BOOTSTRAP-GUILE.
* guix/derivations.scm (imported-files)[parent-dirs]: Move to...
(parent-directories): ... here. New procedure.
(compiled-modules): New procedure.
(build-expression->derivation): Use it.
* tests/derivations.scm ("build-expression->derivation with modules"):
New test.
* guix/derivations.scm (write-derivation)[coalesce-duplicate-inputs]:
New procedure.
Use it to process INPUTS.
* tests/derivations.scm ("user of multiple-output derivation"): New
test.
* guix/derivations.scm (derivation-prerequisites,
derivation-prerequisites-to-build): New procedures.
* tests/derivations.scm ("build-expression->derivation and
derivation-prerequisites", "build-expression->derivation and
derivation-prerequisites-to-build"): New tests.
* guix/store.scm (valid-path?): New procedure.
* tests/builders.scm ("http-fetch", "gnu-build"): Use it.
* tests/derivations.scm ("add-to-store, flat", "add-to-store,
recursive", "derivation with no inputs", "build derivation with 1
source", "build derivation with coreutils",
"build-expression->derivation with expression returning #f"):
Likewise.
* guix/derivations.scm (build-expression->derivation)[builder]: Pass the
result of EXP to `exit'.
* tests/derivations.scm ("build-expression->derivation with expression
returning #f"): New test.
* guix/derivations.scm (build-expression->derivation): Change to expect
INPUTS to have the form (NAME DRV-PATH SUB-DRV) or (NAME DRV-PATH),
instead of (NAME . DRV-PATH). Update callers accordingly.
* guix/gnu-build-system.scm, tests/builders.scm, tests/derivations.scm:
Update accordingly.
* guix/derivations.scm (imported-files)[builder]: For TAIL, check
whether it exists before (mkdir TAIL).
* tests/derivations.scm ("imported-files"): Add file with a common
prefix.
* guix/derivations.scm (imported-files): New procedure.
(build-expression->derivation): Correctly handle inputs that are
sources and not derivation paths.
* tests/derivations.scm ("imported-files"): New test.
* guix/utils.scm (gnu-triplet->nix-system): New procedure.
(%current-system): New variable.
* tests/utils.scm ("gnu-triplet->nix-system"): New test.
* tests/derivations.scm (%current-system): Remove. Update users to
use (%current-system) instead.
* guix/derivations.scm (build-expression->derivation): Add `outputs'
keyword parameter; pass it to `derivation'. Define `%outputs' in the
prologue.
* tests/derivations.scm ("build-expression->derivation with two
outputs"): New test.
* guix/derivations.scm (build-expression->derivation): Pass HASH and
HASH-ALGO to `derivation'.
* tests/derivations.scm ("build-expression->derivation for fixed-output
derivation"): New test.
* guix/derivations.scm (read-derivation)[outputs->alist]: For
fixed-outputs, convert HASH with `base16-string->bytevector'.
(write-derivation): Likewise, convert HASH-ALGO to a string and HASH
to a base16 string.
(derivation-hash): Expect HASH to be a bytevector, not a string;
convert HASH with `bytevector->base16-string'.
* tests/derivations.scm ("fixed-output derivation"): New test.
* guix/derivations.scm (%guile-for-build): New parameter.
(build-expression->derivation): New procedure.
* tests/derivations.scm ("build-expression->derivation without inputs",
"build-expression->derivation with one input"): New tests.
* guix/derivations.scm (derivation-path->output-path): New procedure.
(derivation-hash): Call `memoize'. In the fixed-output case, convert
HASH-ALGO to a string. In the other case, sort inputs in the
alphabetical order of their hex hash. For inputs with no sub-drvs,
add "out" as the sub-drv.
* guix/utils.scm (%nixpkgs-directory): New parameter.
(nixpkgs-derivation, memoize): New procedures.
* tests/derivations.scm ("build derivation with 1 source"): Remove
useless shebang.
(%coreutils): New variable.
("build derivation with coreutils"): New test.
* guix/store.scm (%store-prefix): New parameter.
(store-path?, derivation-path?): New procedures.
* guix/derivations.scm (write-derivation): Pass SOURCES through
`object->string'.
(compressed-hash, store-path, output-path, derivation): New
procedures.
* tests/derivations.scm (%store): New global variable.
("derivation with no inputs"): New test.
* guix/derivations.scm: Export `read-derivation' and `write-derivation'.
* srfi/srfi-64.scm, srfi/srfi-64.upstream.scm: New files, from libchop.
* tests/derivations.scm, tests/test.drv: New files.