* guix/derivations.scm (substitution-oracle): Add #:mode parameter and
honor it.
(derivation-prerequisites-to-build): Likewise.
[derivation-built?]: Take it into account.
* guix/ui.scm (show-what-to-build): Add #:mode parameter. Pass it to
'substitute-oracle' and 'derivations-prerequisites-to-build'.
* tests/derivations.scm ("derivation-prerequisites-to-build in 'check'
mode"): New test.
Before that, "guix build qt", when only qt itself is missing, would lead
'substitution-oracle' to call 'substitutable-paths' with 318 items.
Now, this is down to 6 items, because it doesn't ask about prerequisites
that are already valid.
* guix/derivations.scm (substitution-oracle)[valid-input?,
dependencies]: New procedures.
Use 'dependencies' and remove call to 'remove'.
* guix/derivations.scm (valid-derivation-input?): New procedure.
(derivation-prerequisites): Add 'cut?' parameter and honor it.
* tests/derivations.scm ("derivation-prerequisites and
derivation-input-is-valid?"): New test.
Fixes <http://bugs.gnu.org/20188>.
Reported by Mark H Weaver <mhw@netris.org>.
* guix/derivations.scm (substitution-oracle): Add 'valid?' procedure.
Remove 'valid?' items from PATHS.
Fixes <http://bugs.gnu.org/19630>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.
* guix/derivations.scm (&derivation-error,
&derivation-missing-output-error): New error conditions.
(derivation->output-path): Raise a '&derivation-missing-output-error'
if OUTPUT is not an output of DRV.
* guix/ui.scm (call-with-error-handling): Add case for
'derivation-missing-output-error?'.
(show-what-to-build): Check whether (derivation-outputs drv) is
empty.
* tests/packages.scm ("reference to non-existent output"): Add test.
This yields a 46% improvement in 'derivation-prerequisites' invocations
on the Emacs derivation.
* guix/derivations.scm (derivation-prerequisites): Add 'input-set'
variable, and use it in iterations.
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/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'.
This reduces run time of (package-derivation s emacs) by ~5%.
* guix/derivations.scm (search-path*): New procedure.
(imported-modules): Use it instead of 'search-path'.
This reduces run time of (package-derivation s emacs) by ~10%.
* guix/derivations.scm (derivation-path->base16-hash): New procedure.
(derivation-hash): Use it.
* 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.
* guix/derivations.scm (build-expression->derivation): Add
#:allowed-references and pass it to 'derivation.
* doc/guix.texi (Derivations): Adjust accordingly.
* guix/derivations.scm (derivation->string): New procedure.
(derivation-hash, derivation): Use it.
Memoization here yields a 5% improvement on "guix build -e '(@ (gnu
packages emacs) emacs)' -n --no-substitutes".
* gnu/packages/gcc.scm (gcc-4.7): Change /nix/store in comment.
* gnu/system/vm.scm (operating-system-default-contents):
Use (%store-prefix) instead of "/nix/store".
* guix/derivations.scm (derivation-path->output-path,
derivation-path->output-paths): Change to /gnu/store in docstring.
* 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 (derivation): Add #:local-build? parameter and
honor it.
(build-expression->derivation): Likewise.
* doc/guix.texi (Derivations): Update documentation of these
procedures.
* 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.
* 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-hash): Add comment as to why we keep
the plain `sha256' call.
* guix/scripts/download.scm (guix-download): Use `port-sha256' instead
of (compose sha256 get-bytevector-all).
* guix/scripts/refresh.scm (update-package): Likewise.
* 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.
This reduces the execution time of
"guix build -e '(@ (gnu packages emacs) emacs)' -d" by 6%, from
1.15s to 1.08s.
* guix/derivations.scm (build-expression->derivation): Write the builder
as UTF-8.
This reduces the execution time of
"guix build -e '(@ (gnu packages emacs) emacs)' -d" by 25%, from
1.54 s. to 1.15s.
* guix/derivations.scm (write-sequence, write-list, write-tuple): New
procedures.
(write-derivation)[list->string, write-list]: Remove.
[write-string-list, write-output, write-input, write-env-var]: New helpers.
Rewrite in terms of these new helpers.
* guix/derivations.scm (read-derivation): Rename to...
(%read-derivation): ... this.
(read-derivation): New procedure.
This reduces the execution of "guix-build gdb" from 2.5s to 1.7s.
* 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.
* 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.
* 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.
* guix/derivations.scm (imported-files): Call
`build-expression->derivation' with SYSTEM, not (%current-system).
(build-expression->derivation): Pass SYSTEM to `imported-modules' and
`compiled-modules'.
* 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 (%guile-for-build): Use `nixpkgs-derivation*'
instead of `nixpkgs-derivation'.
(build-expression->derivation): New `guile-for-build' keyword
parameter. Use it.
* 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/derivations.scm (build-expression->derivation)[module-form?]: New
procedure.
[prologue]: Add any form of EXP that matches MODULE-FORM?.
[builder]: Remove any MODULE-FORM? from EXP.
* 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 (build-expression->derivation): Add all of INPUTS
as inputs to the final derivation.
* guix/build/gnu-build-system.scm, guix/build/utils.scm,
guix/gnu-build-system.scm: New files.
* tests/builders.scm ("gnu-build"): New test.
* 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-modules): New procedure.
(build-expression->derivation): New keyword argument `modules'.
Use `imported-modules' when MODULES is non-empty, and pass it with
`-L' to GUILE.
* guix/build/http.scm, guix/http.scm, tests/builders.scm: New files.
* 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/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.