* guix/pki.scm (ensure-acl): Make sure the directory of %ACL-FILE
exists.
* guix/scripts/archive.scm (generate-key-pair): Likewise for
%PUBLIC-KEY-FILE.
* guix/scripts/package.scm (leave-on-EPIPE): New macro.
(guix-package): Use it for 'list-installed', 'list-available', and
'--list-generations'.
* tests/guix-package.sh: Add test.
* guix/scripts/archive.scm (authorize-key): New procedure.
(guix-archive): Call it when OPTS contains 'authorize-key'.
* tests/guix-archive.sh: Add test with invalid public key.
* guix/pki.scm: Export '%acl-file'.
* doc/guix.texi (Invoking guix archive): Make it clear that '--import'
works only with authorized keys. Document '--authorize'.
* guix/scripts/authenticate.scm (signature-sexp): Remove.
(guix-authenticate): Upon '-verify', check whether the signature's
public key passes 'authorized-key?'.
* guix/pk-crypto.scm (token-string?): New procedure.
(canonical-sexp-nth-data): Return a symbol when the element is a
"token", and a bytevector otherwise.
(latin1-string->bytevector): Remove.
(hash-data->bytevector): Adjust accordingly.
* tests/pk-crypto.scm ("canonical-sexp-nth"): Adjust accordingly. Add
octet string example.
* guix/scripts/authenticate.scm (signature-sexp): New procedure.
(guix-authenticate): Use it to produce the signature. Adjust
verification code accordingly.
* tests/store.scm ("import corrupt path"): Adjust test accordingly.
* guix/pk-crypto.scm: Rename procedures, variables, etc. from
'gcry-sexp' to 'canonical-sexp'. Add comment with references.
* guix/scripts/authenticate.scm, tests/pk-crypto.scm: Adjust
accordingly.
* guix/scripts/package.scm (%options): Adapt option processors to accept and
return a second seed value: 'arg-handler', which handles bare arguments (if
not false). The install, remove, and upgrade option processors return an
arg-handler that repeat the same operation. All other option processors
return #f as the arg-handler. Make the arguments to install and remove
optional. The upgrade option processor deletes (upgrade . #f) from the
alist before adding a new entry.
(guix-package): Procedures passed to 'args-fold*' accept the new seed value
'arg-handler'. The 'operand-proc' uses 'arg-handler' (if not false).
* doc/guix.texi (Invoking guix package): Update docs.
* tests/guix-package.sh: Add test.
* guix/scripts/pull.scm (unpack)[builder](compile-file*): Remove.
(call-with-process, p-for-each): New procedures. Use them to compile
files in parallel.
Reported by Arne Babenhauserheide <arne.babenhauserheide@kit.edu>.
* guix/scripts/pull.scm (unpack)[builder](compile-file*): Change to run
'compile-file' in a child process. This limits memory usage; before
that memory usage was proportional to the number of files to compile.
* gnu/system/vm.scm (lower-inputs): Move to monads.scm.
(qemu-image): Don't add GRUB-CONFIGURATION to the INPUTS-TO-COPY.
(union, file-union, etc-directory): Move to gnu/system.scm.
(%demo-operating-system): New variable.
(system-qemu-image): Add 'os' parameter. Rewrite in terms of
'operating-system-derivation'.
* guix/monads.scm (lower-inputs): New procedure.
* gnu/system/grub.scm (grub-configuration-file): Change 'entries' to be
a plain list instead of a list of monadic values.
* gnu/system.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* guix/build-system/cmake.scm (cmake-build): Change 'out-of-source?' to
default to #t.
* guix/build/cmake-build-system.scm (configure): Add 'out-of-source?'
keyword parameter and honor it.
* guix/scripts/substitute-binary.scm (n-par-map*): New procedure.
(guix-substitute-binary): Use it instead of 'n-par-map'.
Reported by Nikita Karetnikov and Eric Bavier.
* guix/ui.scm (read/eval): New procedure.
(read/eval-package-expression): Use it.
* guix/scripts/build.scm (derivations-from-package-expressions): Rename to...
(derivation-from-expression): ... this. Accept procedures, under the
assumption that they are monadic thunk.
(show-help): Adjust accordingly.
(guix-build): Ditto.
* tests/guix-build.sh: Add test.
* doc/guix.texi (Invoking guix build): Augment description of '-e'.
* guix/scripts/substitute-binary.scm (with-timeout): Update comment to
mention the fix's commit ID.
(fetch): In the 'with-timeout' handler, close PORT only one Guile
versions < 2.0.9.39. Before that, on Guile >= 2.0.9.39, the HTTP
client would end up trying to read from a closed file descriptor.
* 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/packages.scm (package-source-derivation): Don't let indirect
store paths pass through.
* tests/packages.scm ("package-source-derivation, indirect store path"):
New test.
* guix/scripts/substitute-binary.scm (%lookup-threads): New variable.
(guix-substitute-binary): Use 'n-par-map' instead of 'par-map' for
batch 'lookup-narinfo' calls.
* guix/packages.scm (<origin>): Add 'snippet', 'modules', and
'imported-modules' fields.
(patch-and-repack): Make 'inputs' a keyword parameter. Add 'snippet',
'modules', and 'imported-modules' parameters. Accept SOURCE as a raw
file name. Insert SNIPPET in BUILDER. Pass IMPORTED-MODULES to
'build-expression->derivation'.
(package-source-derivation): Pass the extra arguments to
'patch-and-repack'.
* tests/packages.scm ("package-source-derivation, snippet"): New test.
* doc/guix.texi (Defining Packages): Mention the 'patches' and 'snippet'
fields.
(Invoking guix build): Tell that --source has patches and snippets
applied.
(Software Freedom): Mention packages that contain non-free code.
Fixes <http://bugs.gnu.org/15756>.
* guix/profiles.scm (<manifest-pattern>): New record type.
(remove-manifest-entry): Remove.
(entry-predicate, manifest-matching-entries): New procedures.
(manifest-remove): Accept a list of <manifest-pattern>.
(manifest-installed?): Replace 'name' parameter by 'pattern', a
<manifest-pattern>.
* guix/scripts/package.scm (options->removable): Return a list of
<manifest-pattern>.
(guix-package)[process-action]: Use 'manifest-matching-entries' to
compute the list of packages to remove.
* tests/profiles.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
* guix/scripts/package.scm (options->removable): New procedure.
(guix-package)[process-actions]: Use it. Rename 'remove*' to 'remove'
and 'install*' to 'install'.
* guix/ui.scm (package-specification->name+version+output): New
procedure.
* guix/scripts/package.scm (specification->package+output): Use it.
* tests/ui.scm ("package-specification->name+version+output"): New test.
* guix/scripts/package.scm (<manifest-entry>): Add 'inputs' field.
(manifest=?, lower-input): New procedure.
(profile-derivation)[builder]: Add #:log-port argument to
'union-build'.
[ensure-valid-input]: Remove.
Add each entry's inputs to the input list.
(options->installable): Return just the list of entries.
[package->manifest-entry]: Set 'inputs' field.
[canonicalize-deps]: Rename to...
[deduplicate]: ... this. Remove input fiddling.
(guix-package)[process-actions]: Use 'manifest=?' to compare the new
and old manifests. Pass directly PROF-DRV to 'show-what-to-build'.
Pass #:print-build-trace #f to 'set-build-options'.
* guix/scripts/package.scm (%user-environment-directory): Rename to...
(%user-profile-directory): ... this. Update users accordingly.
(profile-derivation): Use the term "profile" instead of "user
environment", and use "profile" as the derivation name.
* guix/scripts/package.scm (<manifest>, <manifest-entry>): New record
types.
(make-manifest, read-manifest, manifest->sexp, sexp->manifest,
read-manifest, write-manifest, remove-manifest-entry, manifest-remove,
manifest-installed?): New procedures.
(profile-derivation): Take a manifest as the second parameter. Use
'manifest->sexp'. Expect <manifest-entry> objects instead of
"tuples". Adjust callers accordingly.
(search-path-environment-variables): Changes 'packages' parameter to
'entries'. Rename 'package-in-manifest->package' to
'manifest-entry->package'; expect <manifest-entry> objects.
(display-search-paths): Rename 'packages' to 'entries'.
(options->installable): Change 'installed' to 'manifest'. Have
'canonicalize-deps' return name/path tuples instead of raw packages.
Rename 'package->tuple' to 'package->manifest-entry'. Use
<manifest-entry> objects instead of tuples.
(guix-package)[process-actions]: Likewise. Rename 'packages' to
'entries'.
[process-query]: Use 'manifest-entries' instead of
'manifest-packages'.
* guix/scripts/package.scm (find-package): Rename to...
(specification->package+output): ... this. Rename 'name' parmameter
to 'spec'. Return a package and output name instead of a tuple.
(options->installable): New procedure
(guix-package)[process-actions]: Use it, and remove corresponding
code.
Previously references to '%standard-phases' in builder-side code would
refer to the wrong one.
* guix/build-system/cmake.scm (cmake-build): Remove (guix build
gnu-build-system) from the default MODULES value.
* guix/build-system/perl.scm (perl-build): Likewise.
Reported at <http://bugs.gnu.org/15608>.
* guix/build/utils.scm (find-files): Change the 'error' procedure to
return RESULT. Before we would end up with an improper list.
* guix/records.scm (define-record-type*): Wrap field bindings in a
'let*', not in a 'letrec*', which turned out to be pointlessly
inconvenient.
* tests/records.scm: Adjust test names accordingly.
* scripts/guix.in (config-lookup): Add "localedir" entry.
(run-guix-main): Add call to 'bindtextdomain'.
* guix/ui.scm (initialize-guix): Use %GETTEXT-DOMAIN instead of a
literal.
* guix/gnu-maintenance.scm (%gnumaint-base-url): New variable.
(%package-list-url): Use it.
(%gsrc-package-list-url): Remove.
(%package-description-url): New variable.
(official-gnu-packages): Change to use %PACKAGE-DESCRIPTION-URL
instead of %GSRC-PACKAGE-LIST-URL. Adjust recutils field names
accordingly.
See <https://lists.gnu.org/archive/html/guix-devel/2013-09/msg00137.html>
for the rationale.
* guix/packages.scm (<origin>)[patches, patch-flags, patch-inputs,
patch-guile]: New fields.
(%standard-patch-inputs, default-guile, patch-and-repack): New
procedures.
(package-source-derivation): When 'patches' is non-empty, call
'patch-and-repack'.
* guix/utils.scm (file-sans-extension): New procedure.
* guix/monads.scm (<monad>): Turn in a raw SRFI-9 record type.
(define-monad): New macro.
(with-monad): Add a case for when MONAD is a macro.
(identity-return, identity-bind, store-return, store-bind): Inline.
(%identity-monad, %store-monad): Use 'define-monad'.
* tests/monads.scm ("monad?"): New test.
* guix/monads.scm: New file.
* tests/monads.scm: New file.
* Makefile.am (MODULES): Add guix/monads.scm.
(SCM_TESTS): Add tests/monads.scm.
* doc/guix.texi (The Store Monad): New node.
(The Store): Reference it.
* guix/build-system/trivial.scm (trivial-build): When SOURCE is true,
add it to INPUTS.
(trivial-cross-build): Likewise.
* tests/packages.scm ("trivial with source"): New test.
* guix/scripts/package.scm (switch-to-previous-generation): New function.
(roll-back): Use the new function instead of 'switch-link'.
(show-help): Add '--delete-generations'.
(%options): Likewise.
(guix-package)[process-actions]: Add 'current-generation-number',
'display-and-delete', and 'delete-generation'. Add support for
'--delete-generations', and reindent the code.
* tests/guix-package.sh: Test '--delete-generations'.
* doc/guix.texi (Invoking guix-package): Document '--delete-generations'.
* guix/scripts/package.scm (guix-package)[process-query]: Show that a
generation is the current one if the profile points to it.
* tests/guix-package.sh: Test it.
* guix/scripts/package.scm (guix-package)[process-query]: Change
'list-generation' to not list the zeroth generation.
* tests/guix-package.sh: Test it.
* doc/guix.texi (Invoking guix package): Document it, and use the
right term when talking about generations.
* guix/scripts/package.scm (guix-package)[process-query]: Exit with 1
when a generation does not exist or the profile points to the zeroth
generation.
* tests/guix-package.sh: Test the former case.
Suggested by Andreas Enge <andreas@enge.fr>.
* guix/scripts/package.scm (guix-package)[list-generations,
list-installed]: Reverse the result of 'manifest-packages'.
* doc/guix.texi (Invoking guix package): Document the order of packages
for '--list-generations' and '--list-installed'.
Fixes <http://bugs.gnu.org/15428>.
Reported by Cyrill Schenkel <cyrill.schenkel@gmail.com>.
* guix/scripts/pull.scm (guix-pull): 'unpack' returns a single value.
* 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/scripts/package.scm (profile-numbers): Rename to 'generation-numbers'.
(previous-profile-number): Rename to 'previous-generation-number'.
(profile-number): Rename to 'generation-number'.
(roll-back): Rename 'previous-profile' to 'previous-generation'.
* guix/store.scm (add-text-to-store): Make 'references' optional.
* tests/store.scm ("dead-paths", "references"): Use 'add-text-to-store'
with no optional argument.
* doc/guix.texi (The Store): Adjust accordingly.
to compile with Python 2 instead of the default Python 3.
* guix/build-system/python.scm (default-python2, package-with-explicit-python,
package-with-python2): New procedures.
* guix/build-system/python.scm (python2-pytz, python2-babel): Use
package-with-python2.
build system (switches to Python 3) and compute python-version instead of
passing it as a parameter.
* guix/build-system/python.scm (default-python): Switch to python-wrapper.
* guix/build-system/python.scm (python-build): Drop parameter #:python-version.
* guix/build/python-build-system.scm (wrap): Compute python version from input.
* guix/scripts/substitute-binary.scm (guix-substitute-binary)["--substitute"]:
Show the Nar size, when available.
* guix/ui.scm (show-what-to-build): Add 'TODO'.
This significantly reduces I/O when building profiles, especially with
lots of package-specific sub-directories (such as 'share/emacs/24.3',
'texmf', etc.)
* guix/build/union.scm (union-build)[file-tree](others-have-it?): New
procedure. Use it in the 'enter?' parameter of 'file-system-fold';
change 'skip' parameter accordingly.
* tests/union.scm ("union-build"): Ensure that 'include' is a symlink
and 'bin' is a directory.
* gnu/packages/linux-initrd.scm (qemu-initrd): Add (guix build utils) to
#:modules, and use it. Copy .scm and .go files to /root.
* guix/build/linux-initrd.scm (bind-mount): New procedure.
* gnu/packages/linux-initrd.scm (qemu-initrd): Add #:modules argument.
Factorize and move some of the code to...
* guix/build/linux-initrd.scm: ... here. New file.
* Makefile.am (MODULES): Add it.
* 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.
Fixes <http://bugs.gnu.org/15182>.
Reported by Mark H Weaver <mhw@netris.org>.
* guix/download.scm (%mirrors)[kernel.org]: Add ftp.be.debian.org and
mirror.linux.org.au.
* guix/build/gnu-dist.scm: New file.
* Makefile.am (MODULES): Add it.
* guix/build-system/gnu.scm (%default-modules): New variable.
(gnu-build): Use it.
(dist-package): New procedure.
* guix/packages.scm (package-source-derivation): Add cases for SOURCE as
a store path or user file.
* tests/packages.scm ("package-source-derivation, file",
"package-source-derivation, store path"): New tests.
This fixes Guile version comparisons when (version) has a
vendor-specific suffix.
Reported by Andreas Enge <andreas@enge.fr>.
* guix/utils.scm (guile-version>?): New procedure.
* tests/utils.scm ("guile-version>? 1.8", "guile-version>? 10.5"): New
tests.
* guix/scripts/substitute-binary.scm (fetch, progress-report-port): Use
`guile-version>?' instead of `version>?'.
* guix/http-client.scm (when-guile<=2.0.5, http-fetch): Likewise.
* guix/scripts/substitute-binary.scm (fetch): In the `file' case, open
with the `b' flag, so that the coding cookie reading thing doesn't
lead to buffering some of the data (on 2.0.5).
* tests/utils.scm ("filtered-port, file"): Open with `r0b'. Fixes a
test failure with Guile 2.0.5 whereby the first byte of FILE would be
missing from DECOMPRESSED.
* guix/scripts/package.scm (guix-package)[process-actions](same-package?):
New procedure. Use it instead of `alist-delete' when filtering out
duplicate packages from the profile.
This fixes a bug whereby a command like
guix package -e '(@@ (gnu packages base) gnu-make-boot0)'
would only succeed when the outputs of that package are available, and
otherwise fail with "/nix/store/... is not valid".
* guix/scripts/package.scm (guix-package)[process-action](package->tuple):
Leave P as is in the result. Move `package->tuple' call from INSTALL*
to INSTALL.
* guix/gnu-maintenance.scm (latest-release): Add `ftp-close' and
`ftp-open' keyword parameters.
* guix/scripts/package.scm (ftp-open*): New variable.
(check-package-freshness): Call `latest-release' with `ftp-open*' and
a no-op procedure.
* guix/scripts/substitute-binary.scm (%regexp-exec-mutex, string->uri):
Remove.
(regexp-exec): Replace this global binding by a thread-safety wrapper.
(fields->alist): Remove `with-mutex', and directly alias `recutils->alist'.
* guix/gnu-maintenance.scm (%gsrc-package-list-url): New variable.
(<gnu-package-descriptor>): Add `doc-description' field.
(official-gnu-packages)[group-package-fields]: Rename to...
[read-records]: ... this. Reverse the result.
[gsrc-description]: New procedure.
Add the "description" field to the alist passed to `alist->record'.
* guix/records.scm (%recutils-plus-rx): New variable.
(recutils->alist): Use it to read + lines.
* tests/records.scm ("recutils->alist with + lines"): New test.
* guix/gnu-maintenance.scm (official-gnu-packages)[group-package-fields]:
Rewrite in terms of `recutils->alist'. Remove `state' parameter.
Specify "doc-url" and "language" as multiple-value keys in the
`alist->record' call.
* guix/records.scm (%recutils-field-rx): New variable.
(recutils->alist): New procedure, formerly known as `fields->alist'.
* guix/scripts/substitute-binary.scm (fields->alist): Use it.
* tests/records.scm ("recutils->alist"): New test.
* 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/hash.scm (GCRY_MD_SHA256): New macro.
(sha256): Use it.
(open-sha256-md, md-write, md-read, md-close, open-sha256-port,
port-sha256): New procedures.
* tests/hash.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
Reported by Nikita Karetnikov and Cyril Roelandt.
* guix/ui.scm (show-what-to-build): Call `substitutable-path-info'
only when USE-SUBSTITUTES? is true.
* guix/web.scm (open-socket-for-uri): New procedure.
(http-fetch): Add `port' keyword parameter; use it.
* guix/scripts/substitute-binary.scm (%random-state): New variable.
(with-timeout): Wait a little before retrying.
(fetch): Use `open-socket-for-uri', and keep a copy of the socket in
variable `port'. Close PORT upon timeout.
* guix/build-system/trivial.scm (trivial-cross-build): Don't bind
`%target' here since this causes problem when BUILDER
contains (use-modules ...) clauses, and can be achieved differently
anyway.
* guix/build/utils.scm (set-path-environment-variable): When VALUE is
the empty string, call `unsetenv' instead of `setenv'.
* gnu/packages/guile.scm (guile-2.0)[arguments]: Remove `unsetenv'
trick.
* guix/scripts/substitute-binary.scm (decompressed-port): Improve docstring.
(progress-report-port): New procedure.
(guix-substitute-binary)["--substitute"]: Use it to report progress.
* guix/build/download.scm: Export `progress-proc' and `uri-abbreviation'.