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.
* gnu/packages.scm (search-patch): Raise an error condition when
'search-path' returns #f.
* tests/packages.scm ("patch not found yields a run-time error"): New
test.
* guix/packages.scm (origin->derivation): Take body from
'package-source-derivation', and change it to monadic style. Expect
METHOD to a monadic procedure.
(package-source-derivation): Define in terms of 'origin->derivation'.
* guix/download.scm (url-fetch): Remove 'store' argument. Remove
'guile-for-build' variable. Turn into a monadic procedure.
* guix/git-download.scm (git-fetch): Likewise.
* guix/svn-download.scm (svn-fetch): Likewise.
* tests/builders.scm (url-fetch*): New procedure.
Change tests to call 'url-fetch*' instead of 'url-fetch'.
* tests/packages.scm ("package-source-derivation, snippet"): Remove
'store' parameter of 'fetch' and change it to use 'interned-file'
instead of 'add-to-store'.
* gnu/packages/bootstrap.scm (bootstrap-origin)[boot]: Remove 'store'
parameter.
* tests/lint.scm (%http-server-lock, %http-server-ready): New
variables.
(http-open): New procedure.
(stub-http-server): Use it.
(call-with-http-server): Wrap body in 'with-mutex'. Call
'wait-condition-variable' after 'make-thread'.
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.
Fixes <http://bugs.gnu.org/19364>.
Reported by Tomáš Čech <sleep_walker@suse.cz>
and Mark H Weaver <mhw@netris.org>.
* gnu/packages.scm (%patch-path): Move after definition of
%package-module-path'. Append "/gnu/packages/patches" only to
%DISTRO-ROOT-DIRECTORY.
* tests/guix-package.sh: Add 'emacs-foo-bar-patched' test.
* guix/scripts/package.scm (search-path-environment-variables): Add
local 'files' variable.
* tests/packages.scm ("--search-paths with pattern"): New test.
Appending to "raw" args broke optional parameters in 'guix package -I'
and 'guix package -A', and possibly other places. Therefore, switch to
parsing each set of options on its own and append resulting alists
together afterwards.
* guix/scripts/archive.scm (parse-options-from): Rename from
(parse-options) and add explicit argument. New form of (parse-options)
using its old algorithm via -from function.
* guix/scripts/build.scm: Ditto.
* guix/scripts/environment.scm: Ditto.
* guix/scripts/package.scm: Ditto.
* guix/scripts/system.scm: Ditto.
* tests/guix-package.sh: Add test.
* doc/guix.texi (Invoking guix build): Make it clear that the options
are parsed independently.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* guix/scripts/lint.scm (starts-with-abbreviation?): New procedure.
(check-synopsis-style)[check-start-with-package-name]: Use it.
* tests/lint.scm ("synopsis: start with abbreviation"): New test.
* guix/scripts/lint.scm (package-name-regexp): New procedure.
(check-synopsis-style)[check-start-with-package-name]: Use it instead
of 'string-prefix-ci?'.
* tests/lint.scm ("synopsis: start with package name prefix"): New test.
* tests/lint.scm ("description: may start with a digit"): Replace
(not (string-contains exp str)) with (string-null? exp).
("description: may start with lower-case package name"): Likewise.
("description: end-of-sentence detection with abbreviations"):
Likewise.
("synopsis: may start with a digit"): Likewise.
("synopsis: ends with 'etc.'"): Likewise.
Fixes <http://bugs.gnu.org/18935>.
Reported by Mark H Weaver <mhw@netris.org>.
Previously, if tests/nar.scm ran concurrently with tests/gexp.scm, the
store item "foo" containing the string "Hello, world!" could be
deleted (via 'delete-paths') from the tests/nar.scm daemon while the
tests/gexp.scm daemon would still consider it live.
* tests/nar.scm ("restore-file-set (missing signature)"):
Use (random-text) rather than "Hello, world!", to avoid concurrent
deletion of store item "foo" used in tests/gexp.scm.
* guix/store.scm (run-gc): Add calls to 'hash-clear!'.
* tests/store.scm ("add-text-to-store vs. delete-paths",
"add-to-store vs. delete-paths"): New tests.
Reported by Andreas Enge <andreas@enge.fr>.
* guix/packages.scm (first-value): New macro.
(package-transitive-supported-systems): Rewrite to traverse all the
DAG rooted at PACKAGE.
* tests/packages.scm ("package-transitive-supported-systems"): Add 'd'
and 'e', and test them.
Thanks to Mark H. Weaver <mhw@netris.org> for insightful discussions
and suggestions.
* guix/packages.scm (<package>)[graft]: New field.
(patch-and-repack): Invoke 'package-derivation' with #:graft? #f.
(package-source-derivation): Likewise. Do not use (%guile-for-build)
in call to 'patch-and-repack', and we could end up using a grafted
Guile.
(expand-input): Likewise, also for 'package-cross-derivation' call.
(package->bag): Add #:graft? parameter. Honor it. Use 'strip-append'
instead of 'package-full-name'.
(input-graft, input-cross-graft, bag-grafts, package-grafts): New
procedures.
(package-derivation, package-cross-derivation): Add #:graft? parameter
and honor it.
* gnu/packages/bootstrap.scm (package-with-bootstrap-guile): Add
recursive call on 'graft'.
* guix/build-system/gnu.scm (package-with-explicit-inputs,
package-with-extra-configure-variable, static-package): Likewise.
(gnu-build): Use the ungrafted Guile to avoid full rebuilds.
(gnu-cross-build): Likewise.
* guix/build-system/cmake.scm (cmake-build): Likewise.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build): Likewise.
* guix/build-system/perl.scm (perl-build): Likewise.
* guix/build-system/python.scm (python-build): Likewise.
* guix/build-system/ruby.scm (ruby-build): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Likewise.
* tests/packages.scm ("package-derivation, direct graft",
"package-cross-derivation, direct graft", "package-grafts,
indirect grafts", "package-grafts, indirect grafts, cross",
"package-grafts, indirect grafts, propagated inputs",
"package-derivation, indirect grafts"): New tests.
("bag->derivation", "bag->derivation, cross-compilation"): Wrap in
'parameterize'.
* doc/guix.texi (Security Updates): New node.
(Invoking guix build): Document --no-graft.
* 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/scripts/lint.scm (check-description-style): Exception for
upper-case rule if the description starts with the package name.
* tests/lint.scm: Test it.
* guix/scripts/lint.scm (start-with-capital-letter?): Rename too...
(properly-starts-sentence?): Rewrite with regex and add digits.
(check-description-style, check-synopsis-style): Use it.
* tests/lint.scm: Add tests.
* guix/scripts/lint.scm (start-with-capital-letter?): Handle empty
strings.
(check-description-style): New check for end-of-sentence space.
* tests/lint.scm: Test it.
* guix/packages.scm (package-transitive-supported-systems): New procedure.
* tests/packages.scm ("package-transitive-supported-systems"): New test.
* build-aux/hydra/gnu-system.scm (package->job): Use it.
* 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/scripts/package.scm (switch-to-generation): New procedure.
(switch-to-previous-generation): Use it.
(guix-package): Adjust for '--switch-generation' option.
* tests/guix-package.sh: Test it.
* doc/guix.texi (Invoking guix package): Document it.
Fixes <http://bugs.gnu.org/18690>.
Reported by Philip Woods <elzairthesorcerer@gmail.com>.
* tests/syscalls.scm ("swapoff, EINVAL/EPERM"): Rename to...
("swapoff, ENOENT/EINVAL/EPERM"): ... this. Add ENOENT to the list of
possible return values.
Fixes a regression introduced in commit 300868ba.
* tests/guix-package.sh: Move 'module_dir' definition to the top, and
"rm -rf" it from the top-most 'trap'. Remove second use of 'trap'.
* guix/scripts/substitute-binary.scm (%cache-url): Ignore the
'GUIX_BINARY_SUBSTITUTE_URL' environment variable.
* test-env.in: Invoke 'guix-daemon' with '--substitute-urls'.
* tests/substitute-binary.scm: Set '%cache-url' to the value of
'GUIX_BINARY_SUBSTITUTE_URL'.
* guix/packages.scm (<package> printer): Check whether LOC is #f.
* tests/packages.scm ("printer with location", "printer without
location"): New tests.
* 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/scripts/lint.scm (check-start-article): use "string-ci=?" instead of
"string=?".
* tests/lint.scm ("synopsis: starts with 'a'",
"synopsis: starts with 'an'"): New tests.
* guix/scripts/lint.scm (check-description-style,
check-synopsis-start-upper-case): New methods.
* tests/lint.scm ("description: does not start with an upper-case letter",
"synopsis: does not start with an upper-case letter"): New tests.
* guix/build-system.scm (<build-system>)[build, cross-build]: Remove.
[lower]: New field.
(<bag>): New record type.
(make-bag): New procedure.
* guix/packages.scm (bag-transitive-inputs, bag-transitive-build-inputs,
bag-transitive-host-inputs, bag-transitive-target-inputs,
package->bag): New procedures.
(package-derivation): Use it; use the bag, apply its build procedure,
etc.
(package-cross-derivation): Likewise.
* gnu/packages/bootstrap.scm (raw-build, make-raw-bag): New procedure.
(%bootstrap-guile): Use them.
* guix/build-system/trivial.scm (lower): New procedure.
(trivial-build, trivial-cross-build): Remove 'source' parameter. Pass
INPUTS as is.
(trivial-build-system): Adjust accordingly.
* guix/build-system/gnu.scm (%store, inputs-search-paths,
standard-search-paths, expand-inputs, standard-inputs): Remove.
(gnu-lower): New procedure.
(gnu-build): Remove 'source' and #:implicit-inputs? parameters.
Remove 'implicit-inputs' and 'implicit-search-paths' variables. Get
the source from INPUT-DRVS.
(gnu-cross-build): Likewise.
(standard-cross-packages): Remove call to 'standard-packages'.
(standard-cross-inputs, standard-cross-search-paths): Remove.
(gnu-build-system): Remove 'build' and 'cross-build'; add 'lower'.
* guix/build-system/cmake.scm (lower): New procedure.
(cmake-build): Remove 'source' and #:cmake parameters. Use INPUTS and
SEARCH-PATHS as is. Get the source from INPUTS.
* guix/build-system/perl.scm: Likewise.
* guix/build-system/python.scm: Likewise.
* guix/build-system/ruby.scm: Likewise.
* gnu/packages/cross-base.scm (cross-gcc): Change "cross-linux-headers"
to "linux-headers".
(cross-libc)[xlinux-headers]: Pass #:implicit-cross-inputs? #f.
Likewise. In 'propagated-inputs', change "cross-linux-headers" to
"linux-headers".
* guix/git-download.scm (git-fetch): Use 'standard-packages' instead of
'standard-inputs'.
* tests/builders.scm ("gnu-build-system"): Remove use of
'build-system-builder'.
("gnu-build"): Remove 'source' and #:implicit-inputs? arguments to
'gnu-build'.
* tests/packages.scm ("search paths"): Adjust to new build system API.
("package-cross-derivation, no cross builder"): Likewise.
* doc/guix.texi (Build Systems): Add paragraph on bags.
* guix/ui.scm (size->number): Add a bunch of large units. Recognize
one-letter unit names. Change "KB" to "kB".
* tests/ui.scm ("size->number, 1T"): New test.
* doc/guix.texi (Invoking guix gc): Add cross-reference to "Block size"
in the Coreutils manual.
(Invoking guix system): Likewise.
* guix/download.scm (url-fetch): When URL is a string, if it's not a URI
or if it's a URI with 'file' or #f scheme, use 'add-to-store'.
* tests/builders.scm ("url-fetch, file", "url-fetch, file URI"): New
tests.
* guix/snix.scm: Delete.
* guix/import/snix.scm: New file.
* guix/import/pypi.scm: New file.
* guix/import/utils.scm: New file.
* guix/scripts/import/nix.scm: New file.
* guix/scripts/import/pypi.scm: New file.
* tests/pypi.scm: New file.
* tests/snix.scm: Import (guix import snix) module.
* guix/scripts/import.scm (%default-options, %options): Delete.
(%standard-import-options, importers): New variables.
(show-help): List importers.
(guix-import): Factor out Nix-specific logic. Delegate to correct importer
based upon first argument.
* configure.ac (HAVE_GUILE_JSON): New conditional.
* Makefile.am (MODULES): Add new files and remove 'guix/snix.scm'.
(SCM_TESTS): Add 'tests/pypi.scm' if guile-json is installed.
* guix/build/syscalls.scm (network-interfaces): Update docstring.
(%interface-line): New variable.
(all-network-interfaces): New procedure.
* tests/syscalls.scm ("all-network-interfaces"): New test.
("network-interfaces"): Change to make sure the result is a subset
of (all-network-interfaces).
* guix/build/utils.scm (wrap-program): Multiple invocations of
wrap-program for the same file create successive wrappers. Adjust
docstring.
* tests/build-utils.scm: Test new wrap-program behavior.
(%store): New variable.
* guix/gexp.scm (lower-reference-graphs): New procedure.
(gexp->derivation)[graphs-file-names]: New procedure.
Use 'lower-reference-graphs', and augment #:inputs argument as a
function of #:references-graphs.
* doc/guix.texi (G-Expressions): Adjust 'gexp->derivation' documentation
accordingly.
* tests/gexp.scm ("gexp->derivation, store copy"): Remove reference to
TWO in BUILD-DRV. Use TWO directly in #:references-graphs argument.
("gexp->derivation #:references-graphs"): New test.
* gnu/system/vm.scm (qemu-image): Remove variable 'graph'; use INPUTS as
the #:references-graphs argument to
'expression->derivation-in-linux-vm'.
This allows editors to parse warnings correctly.
* guix/scripts/lint.scm (emit-warning): Use 'format' instead of
'warning', to avoid the "guix lint: " prefix in messages.
* tests/lint.scm (call-with-warnings): Indent.
* guix/profiles.scm (manifest-lookup): New procedure.
(manifest-installed?): Use it.
(manifest-transaction-effects): Return a pair of entries for upgrades.
(right-arrow): New procedure.
(manifest-show-transaction)[upgrade-string, →]: New variables.
Report upgrades using 'upgrade-string'.
* tests/profiles.scm ("manifest-show-transaction"): New test.
("manifest-transaction-effects"): Match UPGRADE against a pair.
* nix/nix-daemon/guix-daemon.cc (main): Set 'autoStoreOptimise' to
true. Add 'printMsg' call.
* tests/derivations.scm ("identical files are deduplicated"): New test.
* guix/profiles.scm (manifest-transaction-effects): New procedure.
(manifest-show-transaction): Use it instead of locally computing it.
* tests/profiles.scm (glibc): New variable.
("manifest-transaction-effects"): New test.
Fixes <http://bugs.gnu.org/18305>.
Reported by Brandon Invergo <brandon@gnu.org>.
* guix/profiles.scm (manifest-inputs, info-dir-file): New procedures.
(profile-derivation): Use them. Add #:info-dir? parameter and honor
it.
* guix/scripts/package.scm (guix-package): Call 'profile-derivation'
with #:info-dir? #f when the 'bootstrap? option is set.
* tests/profiles.scm ("profile-derivation"): Pass #:info-dir? #f.
* guix/profiles.scm (<manifest-transaction>): New record-type.
(manifest-perform-transaction): New procedure.
(manifest-show-transaction): New procedure.
* tests/profiles.scm ("manifest-perform-transaction"): New test.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* guix/gexp.scm (<gexp>)[natives]: New field.
(write-gexp): Use both 'gexp-references' and
'gexp-native-references'.
(gexp->derivation): Use both 'gexp-inputs' and 'gexp-native-inputs',
and append them.
(gexp-inputs): Add 'references' parameter and honor it.
(gexp-native-inputs): New procedure.
(gexp->sexp)[reference->sexp]: Add 'native?' parameter and honor it.
Use it, and use 'gexp-native-references'.
(gexp)[collect-native-escapes]: New procedure.
[escape->ref]: Handle 'ungexp-native' and 'ungexp-native-splicing'.
[substitute-ungexp, substitute-ungexp-splicing]: New procedures.
[substitute-references]: Use them, and handle 'ungexp-native' and
'ungexp-native-splicing'.
Adjust generated 'make-gexp' call to provide both normal references
and native references.
[read-ungexp]: Support 'ungexp-native' and
'ungexp-native-splicing'.
Add reader extension for #+.
* tests/gexp.scm (gexp-native-inputs): New procedure.
(gexp->sexp*): Add 'target' parameter.
("ungexp + ungexp-native",
"input list + ungexp-native",
"input list splicing + ungexp-native-splicing",
"gexp->derivation, ungexp-native",
"gexp->derivation, ungexp + ungexp-native"): New tests.
("sugar"): Add tests for #+ and #+@.
* doc/guix.texi (G-Expressions): Document 'ungexp-native' et al.
* guix/gexp.scm (lower-inputs): Add #:system and #:target. Use
'package->cross-derivation' when TARGET is true. Honor SYSTEM.
(gexp->derivation): Add #:target argument. Pass SYSTEM and TARGET to
'lower-inputs' and 'gexp->sexp'.
(gexp->sexp): Add #:system and #:target. Pass them in recursive call
and to 'package-file'.
* tests/gexp.scm (gexp->sexp*): Add 'system' and 'target' parameters.
("gexp->derivation, cross-compilation"): New test.