* guix/tests.scm (derivation-narinfo): Turn 'nar' into a keyword
parameter. Add #:sha256 parameter, and honor it.
(call-with-derivation-narinfo): Add #:sha256 and pass it to
'derivation-narinfo'.
(with-derivation-narinfo): Extend with support for (sha256 => value).
* tests/store.scm ("substitute query"): Use 'with-derivation-narinfo'.
("substitute"): Likewise.
("substitute, corrupt output hash"): Likewise.
("substitute --fallback"): Likewise.
* tests/derivations.scm: Remove Emacs local variable.
This makes 'guix environment PACKAGE' significantly faster when
substitutes are enabled. Before that, it would lead to many invocations
of 'guix substitute-binary', one per 'derivation-prerequisites-to-build'
call. Now, all these are replaced by a single invocation.
* guix/derivations.scm (derivation-output-paths, substitution-oracle):
New procedures.
(derivation-prerequisites-to-build): Replace #:use-substitutes? with
#:substitutable?. Remove the local 'derivation-output-paths' and
'substitutable?'.
* guix/ui.scm (show-what-to-build): Add 'substitutable?'. Pass it to
'derivation-prerequisites-to-build'.
[built-or-substitutable?]: Use it instead of 'has-substitutes?'.
* tests/derivations.scm ("derivation-prerequisites-to-build and
substitutes"): Use #:substitutable? instead of #:use-substitutes?.
* guix/derivations.scm (derivation-output-names): New procedure.
(derivation-prerequisites-to-build): Use it for #:outputs.
(map-derivation): Likewise.
* tests/derivations.scm ("derivation-output-names"): New test.
* guix/tests.scm (derivation-narinfo, call-with-derivation-narinfo): New
procedures.
(with-derivation-narinfo): New macro.
* tests/derivations.scm ("derivation-prerequisites-to-build and
substitutes"): Use them.
* guix/derivations.scm (<graft>): New record type.
(graft-derivation): Rename 'replacements' to 'grafts', and expect it
to be a list of <graft> records. Adjust accordingly.
* tests/derivations.scm ("graft-derivation"): Use 'graft' instead of
pairs in argument to 'graft-derivation'.
* guix/derivations.scm (graft-derivation): New procedure.
* guix/build/graft.scm: New file.
* Makefile.am (MODULES): Add it.
* tests/derivations.scm ("graft-derivation"): New test.
* nix/nix-daemon/guix-daemon.cc (main): Set 'autoStoreOptimise' to
true. Add 'printMsg' call.
* tests/derivations.scm ("identical files are deduplicated"): New test.
* guix/derivations.scm (<derivation-output>): Add 'recursive?' field.
Adjust 'make-derivation-output' callers.
(%read-derivation) <fixed-output>: When HASH-ALGO starts with 'r:',
set the 'recursive?' field and drop 'r:' from the hash algo name.
(write-derivation)[write-output]: Write the algo as 'r:HASH-ALGO' when
the RECURSIVE? field is set.
(derivation-hash) <fixed-output>: Prepend "r:" when RECURSIVE? is set.
(fixed-output-path): New procedure.
(derivation): Add #:recursive? parameter. Use 'fixed-output-path' to
compute the output file name of a fixed output derivation.
(build-expression->derivation): Add #:recursive? parameter. Pass it
to 'derivation'.
* tests/derivations.scm ("fixed-output derivation, recursive",
"build-expression->derivation produces recursive fixed-output",
"build-expression->derivation uses recursive fixed-output"): New
tests.
* doc/guix.texi (Derivations): Document #:recursive? for 'derivation'.
Add #:recursive? for 'build-expression->derivation'.
* guix/derivations.scm (map-derivation)[input->output-paths]: Allow
non-derivation inputs.
Allow replacements to be store files. Replace in SOURCES too.
* tests/derivations.scm ("map-derivation, sources"): New test.
* tests/derivations.scm ("build-expression->derivation and
max-silent-time"): Use STORE instead of %STORE. Change BUILDER to
succeed by default. Return #f when no exception is raised.
* tests/derivations.scm ("build derivation with 1 source",
"derivation with local file as input",
"derivation with a fixed-output input",
"multiple-output derivation",
"multiple-output derivation, non-alphabetic order",
"user of multiple-output derivation"): Add %BASH as an input, needed
in chroot builds.
* guix/derivations.scm (derivation->output-path,
derivation->output-paths): New procedures.
(derivation-path->output-path): Use 'derivation->output-path'.
(derivation-path->output-paths): Use 'derivation->output-paths'.
(derivation): Accept 'derivation?' objects as inputs. Return a single
value.
(build-derivations): New procedure.
(compiled-modules): Use 'derivation->output-paths'.
(build-expression->derivation)[source-path]: Add case for when the
input matches 'derivation?'.
[prologue]: Accept 'derivation?' objects in INPUTS.
[mod-dir, go-dir]: Use 'derivation->output-path'.
* guix/download.scm (url-fetch): Adjust to the single-value return.
* guix/packages.scm (package-output): Use 'derivation->output-path'.
* guix/scripts/build.scm (guix-build): When the argument is
'derivation-path?', pass it through 'read-derivation'.
Use 'derivation-file-name' to print out the .drv file names, and to
register them. Use 'derivation->output-path' instead of
'derivation-path->output-path'.
* guix/scripts/package.scm (roll-back): Adjust to the single-value
return.
(guix-package): Use 'derivation->output-path'.
* guix/ui.scm (show-what-to-build): Adjust to deal with 'derivation?'
objects instead of .drv file names.
* gnu/system/grub.scm (grub-configuration-file): Use
'derivation->output-path' instead of 'derivation-path->output-path'.
* gnu/system/vm.scm (qemu-image, system-qemu-image): Likewise.
* tests/builders.scm, tests/derivations.scm, tests/packages.scm,
tests/store.scm, tests/union.scm: Adjust to the new calling
convention.
* doc/guix.texi (Defining Packages, The Store, Derivations): Adjust
accordingly.
* guix/derivations.scm (<derivation>): Add 'file-name' field.
(%read-derivation): Use (port-filename DRV-PORT) as the file name for
the result.
(derivation): Set the 'file-name' field in the result.
* tests/derivations.scm ("build derivation with 1 source"): Assert that
'derivation-file-name' returns the right thing.
* guix/derivations.scm (derivation, build-expression->derivation):
Rename #:dependency-graphs to #:references-graphs, for consistency in
the terminology.
* tests/derivations.scm: Adjust accordingly.
* guix/derivations.scm (derivation): Add `dependency-graphs' keyword
parameter; honor it.
* tests/derivations.scm (bootstrap-binary): New procedure.
(%bash): Use it.
(%mkdir): New variable.
(directory-contents): Add `slurp' optional parameter.
("derivation with #:dependency-graphs"): New test.
* doc/guix.texi (Derivations): Update accordingly.
* guix/derivations.scm (derivation-input-output-paths): New procedure.
(derivation-prerequisites-to-build): New `use-substitutes?' keyword
argument. Change two return the list of substitutable paths as a
second argument.
* guix/ui.scm (show-what-to-build): Turn `dry-run?' into a keyword
argument. New `use-substitutes?' keyword argument. Use `fold2' and
adjust to use both return values of
`derivation-prerequisites-to-build'. Display what will/would be
downloaded.
* guix/scripts/build.scm (guix-build): Adjust accordingly.
* guix/scripts/package.scm (guix-package): Likewise.
* tests/derivations.scm ("derivation-prerequisites-to-build and
substitutes"): New test.
* tests/derivations.scm ("derivation with local file as input"): Return
a Boolean instead of a bytevector. Don't attempt to compare the
content of the result with that of the input.
* 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.
Before it would list inputs not built, even if the outputs of the given
derivation were already available.
* guix/derivations.scm (derivation-prerequisites-to-build): Add
`outputs' keyword parameter.
[built?, derivation-built?]: New procedures.
[loop]: Add `sub-drvs' parameter. Use `derivation-built?' to check if
the SUB-DRVS of DRV are built before checking its inputs.
* tests/derivations.scm (%bash): New variable.
Replace occurrences of "/bin/sh" by %BASH.
* tests/union.scm ("union-build"): Delete duplicates from
%BOOTSTRAP-INPUTS.
* tests/builders.scm (network-reachable?): New variable.
("url-fetch", "gnu-build"): Skip unless NETWORK-REACHABLE?.
* tests/derivations.scm (%coreutils): Check for network access.
("build-expression->derivation with one input"): Skip when %COREUTILS
is #f.
* tests/guix-package.sh: Skip installation of GNU Make when the network
is unreachable.
* tests/packages.scm ("GNU Make, bootstrap"): Likewise.
* tests/union.scm ("union-build"): Likewise.
* guix/derivations.scm (derivation)[inputs]: Fix typo in call to
`add-to-store'.
* tests/derivations.scm ("derivation with local file as input"): New test.
* tests/packages.scm ("trivial with local file as input"): New test.
* tests/derivations.scm ("build-expression->derivation for fixed-output
derivation"): Remove test. It is redundant with that in builders.scm,
and doesn't work out of the box with the statically-linked
%BOOTSTRAP-GUILE.
* guix/derivations.scm (build-expression->derivation)[source-path]: New
procedure.
[builder]: Pass only sources as references. This fixes a bug whereby
changing a fixed-output drv referred to by a builder would cause the
builder's hash to change, thereby leading to a full rebuild.
* tests/derivations.scm ("build-expression->derivation with a
fixed-output input"): New test.
* tests/derivations.scm ("fixed-output derivation"): Add comment that
the reference to BUILDER is optional.
("fixed-output derivation: output paths are equal",
"derivation with a fixed-output input",
"build-expression->derivation: same fixed-output path"): New tests.