* guix/nar.scm (&nar-error, &nar-read-error): New condition types.
(dump): New procedure.
(write-contents)[dump]: Remove. Use the one above instead.
(read-contents, write-file, restore-file): New procedures.
(%archive-version-1): New variable.
* guix/scripts/substitute-binary.scm: New file.
* Makefile.am (MODULES): Add it.
* nix/scripts/substitute-binary.in: New file.
* config-daemon.ac: Produce nix/scripts/substitute-binary.
* daemon.am (nodist_pkglibexec_SCRIPTS): Add
nix/scripts/substitute-binary.
* guix/store.scm (substitutable-path-info): Use the
`query-substitutable-path-infos' RPC.
* nix/nix-daemon/guix-daemon.cc (main): Honor `NIX_SUBSTITUTERS'.
* pre-inst-env.in: Set `NIX_SUBSTITUTERS'.
* test-env.in: Leave `NIX_SUBSTITUTERS' unchanged. Set
`GUIX_BINARY_SUBSTITUTE_URL, and create
$NIX_STATE_DIR/substituter-data.
Run `guix-daemon' within `./pre-inst-env'.
* tests/store.scm ("substitute query"): New test.
This allows build outputs to be transparently downloaded from
http://hydra.gnu.org, for example.
* config-daemon.ac: Check for `gzip', `bzip2', and `xz'.
* guix/config.scm.in (%gzip, %bzip2, %xz): New variable.
* guix/scripts/substitute-binary.scm (fetch): Return SIZE as a second value.
(<narinfo>): Change `url' to `uri'.
(make-narinfo): Rename to...
(narinfo-maker): ... this. Handle relative URLs.
(fetch-narinfo): Adjust accordingly.
(filtered-port, decompressed-port): New procedures.
(guix-substitute-binary): Implement the `--substitute' case.
* tests/store.scm ("substitute query"): Use (%store-prefix) instead
of (getenv "NIX_STORE_DIR").
("substitute"): New test.
* guix/nar.scm (write-file): Add case for type `symlink'.
(restore-file): Likewise.
* tests/nar.scm (random-file-size, make-file-tree, delete-file-tree,
with-file-tree, file-tree-equal?, make-random-bytevector,
populate-file): New procedures.
(%test-dir): New variable.
("write-file + restore-file"): Use `%test-dir' and `file-tree-equal?'.
("write-file + restore-file with symlinks"): New test.
Fixes a regression introduced in a18eda2.
Reported by Nikita Karetnikov <nikita@karetnikov.org>.
* tests/builders.scm (%bootstrap-search-paths): New variable.
("gnu-build"): Pass #:search-paths.
* guix/nar.scm (&nar-error, &nar-read-error): New condition types.
(dump): New procedure.
(write-contents)[dump]: Remove. Use the one above instead.
(read-contents, write-file, restore-file): New procedures.
(%archive-version-1): New variable.
* guix/scripts/substitute-binary.scm: New file.
* Makefile.am (MODULES): Add it.
* nix/scripts/substitute-binary.in: New file.
* config-daemon.ac: Produce nix/scripts/substitute-binary.
* daemon.am (nodist_pkglibexec_SCRIPTS): Add
nix/scripts/substitute-binary.
* guix/store.scm (substitutable-path-info): Use the
`query-substitutable-path-infos' RPC.
* nix/nix-daemon/guix-daemon.cc (main): Honor `NIX_SUBSTITUTERS'.
* pre-inst-env.in: Set `NIX_SUBSTITUTERS'.
* test-env.in: Leave `NIX_SUBSTITUTERS' unchanged. Set
`GUIX_BINARY_SUBSTITUTE_URL, and create
$NIX_STATE_DIR/substituter-data.
Run `guix-daemon' within `./pre-inst-env'.
* tests/store.scm ("substitute query"): New test.
* guix/scripts/package.scm (read/eval-package-expression): New
procedure.
(show-help): Add `-e'.
(%options): Likewise.
(guix-package)[process-actions]: Handle ('install . p) pairs, where P
is a package.
* tests/guix-package.sh: Add `boot_make_drv'. Use `-i $boot_make_drv'
once, and then use `-e $boot_make'.
* doc/guix.texi (Invoking guix package): Document `-e'.
* guix/build/union.scm (union-build): Prepend "." to the result of
`union-tree', to match the expectations of `delete-duplicate-leaves'.
Don't do mkdir when SUBDIR is ".".
* tests/union.scm ("union-build"): Keep duplicates in %BOOTSTRAP-INPUTS.
* 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/ui.scm (fill-paragraph, string->recutils, package->recutils): New
procedures.
* guix-package.in (guix-package)[process-query]: Use `package->recutils'
to display package meta-data.
* tests/guix-package.sh: Adjust test.
* tests/ui.scm: New file.
* Makefile.am (TESTS): Add it.
* doc/guix.texi (Invoking guix-package): Adjust `--search'
documentation, and give an example.
* 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.
Suggested by Andreas Enge <andreas@enge.fr> at
<http://lists.gnu.org/archive/html/bug-guix/2013-01/msg00325.html>.
* guix-package.in (latest-profile-number): Remove.
(switch-symlinks): New procedure.
(roll-back)[switch-link]: Use it.
(guix-package)[process-actions]: Always choose NUMBER + 1 for the new
profile. Use `switch-symlinks' instead of `symlink'. Remove code to
delete PROFILE when it exists since `switch-symlinks' has the same
effect.
* tests/guix-package.sh: Adjust existing `--roll-back' tests.
* doc/guix.texi (Invoking guix-package): Document this `--roll-back'
behavior.
Suggested by Andreas Enge <andreas@enge.fr> at
<http://lists.gnu.org/archive/html/bug-guix/2013-01/msg00316.html>.
* guix-package.in (roll-back): Check whether PROFILE is valid using
`file-exists?'. When NUMBER is zero, just emit a notice. When
PREVIOUS-NUMBER is zero and PREVIOUS-PROFILE does not exist, build the
empty profile, and link to it.
* tests/guix-package.sh: Add tests.
* doc/guix.texi (Invoking guix-package): Document the new behavior.
* guix/packages.scm (<package>)[inputs]: Mark as thunked.
(package-derivation)[expand-input]: Remove case where the input is a
procedure.
* tests/packages.scm ("trivial with system-dependent input"): Remove
`lambda', and use (%current-system).
* gnu/packages/bootstrap.scm (package-from-tarball): Likewise for `inputs'.
(%bootstrap-glibc, %bootstrap-gcc): Likewise.
* gnu/packages/scheme.scm (mit-scheme): Likewise.
* guix-package.in (guix-package)[parse-options]: Call `leave' when
passed a non-option argument.
Reported by Andreas Enge <andreas@enge.fr>.
* tests/guix-package.sh: Add test.
* guix/utils.scm (define-record-type*)[make-syntactic-constructor]: Add
a `thunked' parameter.
(thunked-field?, field-bindings): New procedures. Use the latter when
generating `letrec*' bindings.
[thunked-field?, thunked-field-accessor-name, field-spec->srfi-9,
thunked-field-accessor-name]: New procedures.
Use them when generating the `define-record-type' form, and to
generated thunk field accessors, along call to
`make-syntactic-constructor' with the new argument.
* tests/utils.scm ("define-record-type* & thunked",
"define-record-type* & thunked & default",
"define-record-type* & thunked & inherited"): New tests.
* guix-package.in (roll-back): Fix file name of PREVIOUS-PROFILE, which
could end up containing the dirname twice.
Reported by Nikita and Andreas.
* tests/guix-package.sh: Add test.
* guix-build.in (guix-build)[find-package]: New procedure.
Use it instead of using `find-packages-by-name' directly.
Suggested by Andreas Enge <andreas@enge.fr>.
* tests/guix-build.sh: Add tests.
* doc/guix.texi (Invoking guix-build): Add `coreutils-8.20' as an
example. Fix guile-1.8 example.
* guix/packages.scm (cache): Change the `drv' argument to `thunk'.
Memoize all the return values of THUNK.
(cached-derivation): Remove.
(cached): New macro.
(package-derivation): Use `cached' instead of `(or (cached-derivation) …)'.
* doc/guix.texi (Defining Packages): Update accordingly.
* guix-package.in (profile-numbers): New procedure.
(latest-profile-number): Use it.
(previous-profile-number): New procedure.
(roll-back): Use it lieu of `1-'. Check whether PREVIOUS-NUMBER is
zero, and raise an error when it is.
* tests/guix-package.sh: Test whether we can roll back over a "hole".
Based on a patch by Nikita Karetnikov <nikita@karetnikov.org>.
* guix-package.in (profile-regexp): New procedure.
(latest-profile-number): Remove `%profile-rx', and use
`profile-regexp' instead.
(profile-number, roll-back): New procedure.
(show-help): Add `--roll-back'.
(%options): Likewise.
(guix-package)[process-actions]: First check whether `roll-back?' is
among OPTS, and call `roll-back' if it is, followed by a recursive
call to `process-actions'. Emit the "nothing to be done" message only
when INSTALL or REMOVE is non-empty.
* tests/guix-package.sh (readlink_base): New function.
Add tests for `--roll-back'.
* doc/guix.texi (Invoking guix-package): Document `--roll-back'.
Reported by Andreas Enge.
* guix-package.in (%profile-directory): Honor $NIX_STATE_DIR.
(guix-package)[ensure-default-profile]: Use it.
[process-actions]: Call it when the `profile' option is
%CURRENT-PROFILE.
* tests/guix-package.sh: Add installation test with $HOME set, using the
default profile.
* guix/build/union.scm (delete-duplicate-leaves): New procedure.
(union-build)[leaf=?, resolve-collision]: New procedures.
Use `delete-duplicate-leaves' on the result of `tree-union'.
* tests/union.scm ("delete-duplicate-leaves, default",
"delete-duplicate-leaves, file names"): New tests.
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-package.in (%options): Remove #\b as an alternate for
"bootstrap".
(show-help): Adjust accordingly.
* tests/guix-package.sh: Use `--bootstrap' instead of `-b'.
* 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.
* tests/base32.scm (%nix-hash): When `getenv' returns the empty string,
ignore it.
(%have-nix-hash?): New variable. Update `test-skip' clause to use it.
* guix-package.in (guix-package)[process-actions]: Compute PACKAGES such
that packages listed in INSTALL* are first removed from the remainder
of the list. When PROF is equal to the previous profile's store path,
do nothing. Reported by Andreas Enge <andreas@enge.fr>.
* tests/guix-package.sh: Test the behavior of installing the same store
path twice. When removing a package, omit its version number.
* guix/store.scm (gc-action): New enumerate type.
(read-long-long, read-string-list, write-store-path,
write-store-path-list, read-store-path-list): New procedures.
(write-arg): Add support for `store-path' and `store-path-list'.
(read-arg): Add support for `store-path-list'.
(define-operation): Add support for multiple-value returns.
(run-gc, live-paths, dead-paths, collect-garbage, delete-paths): New
procedures.
(%long-long-max): New macro.
* tests/store.scm: New file.
* Makefile.am (TESTS): Add it.
* test-env.in: New file.
* configure.ac: Add it to `AC_CONFIG_FILES' and `commands-exec'.
* config-daemon.ac: Set and substitute `GUIX_TEST_ROOT'.
* Makefile.am (SCM_LOG_COMPILER, SH_LOG_COMPILER): Use it in lieu of
`pre-inst-env'.
* daemon.am (test_root): Remove
(AM_TESTS_ENVIRONMENT): Remove `TEST_ROOT'.
(clean-local): Use $(GUIX_TEST_ROOT); make files writable before
removing them.guix_test_root
* tests/guix-daemon.sh: Remove `NIX_' variable settings; don't launch
`guix-daemon'.
* nix/scripts/list-runtime-roots.in: New file.
* config-daemon.ac: Add `AC_CONFIG_FILES' invocation for it.
* daemon.am (nodist_pkglibexec_SCRIPTS): New variable.
(AM_TESTS_ENVIRONMENT): Define `top_builddir'.
* tests/guix-daemon.sh: Export `NIX_ROOT_FINDER'.
* nix/sync-with-upstream: Substitute the path to the root finder in
libstore/gc.cc.
* 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.
* distro.scm (fold-packages): New procedure.
(find-packages-by-name): Use it instead of hand-written traversal;
remove `package?' checks from `right-package?'.
* tests/packages.scm ("fold-packages"): New test.
* guix-download.in (http-fetch, ftp-fetch): Remove.
(fetch-and-store): Replace `uri' parameter with `name', for the output
file name. Redirect the output of `fetch' to the error port.
(guix-download): Call `url-fetch' for all URI schemes except `file'.
Handle PATH equal to #f.
* guix/download.scm: Export `%mirrors'.
* tests/guix-download.sh: Change erroneous URL, because URLs at
example.com are all valid redirections.
* guix-download.in (fetch-and-store): New procedure.
(guix-download): Use it to compute PATH. Call `add-to-store' when
a `file' URI scheme is used.
* Makefile.am (AM_TESTS_ENVIRONMENT): New variable.
* tests/guix-download.sh: Add test.
* guix-download.in (guix-download): Error out when `string->uri'
returns #f. Use `leave' when the scheme is unknown.
* tests/guix-download.sh: Add tests.
* 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.
* guix-download.in (http-fetch): Leave with an error message when
RESPONSE's code is not 200.
* tests/guix-download.sh: New file.
* Makefile.am (TESTS): Add it.
* guix-build.in (derivations-from-package-expressions): Leave with an
error message when SOURCE? is #t and P has no source.
* tests/guix-build.sh: Add test.
* guix-package.in (guix-package)[find-package]: Return the correct NAME
and SUB-DRV when NAME contains #\:.
* tests/guix-package.sh (profile): Add test.
* guix/utils.scm (package-name->name+version): New procedure.
* guix-package.in (guix-package)[find-package]: Use it.
* tests/utils.scm ("package-name->name+version"): New test.
* tests/builders.scm (%bootstrap-inputs): Use %BOOT0-INPUTS from the distro.
* tests/packages.scm (%bootstrap-inputs): Likewise.
* tests/derivations.scm (%coreutils): Alias for %BOOTSTRAP-COREUTILS&CO.
* 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/packages.scm (package-derivation)[intern]: New procedure. Pass
#t as the `recursive?' argument, instead of #f.
[expand-input]: New procedure, with code formerly in the body.
Support inputs where the input is a procedure returning a file name or
an <origin>.
Use `expand-input' in the body.
* tests/packages.scm ("trivial with system-dependent input"): New test.
* tests/builders.scm (%bootstrap-inputs, %bootstrap-guile): New
variables.
("gnu-build"): Use them, by setting `#:implicit-inputs? #f' and `#:guile'.
* tests/packages.scm (%bootstrap-inputs, %bootstrap-guile): New
variables.
("trivial"): Pass `#:guile %bootstrap-guile'.
("GNU Hello"): Use `package-with-explicit-inputs' to use
%BOOTSTRAP-GUILE and %BOOTSTRAP-INPUTS.
* guix/build-system/trivial.scm: New file.
* Makefile.am (MODULES): Add it.
* tests/packages.scm ("trivial"): New test.
* guix/packages.scm (package-derivation): Allow SOURCE to be #f.
* Makefile.am (.scm.go): Define $NIX_INSTANTIATE.
(TESTS_ENVIRONMENT): Likewise, and define $NIX_HASH.
* guix/utils.scm (nixpkgs-derivation): Use $NIX_INSTANTIATE when
defined.
* tests/utils.scm (%nix-hash): New variable.
("sha256 & bytevector->nix-base32-string"): Use it.
* guix/packages.scm (package-transitive-inputs): New procedure.
(package-derivation): Use it to compute INPUTS.
* tests/packages.scm (dummy-package): New macro.
("package-transitive-inputs"): New test.
* guix/utils.scm (define-record-type*)[make-syntactic-constructor]: Bind
all the ((FIELD VALUE) ...) in a `letrec*'. Adjust `field-value'
accordingly.
* tests/utils.scm ("define-record-type* with letrec* behavior"): New
test.
* 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/store.scm (valid-path?): New procedure.
* tests/builders.scm ("http-fetch", "gnu-build"): Use it.
* tests/derivations.scm ("add-to-store, flat", "add-to-store,
recursive", "derivation with no inputs", "build derivation with 1
source", "build derivation with coreutils",
"build-expression->derivation with expression returning #f"):
Likewise.
* guix/packages.scm (<location>): New record type.
(location, source-properties->location): New procedures.
(<package>)[location]: New field.
* tests/packages.scm ("GNU Hello"): Test `package-location'.
* Makefile.am (MODULES): Add `guix/packages.scm' and `distro/base.scm'.
(TESTS): Add `tests/packages.scm'.
(EXTRA_DIST): New variable.
* guix/packages.scm, distro/base.scm, tests/packages.scm: New files.
* guix/http.scm (http-fetch): Make `name' an optional argument, to match
the expectations of `package-source-derivation'.
* 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/utils.scm (gnu-triplet->nix-system): New procedure.
(%current-system): New variable.
* tests/utils.scm ("gnu-triplet->nix-system"): New test.
* tests/derivations.scm (%current-system): Remove. Update users to
use (%current-system) instead.
* 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.
* guix/derivations.scm (%guile-for-build): New parameter.
(build-expression->derivation): New procedure.
* tests/derivations.scm ("build-expression->derivation without inputs",
"build-expression->derivation with one input"): New tests.
* guix/derivations.scm (derivation-path->output-path): New procedure.
(derivation-hash): Call `memoize'. In the fixed-output case, convert
HASH-ALGO to a string. In the other case, sort inputs in the
alphabetical order of their hex hash. For inputs with no sub-drvs,
add "out" as the sub-drv.
* guix/utils.scm (%nixpkgs-directory): New parameter.
(nixpkgs-derivation, memoize): New procedures.
* tests/derivations.scm ("build derivation with 1 source"): Remove
useless shebang.
(%coreutils): New variable.
("build derivation with coreutils"): New test.
* guix/store.scm (%store-prefix): New parameter.
(store-path?, derivation-path?): New procedures.
* guix/derivations.scm (write-derivation): Pass SOURCES through
`object->string'.
(compressed-hash, store-path, output-path, derivation): New
procedures.
* tests/derivations.scm (%store): New global variable.
("derivation with no inputs"): New test.
* guix/utils.scm (bytevector-quintet-ref-right,
bytevector-quintet-fold): New procedures.
(bytevector-quintet-fold-right): Add `quintet-fold' parameter; use it
instead of `bytevector-quintet-fold'.
(bytevector->base32-string): Pass BYTEVECTOR-QUINTET-FOLD as the
first parameter.
(bytevector->nix-base32-string): Pass BYTEVECTOR-QUINTET-FOLD-RIGHT as
the first parameter.
* tests/utils.scm ("sha256 & bytevector->nix-base32-string"): New test.
* guix/derivations.scm: Export `read-derivation' and `write-derivation'.
* srfi/srfi-64.scm, srfi/srfi-64.upstream.scm: New files, from libchop.
* tests/derivations.scm, tests/test.drv: New files.