Based on discussions with Rohan Prinja <rohan.prinja@gmail.com>.
* guix/build/syscalls.scm (<interface>): New record type.
(write-interface, values->interface, unfold-interface-list,
network-interfaces, free-ifaddrs): New procedures.
(ifaddrs): New C struct.
(%struct-ifaddrs-type, %sizeof-ifaddrs): New macros.
* tests/syscalls.scm ("network-interfaces returns one or more interfaces",
"network-interfaces returns \"lo\""): New tests.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Use 'lset=' instead
of 'equal?' since the order in which references are listed in not
guaranteed.
Fixes <http://bugs.gnu.org/19778>.
Reported by Mark H Weaver <mhw@netris.org>.
* gnu/system/file-systems.scm (%uuid-rx): New variable.
(string->uuid): New procedure.
(uuid): New macro.
* tests/file-systems.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
* doc/guix.texi (File Systems): Give an example of UUID.
* guix/scripts/substitute.scm (or*): New macro.
(%cache-url): Honor "untrusted-substitute-urls".
* guix/tests.scm (%test-substitute-urls): New variable.
(open-connection-for-tests): Use it.
* tests/derivations.scm ("derivation-prerequisites-to-build and substitutes",
"derivation-prerequisites-to-build and substitutes, non-substitutable
build", "derivation-prerequisites-to-build and substitutes, local build"):
Pass it to 'set-build-options'.
* tests/guix-daemon.sh: Likewise.
* tests/store.scm ("substitute query, alternating URLs"): New test.
("substitute query", "substitute", "substitute + build-things with output
path", "substitute, corrupt output hash", "substitute --fallback"): Pass
#:substitute-urls to 'set-build-options'.
This ensures that switching between different substitute servers doesn't lead
to a polluted narinfo cache.
* guix/scripts/substitute.scm (narinfo-cache-file): Add 'cache-url'
parameter. Add the base32 of CACHE-URL as a sub-directory under
%NARINFO-CACHE-DIRECTORY. Update callers.
(cached-narinfo): Likewise. Call 'mkdir-p' on the dirname of the cache
file. Update callers.
(remove-expired-cached-narinfos): Add 'directory' parameter and use it
instead of %NARINFO-CACHE-DIRECTORY.
(narinfo-cache-directories): New procedure.
(maybe-remove-expired-cached-narinfo): Call 'remove-expired-cached-narinfos'
for each item returned by 'narinfo-cache-directories'.
There were two issues:
1. Use of 'delete-duplicates', which is quadratic, was a serious problem for
closures with lots of propagated inputs, such as that of the 'hydra'
package (several minutes for 'guix build hydra -n'!).
2. The 'delete-duplicates' call essentially had no effect since duplicate
inputs typically had a different label and were thus kept. For
instance, (bag-transitive-inputs (package->bag inkscape)) would return
216 items whereas (delete-duplicates (map cdr THAT)) contains only 67
items.
The new implementation returns 67 items in this case. For 'hydra', we're
down from 42211 items to 361, and roughly 13s for 'guix build hydra'.
* guix/packages.scm (transitive-inputs): Rewrite as a breadth-first
traversal. Remove duplicate propagated inputs.
* tests/packages.scm ("package-transitive-inputs", "package->bag, propagated
inputs"): Adjust to use simple labels for propagated inputs, without "/".
("package-transitive-inputs, no duplicates"): New test.
This is a followup to commit 5d6792f ("gnu: bootstrap: Create a wrapper for
guile to set the system load path.")
* tests/size.scm ("store-profile"): Expect profile of 'bash' bootstrap binary.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Expect GUILE-DRV to
depend on 'bash' bootstrap binary.
* gnu/build/linux-container.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* .dir-locals.el: Add Scheme indent rules for 'call-with-container', and
'container-excursion'.
* tests/containers.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
* guix/scripts/environment.scm (package+propagated-inputs): Add 'output'
parameter. Use it in return value.
(options/resolve-packages): Use 'append-map' instead of 'map'. For 'load'
and 'expression', return all the outputs of the resulting package. For
'package', use 'specification->package+output' instead of
'specification->package'.
(guix-environment): Adjust uses of PACKAGES accordingly.
* doc/guix.texi (Invoking guix environment): Document it.
* tests/guix-environment.sh: Add test for --ad-hoc guile-bootstrap:out.
Before that, 'guix environment guile' (for instance) would define environment
variables that would refer to the "include" output of Bash, the "debug" output
of libgc, etc., even though these are not listed as inputs in the recipe of
'guile'.
* guix/gexp.scm (lower-inputs): Export.
* guix/scripts/environment.scm (evaluate-input-search-paths): Remove
'derivations' parameter; add 'search-paths'. Expect 'inputs' to be
a list of tuples. Adjust callers.
(create-environment): Remove 'derivations' parameter; add 'search-paths'.
(show-search-paths): Likewise.
(package+propagated-inputs): New procedure.
(packages->transitive-inputs, packages+propagated-inputs): Remove.
(build-inputs): Expect INPUTS to be a list of derivation tuples.
(guix-environment): Compute INPUTS using 'package+propagated-inputs',
'package->bag', and 'bag-transitive-inputs'. Move 'run-with-store' higher.
* tests/guix-environment.sh: Add test with FINDUTILS-BOOT0.
* guix/import/pypi.scm (python->package-name, maybe-inputs, compute-inputs,
guess-requirements): New procedures.
* guix/import/pypi.scm (guix-hash-url): Now takes a filename instead of an
URL as input.
* guix/import/pypi.scm (make-pypi-sexp): Now tries to generate the inputs
automagically.
* tests/pypi.scm: Update the test.
Reported by Alex Kost <alezost@gmail.com>
at <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00235.html>.
* guix/gexp.scm (local-file): Change #:recursive? to default to #f.
* tests/gexp.scm ("one local file", "gexp->derivation, local-file"): Adjust
calls to 'add-to-store' and 'interned-file' accordingly.
* guix/scripts/size.scm: New file.
* Makefile.am (MODULES): Add it.
(SCM_TESTS): Add tests/size.scm.
* doc.am (SUBCOMMANDS): Add 'size'.
* po/guix/POTFILES.in: Add guix/scripts/size.scm.
* tests/size.scm: New file.
* doc/guix.texi (Packages with Multiple Outputs): Add xref to "Invoking guix
size".
(Invoking guix size): New node.
(Invoking guix gc): Add index for "closure" and xref to the above.
* doc/contributing.texi (Submitting Patches): Use @enumerate for the check
list. Add item about 'guix size'.
Fixes <http://bugs.gnu.org/19044>.
* nix/guix-register/guix-register.cc (register_validity): Change the (optimize
&& prefix.empty ()) condition to just (optimize). Change settings.nixStore
around the loop. Prepend PREFIX to the argument passed to 'optimisePath'.
* tests/guix-register.sh: Use 'guix-register -p' with duplicate files, and
make sure they are deduplicated on the target. Adjust existing tests.
* guix/import/cabal.scm: New file.
* guix/import/hackage.scm: Update to use the new Cabal parsing module.
* tests/hackage.scm: Update tests.
* guix/scripts/import/hackage.scm: Add new '--cabal-environment' and '--stdin'
options.
* doc/guix.texi: ... and document them.
* Makefile.am (MODULES): Add 'guix/import/cabal.scm',
'guix/import/hackage.scm' and 'guix/scripts/import/hackage.scm'.
(SCM_TESTS): Add 'tests/hackage.scm'.
Suggested by Federico Beffa <beffa@fbengineering.ch>.
* guix/monads.scm (bind-syntax): New macro.
(with-monad): Use it instead of 'identifier-syntax'.
* tests/monads.scm (">>= with more than two arguments"): New test.
* doc/guix.texi (The Store Monad): Explain that there can be several MPROC.
Add an example.
Suggested by Christopher Allan Webber <cwebber@dustycloud.org>.
* guix/base32.scm (&invalid-base32-character): New error condition.
(make-base32-string->bytevector): Use it instead of 'error'.
* tests/base32.scm ("&invalid-base32-character"): New test.
* guix/monads.scm (foldm, mapm, anym): Change to take a list of regular
values as is customary.
* tests/monads.scm ("mapm", "anym"): Adjust accordingly.
* tests/derivations.scm ("derivation-prerequisites and
valid-derivation-input?"): Renamed from "derivation-prerequisites and
derivation-input-is-valid?". Build %BOOTSTRAP-GUILE. This fixes a
regression introduced in cdb5b07 when running the whole test suite.
Fixes <http://bugs.gnu.org/19757>.
* guix/scripts/gc.scm (guix-gc): Convert paths to direct store paths.
* guix/store.scm (direct-store-path): Get rid of subdirectories in store path.
* tests/guix-gc.sh: New tests.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Reported by Christian Grothoff.
* guix/ui.scm (load*): Add 'frame-with-source'. Set
%load-should-auto-compile. Change error handle to just (exit 1). Add
pre-unwind handler to capture the stack and call 'report-load-error'.
(report-load-error): Add optional 'frame' parameter and pass it to
'display-error'.
* tests/guix-system.sh: Add "unbound variable" test.
Fixes <http://bugs.gnu.org/20646>.
Reported by David Thompson <davet@gnu.org>.
* gnu/system/shadow.scm (assert-valid-users/groups): New procedure
* gnu/system.scm (operating-system-activation-script): Use it.
* tests/guix-system.sh (make_user_config): New function.
Add 3 tests using it.
* po/guix/POTFILES.in: Add gnu/system/shadow.scm.
* guix/scripts/package.scm (search-path-environment-variables): Add #:kind
parameter. Pass it to 'environment-variable-definition'.
(display-search-paths): Add #:kind parameter and pass it to
'search-path-environment-variables'.
(%options): Add an optional parameter for "--search-paths".
(guix-package)[process-query]: Handle it.
* tests/guix-package-net.sh: Adjust existing test.
* tests/guix-package.sh: Adjust existing tests and add new test.
* doc/guix.texi (Invoking guix package): Document it.