Reported-by: Ludovic Courtès <ludo@gnu.org>.
* guix/scripts/build.scm (guix-build),
guix/scripts/package.scm (guix-package): Duplicate port before handing it to
build-output-port.
* guix/ui.scm (print-unbound-variable-error): Add "error:" to the
message.
(report-unbound-variable-error): New procedure, with code formerly in
'report-load-error'.
(report-load-error): Use it.
(call-with-unbound-variable-handling): New procedure.
(with-unbound-variable-handling): New macro.
* guix/scripts/build.scm (options->derivations): Wrap body in
'with-unbound-variable-handling'.
* tests/guix-build.sh (GUIX_PACKAGE_PATH): Add test.
Previously 'guix build --log-file' would print a backtrace upon X.509
certificate verification errors.
* guix/scripts/build.scm (log-url): Catch 'tls-certificate-error' in
addition to 'getaddrinfo-error'.
* guix/scripts/build.scm (numeric-extension?, tarball-base-name): New
procedures, formerly in 'package-with-source'.
(transform-package-source)[new-sources]: Look for '=' in URI. Each
element of the list of now a (PKG VERSION SOURCE) tuple.
Pass VERSION to 'package-with-source'.
(package-with-source): Add 'version' parameter and honor it.
* tests/scripts-build.scm ("options->transformation, with-source, PKG=URI")
("options->transformation, with-source, PKG@VER=URI"): New tests.
* doc/guix.texi (Package Transformation Options): Document the new
forms.
This is a follow-up to commit fb1db38547.
* guix/scripts/build.scm (lazy-util): Remove procedure.
(options->things-to-build): Remove special case for files with ".json"
extension.
This avoids the open/fstat/close syscalls upon a cache hit that we had
with the previous idiom:
(call-with-input-file file read-derivation)
where caching happened in 'read-derivation' itself.
* guix/derivations.scm (%read-derivation): Rename to...
(read-derivation): ... this.
(read-derivation-from-file): New procedure.
(derivation-prerequisites, substitution-oracle)
(derivation-prerequisites-to-build):
(derivation-path->output-path, derivation-path->output-paths):
(derivation-path->base16-hash, map-derivation): Use
'read-derivation-from-file' instead of (call-with-input-file …
read-derivation).
* guix/grafts.scm (item->deriver): Likewise.
* guix/scripts/build.scm (log-url, options->things-to-build): Likewise.
* guix/scripts/graph.scm (file->derivation): Remove.
(derivation-dependencies, %derivation-node-type): Use
'read-derivation-from-file' instead.
* guix/scripts/offload.scm (guix-offload): Likewise.
* guix/scripts/perform-download.scm (guix-perform-download): Likewise.
* guix/scripts/publish.scm (load-derivation): Remove.
(narinfo-string): Use 'read-derivation-from-file'.
Reported by Chris Webber.
* guix/scripts/build.scm (register-root): If ROOT is absolute, keep it
as is.
* guix/scripts/environment.scm (register-gc-root): Likewise.
* tests/guix-environment.sh (expected): Add test.
This lets the daemon use its own default settings unless otherwise
specified.
* guix/scripts/build.scm (set-build-options-from-command-line): Do not
provide default values for #:build-cores and #:max-build-jobs.
(%default-options): Remove 'max-silent-time'.
* guix/scripts/build.scm (package-with-source): Set 'replacement' to #f.
* tests/scripts-build.scm ("options->transformation, with-source,
replacement"): New test.
* guix/scripts/build.scm (evaluate-replacement-specs): New procedure.
(transform-package-inputs)[not-equal]: Remove.
[replacements]: Define in terms of 'evaluate-replacement-specs'.
* guix/scripts/archive.scm, guix/scripts/build.scm,
guix/scripts/environment.scm, guix/scripts/system.scm,
guix/scripts/package.scm: Disable grafting when a dry-run parameter is given.
* guix/scripts/build.scm: Use the right 'package-name->name+version'
procedure. Fixes a regression introduced in
1b846da8c3.
* tests/scripts-build.scm ("options->transformation, with-source, with
version"): New test.
This fixes a bug whereby, with grafts leading to builds very early,
build options such as --substitute-urls would not be taken into account
yet.
Reported by Andreas Enge <andreas@enge.fr>.
* guix/scripts/build.scm (guix-build): Move 'opts' to the beginning.
Use 'with-store' instead of 'open-connection'. Call
'set-build-options-from-command-line' right after 'with-store'.
Reported by Mark H Weaver.
* guix/scripts/build.scm (options->derivations): When SRC and GRAFT? are
true, use the source of P's replacement.
* tests/guix-build.sh: Add test.
* guix/scripts/build.scm (transform-package-source): Return a procedure
that expects a single object rather than a list of packages.
(options->transformation): Rewrite to precompute the list of applicable
transformations and to return a procedure that expects a single object
rather than a list of objects.
(options->derivations): Adjust accordingly.
* tests/scripts-build.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
* guix/scripts/build.scm (options/resolve-packages): Remove.
(options->things-to-build, transform-package-source): New procedure.
(%transformations): New variable.
(options->transformation): New procedure.
(options->derivations): Rewrite to use 'options->things-to-build' and
'options->transformation'.
Partly fixes <http://bugs.gnu.org/20217>.
* guix/store.scm (set-build-options): Change #:substitute-urls to
default to #f. Send the 'substitute-urls' pair only if
SUBSTITUTE-URLS is true.
* guix/scripts/build.scm (set-build-options-from-command-line): Do not
default to %DEFAULT-SUBSTITUTE-URLS for #:substitute-urls.
* guix/scripts/size.scm (%default-options): Remove 'substitute-urls'.
* guix/scripts/build.scm (%default-log-urls): New variable.
(log-url): New procedure.
(guix-build): Use it.
* doc/guix.texi (Invoking guix build): Document it.
* guix/scripts/build.scm (package-with-source)[tarball-base-name]: Gracefully
handle file names that lack an extension.
Pass #:recursive? #t to 'download-to-store'.
* guix/download.scm (download-to-store): Add #:recursive? parameter and pass
it to 'add-to-store'.
* doc/guix.texi (Invoking guix build): Add an example of --with-source with a
directory.