Commit graph

1674 commits

Author SHA1 Message Date
Ludovic Courtès ead5c46147
channels: Error out when the 'guix' channel lacks an introduction.
* guix/channels.scm (latest-channel-instance): Raise an error instead of
warning when 'guix is unauthenticated.
* tests/channels.scm ("latest-channel-instances, missing introduction for 'guix'"):
New test.
2020-06-28 23:26:53 +02:00
Ludovic Courtès 0a8dd8aae5
tests: Allow 'tests/git-authenticate.scm' to run when git/gpg is missing.
Fixes <https://bugs.gnu.org/42077>.
Reported by Jan Nieuwenhuizen <janneke@gnu.org>.

The typo was introduced in 7b06781a58.

* tests/git-authenticate.scm <top level>: Remove call to 'which'
around (gpg+git-available?).
2020-06-28 23:26:53 +02:00
Ludovic Courtès 0505eda9c7
packages: Recognize SHA3 and BLAKE2s for 'content-hash'.
* guix/packages.scm (build-content-hash): Add 'sha3-256', 'sha3-512',
and 'blake2s-256'.
* tests/packages.scm ("package-source-derivation, origin, sha3-512"):
New test.
2020-06-27 23:42:20 +02:00
Ludovic Courtès 8e6c1415d8
daemon: Recognize SHA3 and BLAKE2s.
* nix/libutil/hash.hh (HashType): Add htSHA3_256, htSHA3_512, and
htBLAKE2s_256.
* nix/libutil/hash.cc (parseHashType, printHashType): Recognize them.
* tests/store.scm ("add-to-store"): Test these algorithms.
2020-06-27 23:42:20 +02:00
Ludovic Courtès 95c2bc49cf
tests: Skip lint tests when HTTP server cannot listen.
This could happen when running tests in parallel.

* tests/lint.scm ("github-url")
("github-url: one suggestion")
("github-url: already the correct github url")
("archival: missing content")
("archival: content available")
("archival: missing revision")
("archival: revision available")
("archival: rate limit reached"): Add 'test-skip' statement above.
2020-06-26 16:19:53 +02:00
Ludovic Courtès a18d02def9
channels: Fix test for introductory commit signer.
Until now the test would always succeed because it would return
'failed, which has truth value.  The exercise
'verify-introductory-commit', we need to add a second commit beyond the
introductory commit, which is what we do here.

* tests/channels.scm ("authenticate-channel, wrong first commit
signer"): Add a second commit and authenticate up to that one.  Change
'message?' to 'message-condition?'.
2020-06-25 01:20:31 +02:00
Ludovic Courtès 7b06781a58
tests: Skip tests that requires gpg when gpg is unavailable.
Partly fixes <https://bugs.gnu.org/41932>.
Reported by Simen Endsjø <simendsjo@gmail.com>.

* tests/git-authenticate.scm ("signed commits, SHA1 signature"): Use
'gpg+git-available?' in skip guard.
2020-06-20 13:18:11 +02:00
Ludovic Courtès 90f496be9a
tests: Actually run 'tests/guix-environment-container.sh'.
This test was skipped since the switch to Guile 3 because
'assert-container-features' would be inlined and thus accessing it with
@@ would fail with an unbound-variable error.

* guix/scripts/environment.scm (assert-container-features): Export.
* tests/guix-environment-container.sh: Use single '@'.
2020-06-20 13:18:11 +02:00
Ludovic Courtès 5bafc70d1e
channels: Make 'validate-pull' call right after clone/pull.
This should come before patching, authentication, etc.

* guix/channels.scm (latest-channel-instance): Add #:validate-pull
parameter and honor it.  Return a single value: the instance.
(ensure-forward-channel-update): Change 'instance' parameter to 'commit'
and adjust accordingly.
(latest-channel-instances): Adjust to 'latest-channel-instance' changes.
* guix/scripts/pull.scm (warn-about-backward-updates): Change 'instance'
parameter to 'commit' and adjust accordingly.
* tests/channels.scm ("latest-channel-instances #:validate-pull"):
Likewise.
2020-06-16 16:10:47 +02:00
Ludovic Courtès 43badf261f
channels: 'latest-channel-instance' authenticates Git checkouts.
Fixes <https://bugs.gnu.org/22883>.

* guix/channels.scm (<channel>)[introduction]: New field.
(<channel-introduction>): New record type.
(%guix-channel-introduction): New variable.
(%default-channels): Use it.
(<channel-metadata>)[keyring-reference]: New field.
(%default-keyring-reference): New variable.
(read-channel-metadata, read-channel-metadata-from-source): Initialize
the 'keyring-reference' field.
(commit-short-id, verify-introductory-commit)
(authenticate-channel): New procedures.
(latest-channel-instance): Call 'authenticate-channel' when CHANNEL has
an introduction.
* tests/channels.scm (gpg+git-available?, commit-id-string): New
procedures.
("authenticate-channel, wrong first commit signer"):
("authenticate-channel, .guix-authorizations"): New tests.
* doc/guix.texi (Invoking guix pull): Mention authentication.
2020-06-16 16:10:47 +02:00
Ludovic Courtès 1e2b9bf2d4
tests: Move OpenPGP helpers to (guix tests gnupg).
* tests/git-authenticate.scm (key-id): Remove.
(%ed25519-public-key-file, %ed25519-secret-key-file)
(%ed25519bis-public-key-file, %ed25519bis-secret-key-file)
(read-openpgp-packet, key-fingerprint): Move to...
* guix/tests/gnupg.scm: ... here.
2020-06-16 16:10:46 +02:00
Konrad Hinsen c924e54139
guix repl: Add script execution.
* guix/scripts/repl.scm: Add filename options for script execution.
* doc/guix.texi (Invoking guix repl): Document it.
* tests/guix-repl.sh: Test it.
* Makefile.am: (SH_TESTS): Add it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-06-14 23:02:36 +02:00
Ludovic Courtès 993023a28e
lint: Add 'check-for-collisions' checker.
Suggested by Edouard Klein <edk@beaver-labs.com>.

* guix/profiles.scm (check-for-collisions): Export.
* guix/lint.scm (check-profile-collisions): New procedure.
(%local-checkers): Add 'profile-collisions' checker.
* tests/lint.scm ("profile-collisions: no warnings")
("profile-collisions: propagated inputs collide")
("profile-collisions: propagated inputs collide, store items"): New tests.
* doc/guix.texi (Invoking guix lint): Document it.
2020-06-14 15:34:42 +02:00
Ludovic Courtès 52c529ff20
git-authenticate: Disallow SHA1 (and MD5) signatures.
* guix/git-authenticate.scm (commit-signing-key): Add
 #:disallowed-hash-algorithms and honor it.
(authenticate-commit)[recent-commit?]: New variable.
Pass #:disallowed-hash-algorithms to 'commit-signing-key'.
* tests/git-authenticate.scm ("signed commits, SHA1 signature"): New test.
2020-06-12 18:56:11 +02:00
Ludovic Courtès 03a70e4c19
packages: 'package-grafts' returns grafts for all the relevant outputs.
Fixes <https://bugs.gnu.org/41796>.
Reported by Jakub Kądziołka <kuba@kadziolka.net>.

* guix/packages.scm (input-graft): Add 'output' parameter and honor it.
Add OUTPUT to the cache key.
(input-cross-graft): Likewise.
(fold-bag-dependencies): Operate on inputs instead of nodes.  Turn
VISITED into a vhash instead of a set.  Pass PROC HEAD and OUTPUT
instead of just HEAD.
(bag-grafts): Adjust accordingly.
* tests/packages.scm ("package-grafts, dependency on several outputs"):
New test.
2020-06-11 19:05:05 +02:00
Ludovic Courtès 72357e2170
git: 'commit-difference' really excludes the ancestors of #:excluded.
* guix/git.scm (commit-difference): Initialize VISITED to the closure of
OLD and EXCLUDED, as written in the docstring.
* tests/git.scm ("commit-difference, excluded commits"): Adjust
accordingly.
2020-06-09 00:34:52 +02:00
Jan (janneke) Nieuwenhuizen 59bcffa314
system: examples: Add bare-hurd.tmpl.
* gnu/system/hurd.scm (%hurd-def%hurd-default-operating-system-kernel,
%hurd-default-operating-system): New exported variables.
* gnu/system/examples/bare-hurd.tmpl: New file.
* Makefile.am (EXAMPLES): Add it.
* tests/guix-system.sh: Add --target=i586-pc-gnu when testing it.
2020-06-08 13:51:19 +02:00
Ludovic Courtès e782756080
git-authenticate: Prevent removal of '.guix-authorizations'.
* guix/git-authenticate.scm (commit-authorized-keys)
[parents-have-authorizations-file?, assert-parents-lack-authorizations]:
New procedures.
Use the latter before returning DEFAULT-AUTHORIZATIONS.
* guix/git.scm (false-if-git-not-found): Export.
* guix/tests/git.scm (populate-git-repository): Add 'remove' clause.
* tests/git-authenticate.scm ("signed commits, .guix-authorizations removed"):
New test.
2020-06-07 23:10:46 +02:00
Ludovic Courtès b49caaa2b7
packages: Make 'bag-grafts' insensitive to '%current-target-system'.
Fixes <https://bugs.gnu.org/41713>.
Reported by Mathieu Othacehe.

* guix/packages.scm (bag-grafts): Wrap 'fold-bag-dependencies' calls in
'parameterize'.
* tests/packages.scm ("package->bag, sensitivity to
%current-target-system"): New test.
2020-06-06 23:28:48 +02:00
Ludovic Courtès c83eedba23
git-authenticate: Add tests.
* guix/tests/git.scm (call-with-environment-variables)
(with-environment-variables): Remove.
* guix/tests/git.scm (populate-git-repository): Add clauses for signed
commits and signed merges.
* guix/tests/gnupg.scm: New file.
* tests/git-authenticate.scm: New file.
* tests/ed25519bis.key, tests/ed25519bis.sec: New files.
* Makefile.am (dist_noinst_DATA): Add 'guix/tests/gnupg.scm'.
(SCM_TESTS): Add 'tests/git-authenticate.scm'.
(EXTRA_DIST): Add tests/ed25519bis.{key,sec}.
2020-06-05 22:54:06 +02:00
Mathieu Othacehe ea924134f8
tests: syscall: Support file-systems without extended attributes.
* tests/syscalls.scm (setxattr): Catch ENOTSUP that can be raised if the
file-system does not support extended user attributes.
2020-06-05 19:20:23 +02:00
Simon South cb21c14b0a
tests: Allow passing on systems without support for swap devices.
* tests/syscalls.scm ("swapon", "swapoff"): Accept ENOSYS as a valid result.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2020-06-02 10:24:03 +02:00
Ludovic Courtès abf43d4511
gexp: Fix expansion for (file-append (local-file ...) ...).
Fixes <https://bugs.gnu.org/41527>.
Regression introduced in d03001a31a.

* guix/gexp.scm (lower+expand-object): When LOWERED is not a struct and
EXPAND is true, call EXPAND.
* tests/gexp.scm ("file-append, raw store item"): New test.
2020-05-25 23:00:30 +02:00
Ludovic Courtès e033700f17
tests: Hide quoted (define-module ...) form from Geiser.
* tests/gexp.scm (%extension-package): Split (define-module ...) form to
fool Geiser.
2020-05-25 23:00:30 +02:00
Ludovic Courtès 872898f768
channels: 'latest-channel-instances' guards against non-forward updates.
* guix/channels.scm (latest-channel-instance): Add #:starting-commit and
pass it to 'update-cached-checkout'.  Return the commit relation as a
second value.
(ensure-forward-channel-update): New procedure.
(latest-channel-instances): Add #:current-channels and #:validate-pull.
[current-commit]: New procedure.
Pass #:starting-commit to 'latest-channel-instance'.  When the returned
relation is true, call VALIDATE-PULL.
(latest-channel-derivation): Add #:current-channels and #:validate-pull.
Pass them to 'latest-channel-instances*'.
* tests/channels.scm ("latest-channel-instances #:validate-pull"): New
test.
2020-05-25 00:00:28 +02:00
Ludovic Courtès 8d1d56578a
git: 'update-cached-checkout' returns the commit relation.
* guix/git.scm (update-cached-checkout): Add #:starting-commit
parameter.  Call 'commit-relation' when #:starting-commit is true.
Always return the relation or #f as the third value.
(latest-repository-commit): Adjust accordingly.
* guix/import/opam.scm (get-opam-repository): Likewise.
* tests/channels.scm ("latest-channel-instances includes channel dependencies")
("latest-channel-instances excludes duplicate channel dependencies"):
Update mock of 'update-cached-checkout' accordingly.
2020-05-25 00:00:28 +02:00
Ludovic Courtès c098c11be8
git: Add 'commit-relation'.
* guix/git.scm (commit-relation): New procedure.
* tests/git.scm ("commit-relation"): New test.
2020-05-25 00:00:28 +02:00
zimoun 881eaae1ab
guix package: Support multiple profiles with '--list-installed'.
* guix/scripts/package.scm (process-query): List installed multiple profiles.
* tests/guix-package-net.sh: Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-23 16:29:29 +02:00
Ludovic Courtès 197c07a847
tests: Use a #:prefix for (gcrypt hash).
* tests/packages.scm: Use #:prefix instead of #:hide for (gcrypt hash).
This accomodates for 'sha512' syntax literal matches with Guile-Gcrypt 0.3.0,
which exports 'sha512' in addition to 'sha256'.
2020-05-23 16:29:29 +02:00
Ludovic Courtès ce0be5675b
packages: Introduce <content-hash> and use it in <origin>.
* guix/packages.scm (<content-hash>): New record type.
(define-content-hash-constructor, build-content-hash)
(content-hash): New macros.
(print-content-hash): New procedure.
(<origin>): Rename constructor to '%origin'.
[sha256]: Remove field.
[hash]: New field.  Adjust users.
(origin-compatibility-helper, origin): New macros.
(origin-sha256): New deprecated procedure.
(origin->derivation): Adjust accordingly.
* tests/packages.scm ("package-source-derivation, origin, sha512"): New
test.
* guix/tests.scm: Hide (gcrypt hash) 'sha256' for proper syntax
matching.
* tests/challenge.scm: Add #:prefix for (gcrypt hash) and adjust users.
* tests/derivations.scm: Likewise.
* tests/store.scm: Likewise.
* tests/graph.scm ("bag DAG, including origins"): Provide 'sha256' field
with the right length.
* gnu/packages/aspell.scm (aspell-dictionary)
(aspell-dict-ca, aspell-dict-it): Use 'hash' and 'content-hash' for
proper syntax matching.
* gnu/packages/bash.scm (bash-patch): Rename 'sha256' to 'sha256-bv'.
* gnu/packages/bootstrap.scm (bootstrap-executable): Rename 'sha256' to 'bv'.
* gnu/packages/readline.scm (readline-patch): Likewise.
* gnu/packages/virtualization.scm (qemu-patch): Rename 'sha256' to
'sha256-bv'.
* guix/import/utils.scm: Hide (gcrypt hash) 'sha256'.
2020-05-22 01:29:39 +02:00
Ludovic Courtès 0e4e9c8e76
guix hash, guix download: Support base64 format.
* guix/scripts/download.scm (show-help, %options): Support "base64"
format.
* guix/scripts/hash.scm (show-help, %options): Likewise.
* tests/guix-hash.sh: Test it.
* doc/guix.texi (Invoking guix hash): Document it.
2020-05-22 00:35:24 +02:00
Ludovic Courtès 18ae1ec3ec
guix hash, guix download: Add '--hash'.
* guix/scripts/download.scm (%default-options): Add 'hash-algorithm'.
(show-help, %options): Add "--hash".
(guix-download): Honor it.
* guix/scripts/hash.scm (%default-options): Add 'hash-algorithm'.
(show-help, %options): Add "--hash".
(guix-hash): Honor it.
* tests/guix-hash.sh: Test '-H sha512'.
* doc/guix.texi (Invoking guix download): Document it.
(Invoking guix hash): Document it.
2020-05-22 00:35:24 +02:00
Ludovic Courtès 9418aaa00d
tests: Test fixed-output derivations with several hash algorithms.
* tests/derivations.scm ("fixed-output derivation"): Test several hash
algorithms.
2020-05-22 00:35:23 +02:00
Ludovic Courtès 73b27eaa64
tests: Test 'add-to-store' with several hash algorithms.
* tests/store.scm ("add-to-store"): New test.
2020-05-22 00:35:23 +02:00
Maxim Cournoyer b460ba7992
bootloader: grub: Allow booting from a Btrfs subvolume.
* gnu/bootloader/grub.scm (strip-mount-point): Remove procedure.
(normalize-file): Add procedure.
(grub-configuration-file): New BTRFS-SUBVOLUME-FILE-NAME parameter.  When
defined, prepend its value to the kernel and initrd file names, using the
NORMALIZE-FILE procedure.  Adjust the call to EYE-CANDY to pass the
BTRFS-SUBVOLUME-FILE-NAME argument.  Normalize the KEYMAP file as well.
(eye-candy): Add a BTRFS-SUBVOLUME-FILE-NAME parameter, and use it, along with
the NORMALIZE-FILE procedure, to normalize the FONT-FILE and IMAGE nested
variables.  Adjust doc.
* gnu/bootloader/depthcharge.scm (depthcharge-configuration-file): Adapt.
* gnu/bootloader/extlinux.scm (extlinux-configuration-file): Likewise.
* gnu/system/file-systems.scm (btrfs-subvolume?)
(btrfs-store-subvolume-file-name): New procedures.
* gnu/system.scm (operating-system-bootcfg): Specify the Btrfs
subvolume file name the store resides on to the
`operating-system-bootcfg' procedure, using the new
BTRFS-SUBVOLUME-FILE-NAME argument.
* doc/guix.texi (File Systems): Add a Btrfs subsection to document the use of
subvolumes.
* gnu/tests/install.scm (%btrfs-root-on-subvolume-os)
(%btrfs-root-on-subvolume-os-source)
(%btrfs-root-on-subvolume-installation-script)
(%test-btrfs-root-on-subvolume-os): New variables.
2020-05-20 08:30:35 -04:00
Maxim Cournoyer fa35fb58c8
file-systems: Add helpers for parsing the options string into an alist.
* gnu/system/file-systems.scm (file-system-options->alist)
(alist->file-system-options): New procedures.
* tests/file-systems.scm: New tests.
* doc/guix.texi (File Systems): Add note about the newly added procedures.
2020-05-20 08:30:34 -04:00
Ludovic Courtès 644cb40cd8
gexp: Add 'let-system'.
* guix/gexp.scm (<system-binding>): New record type.
(let-system): New macro.
(system-binding-compiler): New procedure.
(default-expander): Add 'self-quoting?' case.
(self-quoting?): New procedure.
(lower-inputs): Add 'filterm'.  Pass the result of
'mapm/accumulate-builds' through FILTERM.
(gexp->sexp)[self-quoting?]: Remove.
* tests/gexp.scm ("let-system", "let-system, target")
("let-system, ungexp-native, target")
("let-system, nested"): New tests.
* doc/guix.texi (G-Expressions): Document it.
2020-05-16 00:34:41 +02:00
Ludovic Courtès 6456232164
pack: Add relocation via ld.so and fakechroot.
* gnu/packages/aux-files/run-in-namespace.c (HAVE_EXEC_WITH_LOADER): New
macro.
(bind_mount): Rename to...
(mirror_directory): ... this.  Add 'firmlink' argument and use it
instead of calling mkdir/open/close/mount directly.
(bind_mount, make_symlink): New functions.
(exec_in_user_namespace): Adjust accordingly.
(exec_with_loader) [HAVE_EXEC_WITH_LOADER]: New function.
(exec_performance): New function.
(engines): Add them.
* guix/scripts/pack.scm (wrapped-package)[fakechroot-library]
[audit-module]: New procedures.
[audit-source]: New variable.
[build](elf-interpreter, elf-loader-compile-flags): New procedures.
(build-wrapper): Use them.
* tests/guix-pack-relocatable.sh: Test with
'GUIX_EXECUTION_ENGINE=fakechroot'.
* doc/guix.texi (Invoking guix pack): Document the 'performance' and
'fakechroot' engines.
* gnu/packages/aux-files/pack-audit.c: New file.
* Makefile.am (AUX_FILES): Add it.
2020-05-14 17:21:27 +02:00
Ludovic Courtès fde2aec3f4
pack: Wrapper honors 'GUIX_EXECUTION_ENGINE' environment variable.
* gnu/packages/aux-files/run-in-namespace.c (struct engine): New type.
(exec_default): New function.
(engines): New variable.
(execution_engine): New function.
(main): Use it instead of calling 'exec_in_user_namespace' and
'exec_with_proot' directly.
* tests/guix-pack-relocatable.sh: Add test with 'GUIX_EXECUTION_ENGINE'.
* doc/guix.texi (Invoking guix pack): Document 'GUIX_EXECUTION_ENGINE'.
2020-05-14 17:21:27 +02:00
Ludovic Courtès 80963744a2
store: 'mapm/accumulate-builds' preserves '%current-target-system'.
Fixes <https://bugs.gnu.org/41182>.

* guix/store.scm (mapm/accumulate-builds): Pass #:system and #:target to
'run-with-store'.
* tests/store.scm ("mapm/accumulate-builds, %current-target-system"):
New test.
* tests/guix-pack.sh: Add 'guix pack -d --target' test.
2020-05-14 17:21:27 +02:00
Ludovic Courtès f52fbf7094
packages: Ensure bags are insensitive to '%current-target-system'.
Fixes a bug whereby a bag's transitive dependencies would depend on the
global '%current-target-system' value.

Partly fixes <https://issues.guix.gnu.org/41182>.

* guix/packages.scm (bag-transitive-inputs)
(bag-transitive-build-inputs, bag-transitive-target-inputs):
Parameterize '%current-target-system'.
* tests/packages.scm ("package->bag, sensitivity to %current-target-system"):
New test.
2020-05-14 17:21:27 +02:00
Jan (janneke) Nieuwenhuizen df05842332
syscalls: Add 'getxattr'.
* guix/build/syscalls.scm (getxattr): New procedure.
* tests/syscalls.scm ("getxattr, setxattr"): Test it, together with setxattr.
2020-05-14 00:48:12 +02:00
Ludovic Courtès 88a96c568c
guix graph: Add '--path'.
* guix/scripts/graph.scm (display-path): New procedure.
(%options, show-help): Add '--path'.
(guix-graph): Handle it.
* tests/guix-graph.sh: Add tests.
* doc/guix.texi (Invoking guix graph): Document it.
(Invoking guix size): Mention it.
2020-05-11 23:30:55 +02:00
Ludovic Courtès 36c2192414
graph: Add 'shortest-path'.
* guix/graph.scm (shortest-path): New procedure.
* tests/graph.scm ("shortest-path, packages + derivations")
("shortest-path, reverse packages")
("shortest-path, references"): New tests.
2020-05-11 23:30:55 +02:00
Ludovic Courtès 7240202136
graph: reference/referrer node types work with graph traversal.
The graph traversal procedures in (guix graph) assume that nodes can be
compared with 'eq?', which was not the case for nodes of
%REFERENCE-NODE-TYPE and %REFERRER-NODE-TYPE (strings).

* guix/scripts/graph.scm (intern): New procedure.
(ensure-store-items, references*)
(%reference-node-type, non-derivation-referrers)
(%referrer-node-type): Use it on all store items.
* tests/graph.scm ("node-transitive-edges, references"): New test.
2020-05-11 23:30:55 +02:00
Ludovic Courtès 647c57207a
tests: Test 'guix show' with multiple packages.
* tests/guix-package-aliases.sh: Test 'guix show' with multiple packages.
2020-05-11 23:30:54 +02:00
Ludovic Courtès 053b10c3ef
channels: Add mechanism to patch checkouts of the 'guix channel.
* guix/channels.scm (<patch>): New record type.
(apply-patches): New procedure.
(latest-channel-instance)[dot-git?]: New procedure.
Use 'update-cached-checkout' and 'add-to-store' instead of
'latest-repository-commit'.  Call 'apply-patches' when CHANNEL is the
'guix channel.
(%patches): New variable.
* guix/git.scm (url+commit->name): Make public.
* tests/channels.scm ("latest-channel-instances includes channel dependencies")
("latest-channel-instances excludes duplicate channel dependencies"):
Mock 'update-cached-checkout' instead of 'latest-repository-commit'.
Wrap body in 'with-store' and pass the store to 'latest-channel-instances'.
2020-05-07 10:06:15 +02:00
Marius Bakke 87a40d7203
Merge branch 'master' into core-updates 2020-05-05 20:43:21 +02:00
Ludovic Courtès b835e158d5
openpgp: Add 'string->openpgp-packet'.
* guix/openpgp.scm (string->openpgp-packet): New procedure.
* tests/openpgp.scm ("verify-openpgp-signature, missing key")
("verify-openpgp-signature, good signatures")
("verify-openpgp-signature, bad signature"): Use it.
2020-05-04 09:56:13 +02:00
Ludovic Courtès bd8126558d
openpgp: 'lookup-key-by-{id,fingerprint}' return the key first.
Previously, 'lookup-key-by-{id,fingerprint}' would always return the
list of packets where the primary key is first.  Thus, the caller would
need to use 'find' to actually find the requested key.

* guix/openpgp.scm (keyring-insert): Always add KEY to PACKETS.
(lookup-key-by-id, lookup-key-by-fingerprint): Change to return the key
as the first value.
(verify-openpgp-signature): Remove now unneeded call to 'find'.
* tests/openpgp.scm ("get-openpgp-keyring"): Adjust accordingly.
2020-05-04 09:56:13 +02:00
Ludovic Courtès b45fa0a123
openpgp: 'verify-openpgp-signature' looks up by fingerprint when possible.
* guix/openpgp.scm (verify-openpgp-signature): Use
'lookup-key-by-fingerprint' when SIG contains a fingerprint.
Honor FINGERPRINT in the 'find' predicate.  Upon missing-key, return
FINGERPRINT if available.
* tests/openpgp.scm ("verify-openpgp-signature, missing key"): Adjust
expected value accordingly.
2020-05-04 09:56:12 +02:00
Ludovic Courtès efe1f0122c
openpgp: Add 'lookup-key-by-fingerprint'.
* guix/openpgp.scm (<openpgp-keyring>)[table]: Rename to...
[ids]: ... this.
[fingerprints]: New field.
(keyring-insert, lookup-key-by-fingerprint): New procedures.
(%empty-keyring): Adjust.
(get-openpgp-keyring): Manipulate KEYRING instead of its vhash, use
'keyring-insert'.
* tests/openpgp.scm ("get-openpgp-keyring"): Test
'lookup-key-by-fingerprint'.
2020-05-04 09:56:12 +02:00
Ludovic Courtès 7b2b3a13cc
openpgp: Store the issuer key id and fingerprint in <openpgp-signature>.
* guix/openpgp.scm (<openpgp-signature>)[issuer, issuer-fingerprint]:
New fields.
(openpgp-signature-issuer, openpgp-signature-issuer-fingerprint): Remove.
(verify-openpgp-signature): Use 'openpgp-signature-issuer-key-id'.
(get-signature): Initialize 'issuer' and 'issuer-fingerprint'.
* tests/openpgp.scm ("get-openpgp-detached-signature/ascii"): Adjust
accordingly.
2020-05-04 09:56:12 +02:00
Ludovic Courtès 4459c7859c
openpgp: Decode the issuer-fingerprint signature subpacket.
* guix/openpgp.scm (SUBPACKET-ISSUER-FINGERPRINT): New variable.
(openpgp-signature-issuer-fingerprint): New procedure.
(key-id-matches-fingerprint?): New procedure.
(get-signature): Look for the 'issuer and 'issuer-fingerprint
subpackets.  Ensure the issuer key ID matches the fingerprint when both
are available.
(parse-subpackets): Handle SUBPACKET-ISSUER-FINGERPRINT.
* tests/openpgp.scm (%rsa-key-fingerprint)
(%dsa-key-fingerprint, %ed25519-key-fingerprint): New variables.
* tests/openpgp.scm ("get-openpgp-detached-signature/ascii"): Check the
result of 'openpgp-signature-issuer-fingerprint'.
2020-05-04 09:56:12 +02:00
Ludovic Courtès 43408e304f
Add (guix openpgp).
* guix/openpgp.scm, tests/openpgp.scm, tests/civodul.key,
tests/dsa.key, tests/ed25519.key, tests/rsa.key,
tests/ed25519.sec: New files.
* Makefile.am (MODULES): Add guix/openpgp.scm.
(SCM_TESTS): Add tests/openpgp.scm.
(EXTRA_DIST): Add tests/*.key and tests/ed25519.sec.
2020-05-04 09:56:12 +02:00
Marius Bakke 8bf8cd9b85
Merge branch 'master' into core-updates
Conflicts:
	gnu/local.mk
	gnu/packages/backup.scm
	gnu/packages/emacs-xyz.scm
	gnu/packages/guile.scm
	gnu/packages/lisp.scm
	gnu/packages/openldap.scm
	gnu/packages/package-management.scm
	gnu/packages/web.scm
	gnu/packages/xorg.scm
2020-04-30 23:47:49 +02:00
Ludovic Courtès 5dfe02c607
tests: Remove trailing commas in JSON tests.
These commas are rejected by Guile-JSON 3.5.0.

* tests/crate.scm (test-foo-dependencies)
(test-root-dependencies, test-intermediate-1-dependencies)
(test-intermediate-2-dependencies): Remove trailing commas.
* tests/gem.scm (test-bar-json): Likewise.
* tests/pypi.scm (test-json): Likewise.
2020-04-27 23:29:40 +02:00
Ludovic Courtès ef674a24c5
profiles: Add lowerable <profile> record type.
* guix/profiles.scm (<profile>): New record type.
* tests/profiles.scm ("<profile>"): New test.
2020-04-26 22:49:48 +02:00
Marius Bakke c57d649de3
Merge branch 'master' into core-updates 2020-04-24 17:28:11 +02:00
Ludovic Courtès 2520059bdb
pack: 'guix pack -R' wrapper correctly reports exit code.
Fixes <https://bugs.gnu.org/40816>.
Reported by Jan (janneke) Nieuwenhuizen <janneke@gnu.org>.

* gnu/packages/aux-files/run-in-namespace.c (main): In the 'default'
case, check 'WIFEXITED (status)' and exit with the corresponding code in
that case.  Exit with 255 in other cases.
* tests/guix-pack-relocatable.sh: Add test.
2020-04-24 16:21:13 +02:00
Marius Bakke 030f6f489f
Merge branch 'master' into core-updates
Conflicts:
	etc/news.scm
	gnu/local.mk
	gnu/packages/bootloaders.scm
	gnu/packages/linphone.scm
	gnu/packages/linux.scm
	gnu/packages/tls.scm
	gnu/system.scm
2020-04-23 13:33:09 +02:00
Ricardo Wurmus 10af34cd7f
tests: Update expected values for package->code.
Reported by janneke on IRC.

* tests/print.scm: Update expected package definitions produced by package->code.
2020-04-20 10:57:49 +02:00
Ludovic Courtès e85d4cecbe
gnu: commencement: Memoize packages as a function of the system.
Previous, things like 'ld-wrapper-boot0' would be memoized with
(mlambda () …).  However, the definition of 'ld-wrapper-boot0' depends
on the result of (%boot0-inputs), which is itself a function
of (%current-system).  Thus, if one first calls:

  (parameterize ((%current-system "x86_64-linux"))
    (ld-wrapper-boot0))

then, in all subsequent calls to 'ld-wrapper-boot0', the value
of (%current-system) would be ignored because the result is already
memoized.  Concretely, 'ld-wrapper-boot0' would always have the
dependencies it has on x86_64-linux, even though they are different than
those on armhf-linux, say ("bash-mesboot" vs. "bootstrap-binaries").

Fixes <https://bugs.gnu.org/40482>.
Reported by Marius Bakke <mbakke@fastmail.com>.

* gnu/packages/commencement.scm (define/system-dependent): New macro.
(linux-libre-headers-boot0, hurd-core-headers-boot0, ld-wrapper-boot0)
(gcc-boot0-intermediate-wrapped, gcc-boot0-wrapped, ld-wrapper-boot3):
Define using 'define/system-dependent' instead of 'define' + 'mlambda'.
Adjust users so they no longer look like procedure calls.
* tests/guix-build.sh: Add test.
2020-04-11 00:32:41 +02:00
Marius Bakke 2778302399
Merge branch 'master' into core-updates
Conflicts:
	etc/news.scm
	gnu/local.mk
	gnu/packages/check.scm
	gnu/packages/cross-base.scm
	gnu/packages/gimp.scm
	gnu/packages/java.scm
	gnu/packages/mail.scm
	gnu/packages/sdl.scm
	gnu/packages/texinfo.scm
	gnu/packages/tls.scm
	gnu/packages/version-control.scm
2020-04-08 13:00:50 +02:00
Ludovic Courtès 3cea550788
tests: Adjust '--with-commit' test for tags.
This is a followup to efa578ecae.

* tests/guix-build-branch.sh: Adjust '--with-commit=guile-gcrypt=v0.1.0'
test to expect the tag ID rather than the commit ID.
2020-04-04 18:52:36 +02:00
Ludovic Courtès 8ed597f4a2
store: 'with-store' doesn't close the store upon abort.
Fixes <https://bugs.gnu.org/40428>.
Reported by Marius Bakke <mbakke@fastmail.com> and 白い熊.

Regression introduced with the first uses of 'with-build-handler' in
commit 62195b9a8f and subsequent.

* guix/store.scm (call-with-store): Use 'catch #t' instead of
'dynamic-wind'.  This ensures STORE remains open when a non-local exit
other than an exception occurs, such as an abort to the build handler
prompt.
* tests/store.scm ("with-build-handler + with-store"): New test.
2020-04-04 18:52:35 +02:00
Ludovic Courtès b771e0176a
pack: Adjust test to '--dry-run' changes.
This is a followup to 131f50cdc9.

* tests/guix-pack.sh: Use '--no-grafts' in conjunction with '-n' and '-d'.
2020-03-31 00:06:36 +02:00
Ludovic Courtès a357849f5b
guix package: Do not misdiagnose upgrades when there are propagated inputs.
Fixes <https://bugs.gnu.org/35872>.
Reported by Andy Tai <atai@atai.org>.

* guix/profiles.scm (list=?, manifest-entry=?): New procedures.
* guix/scripts/package.scm (transaction-upgrade-entry): In the '=' case,
use 'manifest-entry=?' to determine whether it's an upgrade.
* tests/packages.scm ("transaction-upgrade-entry, zero upgrades,
propagated inputs"): New test.
2020-03-31 00:06:36 +02:00
Ludovic Courtès b9c79cae53
guix package: Add 'transaction-upgrade-entry' test.
* tests/packages.scm ("transaction-upgrade-entry, zero upgrades, equivalent package"):
New test.
2020-03-31 00:06:36 +02:00
Ludovic Courtès a187cc5628
guix package: 'transaction-upgrade-entry' swallows build requests.
Fixes a regression introduced in
131f50cdc9 whereby the install/upgrade
message would not be displayed:

  $ guix upgrade -n
  2.1 MB would be downloaded:
     /gnu/store/…-something-1.2
     /gnu/store/…-its-dependency-2.3

This is because we'd directly abort from 'transaction-upgrade-entry' to
the build handler of 'build-notifier'.

* guix/scripts/package.scm (transaction-upgrade-entry): Call 'string=?'
expression in 'with-build-handler'.
* tests/packages.scm ("transaction-upgrade-entry, grafts"): New test.
2020-03-31 00:06:36 +02:00
Marius Bakke ae0badf5bb
Merge branch 'master' into core-updates
Conflicts:
	gnu/packages/admin.scm
	gnu/packages/commencement.scm
	gnu/packages/guile.scm
	gnu/packages/linux.scm
	gnu/packages/package-management.scm
	gnu/packages/pulseaudio.scm
	gnu/packages/web.scm
2020-03-30 12:17:33 +02:00
Ludovic Courtès c40bf5816c
store: Add 'map/accumulate-builds'.
* guix/store.scm (<unresolved>): New record type.
(build-accumulator, map/accumulate-builds, mapm/accumulate-builds): New
procedures.
* tests/store.scm ("map/accumulate-builds", "mapm/accumulate-builds"):
New tests.
2020-03-29 15:32:17 +02:00
Marius Bakke 18af687037
Merge branch 'master' into core-updates
Conflicts:
	gnu/packages/icu4c.scm
	gnu/packages/man.scm
	gnu/packages/python-xyz.scm
	guix/scripts/environment.scm
	guix/scripts/pack.scm
	guix/scripts/package.scm
	guix/scripts/pull.scm
	guix/store.scm
2020-03-27 00:12:15 +01:00
Ludovic Courtès c136da3fbd
tests: Adjust to 'show-manifest-transaction' changes.
This is a followup to 3e5ab0a7a9.

* tests/ui.scm ("show-manifest-transaction"): Update regexp.
* tests/guix-package.sh: Adjust Emacs regexp in --with-source test.
2020-03-25 16:02:53 +01:00
Ludovic Courtès 9acacb71c9
Remove workaround for 'time-monotonic' in Guile 2.2.2.
This is a followup to e688c2df39.

* build-aux/hydra/evaluate.scm <top level>: Remove 'time-monotonic'
definition.
* guix/cache.scm: Likewise.
* guix/progress.scm: Likewise.
* guix/scripts/substitute.scm: Likewise.
* guix/scripts/weather.scm: Likewise.
* tests/cache.scm: Likewise.
2020-03-22 16:49:47 +01:00
Ludovic Courtès 041b340da4
store: Add 'with-build-handler'.
* guix/store.scm (current-build-prompt): New variable.
(call-with-build-handler, invoke-build-handler): New procedures.
(with-build-handler): New macro.
* tests/store.scm ("with-build-handler"): New test.
2020-03-22 12:42:51 +01:00
Marius Bakke d19b14c834
Merge branch 'master' into core-updates 2020-03-21 22:16:02 +01:00
Ludovic Courtès 1dca6aaafa
inferior: '&inferior-exception' includes a stack trace.
* guix/inferior.scm (port->inferior): Bump protocol to (0 1 1).
(&inferior-exception)[stack]: New field.
(read-repl-response): Recognize 'exception' form for protocol (0 1 1).
* tests/inferior.scm ("&inferior-exception"): Check the value returned
by 'inferior-exception-stack'.
2020-03-19 15:14:08 +01:00
Ludovic Courtès 9d0c2c6e52
tests: Fix up reference to 'guile-2.2'.
This is a followup to b6bee63bed.

* tests/inferior.scm ("inferior-package-search-paths"): Refer to
'guile-3.0' instead of 'guile-2.2'.
2020-03-17 15:46:15 +01:00
Ludovic Courtès cf2ac04f13
gexp: Add 'with-parameters'.
* guix/gexp.scm (<parameterized>): New record type.
(with-parameters): New macro.
(compile-parameterized): New gexp compiler.
* tests/gexp.scm ("with-parameters for %current-system")
("with-parameters for %current-target-system")
("with-parameters + file-append"): New tests.
* doc/guix.texi (G-Expressions): Document it.
2020-03-12 18:32:15 +01:00
Ludovic Courtès f7537e30b8
inferior: Distinguish inferior exceptions.
This avoids ambiguities when looking at a backtrace where the exception
was actually thrown by an inferior in a very different context.

* guix/inferior.scm (&inferior-exception): New condition type.
(read-repl-response): Add optional 'inferior' parameter.  Raise
'&inferior-exception' instead of rethrowing to KEY when receiving an
'exception' message.
(read-inferior-response): Pass INFERIOR to 'read-repl-response'.
* tests/inferior.scm ("&inferior-exception"): New test.
2020-03-12 11:52:38 +01:00
Ludovic Courtès 7657e61d6b
import: pypi: Rewrite to use 'define-json-mapping'.
* guix/import/pypi.scm (non-empty-string-or-false): New procedure.
(<pypi-project>, <project-info>, <distribution>): New record types.
(pypi-fetch): Call 'json->pypi-project'.
(latest-source-release, latest-wheel-release): Use the new record
accessors instead of 'assoc-ref*'.
(pypi->guix-package, latest-release): Likewise.
* tests/pypi.scm (test-json): Add mandatory fields.
2020-03-12 11:52:37 +01:00
Mathieu Othacehe 9a2f99f42f
gexp: Default to current target.
* guix/gexp.scm (lower-object): Set target argument to 'current by default and
look for the current target system at bind time if needed,
(gexp->file): ditto,
(gexp->script): ditto,
(lower-gexp): make sure lowered extensions are not cross-compiled.

* tests/gexp.scm: Add cross-compilation test-cases for gexp->script and
gexp->file with a target passed explicitely and with a default target.
2020-03-08 20:28:31 +01:00
Ludovic Courtès 5a675b2c67
guix build: Allow non-package objects in manifest.
* guix/scripts/build.scm (options->things-to-build)[manifest->packages]:
Remove.
Inline map of 'manifest-entry-item'.
* tests/guix-build.sh: Add test for "guix build -m" with non-package object.
2020-03-05 16:33:37 +01:00
Ludovic Courtès 749b958206
swh: Adjust 'origin' test.
This is a followup to 3d2f29382d.

* tests/swh.scm (%origin): Remove "id".
("lookup-origin"): Remove use of 'origin-id'.
2020-02-27 23:29:30 +01:00
Ludovic Courtès fa99c4bbc7
ui: (size->number "1.M") is correctly parsed.
Reported by Pierre Neidhardt <mail@ambrevar.xyz>.

* guix/ui.scm (size->number)[unit-pos]: Add #\. to CHAR-SET:DIGIT.
* tests/ui.scm ("size->number, 1.M"): New test.
2020-02-23 12:47:13 +01:00
Marius Bakke 11415d3506
guix build: Add '--manifest' option.
* guix/scripts/build.scm (show-help): Document --manifest argument.
(options->things-to-build): When given a manifest, evaluate all the entries.
* tests/guix-build.sh: Add test for --manifest.
* doc/guix.texi (Additional Build Options): Mention --manifest.
* etc/completion/bash/guix: Complete file name if 'guix build' argument is
-m.
2020-02-14 17:49:26 +01:00
Ludovic Courtès 1deca767be
syscalls: Re-enable 'pivot-root' test.
Fixes <https://bugs.gnu.org/25476>.
Reported by Paul Garlick <pgarlick@tourbillion-technology.com>.

* tests/syscalls.scm ("pivot-root"): Skip only when
PERFORM-CONTAINER-TESTS? is true.  Rewrite to use a socket pair instead
of a pipe.  Synchronize parent and child so that the parent can
initialize the child's UID and GID mappings before continuing.
2020-02-11 12:33:35 +01:00
Ludovic Courtès c24fe4a520
import: gem: Deal with unavailable licensing info.
Fixes <https://bugs.gnu.org/39404>.
Reported by Seth <lee.seth@tuta.io>.

* guix/import/gem.scm (<gem>)[licenses]: Adjust for non-vector
licenses.
* tests/gem.scm (test-bar-json): Change "licenses" to 'null'.
("gem-recursive-import"): Adjust accordingly.
2020-02-05 16:18:58 +01:00
Ludovic Courtès 312df1d40c
tests: Adjust reverse-bag graph test to recent OCaml changes.
This is a followup to 87858bc526.

Partly fixes <https://bugs.gnu.org/39374>.
Reported by Ellen Papsch <ellen.papsch@wine-logistix.de>.

* tests/graph.scm ("reverse bag DAG"): Adjust test to latest OCaml
changes.
2020-02-05 16:18:58 +01:00
Maxim Cournoyer d3e439e355
gnu: Add earlyoom-service-type.
* gnu/services/linux.scm: New file.
* tests/services/linux.scm: Add test.
* Makefile.am (SCM_TESTS): Register test.
* doc/guix.texi (Linux Services): Add a new section and document the new
service and its configuration.
2020-01-31 23:37:13 -05:00
Ludovic Courtès 1bb30aa35b
guix system: Add workaround in test for Guile 3.0.0.
* tests/guix-system.sh: For the 'GRUB-config' test, add workaround for
the reported line number in Guile 3.0.0.
2020-01-17 17:12:44 +01:00
Ludovic Courtès 6f918d69b4
import: texlive: Avoid uses of '@@' in tests.
* guix/import/texlive.scm (fetch-sxml, sxml->package): Export.
* tests/texlive.scm <top level>: Call '%http-server-port'.
("fetch-sxml: returns SXML for valid XML"): Use 'with-http-server' and
set 'current-http-proxy' instead of using 'mock'.
("sxml->package"): Remove use of '@@'.
2020-01-17 14:22:08 +01:00
Ludovic Courtès 282f91790a
import: opam: Avoid uses of '@@' in tests.
* guix/import/opam.scm (string-pat, multiline-string, list-pat)
(dict, condition): Export.
(opam-fetch): Add optional 'repository' parameter.
(opam->guix-package): Add #:repository parameter and pass it to
'opam-fetch'.
* tests/opam.scm ("opam->guix-package"): Remove use of 'mock' and pass
TEST-REPO to 'opam->guix-package' instead.
("parse-strings", "parse-multiline-strings")
("parse-lists", "parse-dicts", "parse-conditions"): Remove uses of '@@',
which are no longer needed.
2020-01-17 14:22:07 +01:00
Ludovic Courtès fcb2318e51
lint: vulnerabilities: Avoid 'mock' in test.
* guix/lint.scm (check-vulnerabilities): Add 'package-vulnerabilities'
optional parameter.
* tests/lint.scm ("cve: one vulnerability"): Use it instead of 'mock'.
2020-01-17 14:22:07 +01:00
Ludovic Courtès 9d6c6cb20e
import: elpa: Rewrite test to use an HTTP server instead of mocking.
* guix/import/elpa.scm (elpa-url): Add 'gnu/http'.
(elpa->guix-package): Handle it.
* tests/elpa.scm (elpa-package-info-mock, auctex-readme-mock)
(elpa-version->string, package-source-url, ensure-list)
(package-home-page, make-elpa-package): Remove.
<top level>: Call '%http-server-port'.
(eval-test-with-elpa): Remove uses of 'mock'.  Use 'with-http-server'
and parameterize 'current-http-proxy' instead.
2020-01-16 23:14:05 +01:00
Ludovic Courtès cfd1ed8401
import: cran: Avoid uses of '@@' in the tests.
* guix/import/cran.scm (description->alist, description->package): Export.
<top level>: Set! 'listify'.
* tests/cran.scm (description-alist, "description->package"): Remove use
of '@@' to access the relevant bindings.
2020-01-16 23:14:05 +01:00
Ludovic Courtès 72c678af55
import: crate: Export 'string->license'.
* guix/import/crate.scm (string->license): Export.
* tests/crate.scm (string->license): Remove.
2020-01-16 23:14:05 +01:00
Ludovic Courtès 3597c0396b
lzlib: Define 'dictionary-size+match-length-limit'.
* guix/lzlib.scm (%compression-levels): Splice the rest of each element.
(dictionary-size+match-length-limit): New procedure.
(make-lzip-output-port, make-lzip-input-port/compressed): Use it.
* tests/lzlib.scm ("Bytevector of size relative to Lzip internal buffers (2 * dictionary)"):
Use 'dictionary-size+match-length-limit' instead of 'assoc-ref'.
2020-01-16 23:14:05 +01:00
Ludovic Courtès 47212fc763
records: Improve reporting of "invalid field specifier" errors.
Previously users would just see:

  error: invalid field specifier

without source location or hints.

* guix/records.scm (expand): Add optional 'parent-form' parameter and
pass it to 'syntax-violation' when it is true.
(make-syntactic-constructor): Pass S as a third argument to
'report-invalid-field-specifier'.
* guix/ui.scm (report-load-error): For 'syntax-error', show SUBFORM or
FORM in the message.
* tests/records.scm ("define-record-type* & wrong field specifier"): Add
a 'subform' parameter and adjust test accordingly.
("define-record-type* & wrong field specifier, identifier"): New test.
* tests/guix-system.sh: Add test.
2020-01-16 18:30:57 +01:00
Ludovic Courtès 84c5da08dd
guix package: Export 'transaction-upgrade-entry'.
* guix/scripts/package.scm (transaction-upgrade-entry): Add 'store'
parameter and use it instead of (%store).  Export.
* tests/packages.scm ("transaction-upgrade-entry, zero upgrades")
("transaction-upgrade-entry, one upgrade")
("transaction-upgrade-entry, superseded package"): Adjust accordingly.
2020-01-16 18:30:57 +01:00
Ludovic Courtès 4fe01b09ea
publish: Export 'signed-string'.
* guix/scripts/publish.scm (signed-string): Export and improve docstring.
* tests/publish.scm ("/*.narinfo")
("/*.narinfo with properly encoded '+' sign"): Adjust accordingly.
2020-01-16 18:30:57 +01:00
Pierre Neidhardt ee9a735bc8
graph: Add '--load-path' option.
* guix/scripts/graph.scm (%option): Add '--load-path' option.
* doc/guix.texi: Document it.
* tests/guix-graph.sh: Test it.
2020-01-16 15:27:20 +01:00
Ludovic Courtès 4aea90b187
import: cpan: Rewrite tests to use an HTTP server instead of mocking.
* guix/import/cpan.scm (%metacpan-base-url): New variable.
(module->dist-name, cpan-fetch): Refer to it instead of the hard-coded URL.
* tests/cpan.scm ("cpan->guix-package"): Use 'with-http-server' instead
of 'mock'.
2020-01-15 18:40:43 +01:00
Ludovic Courtès 69f132554c
import: cpan: Rewrite to use 'define-json-mapping'.
* guix/import/cpan.scm (<cpan-dependency>, <cpan-release>): New
JSON-mapped record types.
(metacpan-url->mirror-url): New procedure.
(cpan-source-url): Rewrite in terms of it.
(cpan-version): Remove.
(cpan-module->sexp): Rewrite to take a <cpan-release> instead of an
alist, and rename 'meta' to 'release'.
[convert-inputs]: Rewrite to use 'cpan-release-dependencies'.
Update calls to 'convert-inputs' to pass a list of symbols.
Replace 'assoc-ref' calls with the appropriate field accessors.
(cpan->guix-package): Rename 'module-meta' to 'release'.
(latest-release): Likewise, and use the appropriate accessors.
* tests/cpan.scm (test-json): Remove "prereqs" record; add "dependency"
list.
("source-url-http", "source-url-https"): Remove.
("metacpan-url->mirror-url, http")
("metacpan-url->mirror-url, https"): New tests.
2020-01-15 18:40:43 +01:00
Ludovic Courtès d63ee94d63
gexp: Add 'raw-derivation-file'.
* guix/gexp.scm (<raw-derivation-file>): New record type.
(raw-derivation-file-compiler): New gexp compiler.
* tests/gexp.scm ("lower-gexp, raw-derivation-file")
("raw-derivation-file"): New tests.
2020-01-04 23:44:26 +01:00
Ludovic Courtès 785af04a75
git: 'commit-difference' takes a list of excluded commits.
* guix/git.scm (commit-closure): Add 'visited' optional parameter.
(commit-difference): Add 'excluded' optional parameter; pass second
argument to 'commit-closure'.
* tests/git.scm ("commit-difference, excluded commits"): New test.
2019-12-27 13:52:49 +01:00
Ricardo Wurmus 3c45b53ec9
gnu: Remove squashfs-tools-next.
* gnu/packages/compression.scm (squashfs-tools-next): Remove variable.
* guix/scripts/pack.scm (squashfs-image, guix-pack): Use squashfs-tools.
* tests/pack.scm: Use squashfs-tools.
2019-12-26 12:29:44 +01:00
Marius Bakke ab7010af1f
gexp: Allow character literals in GEXP->SEXP.
Fixes <https://bugs.gnu.org/38628>.

* tests/gexp.scm ("lower-gexp, character literal"): New test.
* guix/gexp.scm (gexp->sexp)[self-quoting?]: Add CHAR? to the tested types.
* guix/repl.scm (self-quoting?): Likewise.
* gnu/tests.scm (marionette-shepherd-service)[self-quoting?]: Likewise.
2019-12-18 22:36:37 +01:00
Ludovic Courtès 828a39da68
challenge: Support "--diff=diffoscope".
* guix/scripts/challenge.scm (call-with-nar): New procedure.
(narinfo-contents): Express in terms of 'call-with-nar'.
(call-with-mismatches, report-differing-files/external): New
procedures.
(%diffoscope-command): New variable.
(%options): Support "diffoscope" and a string starting with "/".
* tests/challenge.scm (call-mismatch-test): New procedure.
("differing-files"): Rewrite in terms of 'call-mismatch-test'.
("call-with-mismatches"): New test.
* doc/guix.texi (Invoking guix challenge): Document it.
2019-12-12 17:56:58 +01:00
Ludovic Courtès 5208db3a52
challenge: Add "--diff".
* guix/scripts/challenge.scm (dump-port*): New variable.
(archive-contents, store-item-contents, narinfo-contents)
(differing-files, report-differing-files): New procedures.
(summarize-report): Add #:report-differences and call it.
(show-help, %options): Add "--diff".
(%default-options): Add 'difference-report' key.
(report-differing-files): Parameterize CURRENT-TERMINAL-COLUMNS and pass
 #:report-differences to 'summarize-report'.
* guix/tests/http.scm (%local-url): Add optional argument.
(call-with-http-server): Fix docstring typo.
* tests/challenge.scm (query-path-size, make-narinfo): New procedures.
("differing-files"): New test.
* doc/guix.texi (Invoking guix challenge): Document "--diff".
2019-12-12 17:56:58 +01:00
Ludovic Courtès 044277f610
guix archive: Add '--list'.
* guix/scripts/archive.scm (show-help, %options): Add '--list'.
(list-contents): New procedure.
(guix-archive): Honor the '--list' option.
* tests/guix-archive.sh: Test it.
* doc/guix.texi (Invoking guix archive): Document it.
2019-12-12 17:56:58 +01:00
Ludovic Courtès 12c1afcdbd
serialization: Add 'fold-archive'.
* guix/serialization.scm (read-contents): Remove.
(read-file-type, fold-archive): New procedures.
(restore-file): Rewrite in terms of 'fold-archive'.
* tests/nar.scm ("write-file-tree + fold-archive")
("write-file-tree + fold-archive, flat file"): New tests.
2019-12-12 17:56:57 +01:00
Brice Waegeneire 263a267b75
import: crate: Better handle license expressions.
* guix/import/crate.scm (%dual-license-rx): Removed function.
(crate->guix-package): Handle most of the multi-licensing cases.
* tests/crate.scm (licenses): Add tests for some licenses.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2019-12-11 12:13:03 +01:00
Brian Leung 4982de4c32
import: crate: Add recursive import test.
* tests/crate.scm (test-crate): Rename to...
(test-foo-crate): ... this.
(test-dependencies): Rename to...
(test-foo-dependencies): ... this.
(test-root-crate, test-root-dependencies, test-intermediate-1-crate)
(test-intermediate-1-dependencies, test-intermediate-2-crate)
(test-intermediate-2-dependencies, test-leaf-alice-crate)
(test-leaf-alice-dependencies, test-leaf-bob-crate)
(test-leaf-bob-dependencies): New variables.
("crate->guix-package"): Adjust accordingly.
("cargo-recursive-import"): New test.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2019-12-11 12:13:03 +01:00
Ludovic Courtès 70a8e13277
import: utils: 'recursive-import' returns a list rather than a stream.
* guix/import/utils.scm (recursive-import): Remove 'list->stream' call.
* guix/scripts/import/cran.scm (guix-import-cran): Remove 'stream->list'
call.
* guix/scripts/import/crate.scm (guix-import-crate): Likewise.
* guix/scripts/import/elpa.scm (guix-import-elpa): Likewise.
* guix/scripts/import/gem.scm (guix-import-gem): Likewise.
* guix/scripts/import/hackage.scm (guix-import-hackage): Likewise.
* guix/scripts/import/opam.scm (guix-import-opam): Likewise.
* guix/scripts/import/pypi.scm (guix-import-pypi): Likewise.
* guix/scripts/import/stackage.scm (guix-import-stackage): Likewise.
* tests/gem.scm ("gem-recursive-import"): Likewise.
* tests/import-utils.scm ("recursive-import"): Likewise.

Co-authored-by: Brian Leung <bkleung89@gmail.com>
2019-12-11 12:13:03 +01:00
Ludovic Courtès ddd5915900
import: utils: 'recursive-import' returns packages in topological order.
* guix/import/utils.scm (topological-sort): New procedure.
(recursive-import): Rewrite to use it.
* tests/import-utils.scm ("recursive-import"): New test.
* guix/import/cran.scm (cran->guix-package): Always return two values.
* guix/scripts/import/cran.scm (guix-import-cran): Remove 'reverse' call
on 'cran-recursive-import' result.
* guix/scripts/import/crate.scm (guix-import-crate): Likewise.
* guix/scripts/import/elpa.scm (guix-import-elpa): Likewise.
* guix/scripts/import/gem.scm (guix-import-gem): Likewise.
* guix/scripts/import/hackage.scm (guix-import-hackage): Likewise.
* guix/scripts/import/opam.scm (guix-import-opam): Likewise.
* guix/scripts/import/pypi.scm (guix-import-pypi): Likewise.
* guix/scripts/import/stackage.scm (guix-import-stackage): Likewise.
* tests/gem.scm ("gem-recursive-import"): Change the order of package
expressions accordingly.
2019-12-11 12:12:58 +01:00
Mathieu Othacehe 0b5ad0e756
tests: processes: Skip tests if running with binfmt.
* tests/processes.scm (binfmt-misc?): New procedure,
(test-assert*): new procedure that skips the test if binfmt-misc? returns
2019-12-10 10:49:42 +01:00
zimoun 7282f94967
lint: Add '--load-path' option.
* guix/scripts/lint.scm (%options): Add '--load-path' option.
* doc/guix.texi: Document it.
* tests/guix-lint.sh: Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-12-08 23:14:03 +01:00
Ludovic Courtès fcbe4f71ca
derivations: Add 'derivation-input-fold'.
* guix/derivations.scm (derivation-input-fold): New procedure.
(substitution-oracle)[closure]: Rewrite in terms of
'derivation-input-fold'.
* tests/derivations.scm ("derivation-input-fold"): New test.
2019-12-07 00:29:41 +01:00
Mathieu Othacehe 2c5dd47cef
tests: lzlib: Do not fail if lzlib in not available.
* tests/lzlib.scm: Use test-assert* for all test cases, so that there are no
failures if lzlib is unavailable.
2019-12-01 16:51:40 +01:00
Ludovic Courtès 99c45877a9
gexp: 'local-file' properly resolves non-literal relative file names.
* guix/gexp.scm (local-file): Distinguish the case where FILE is a
literal string and when it's not.  Add a clause for when FILE is not a
literal string.
* tests/gexp.scm ("local-file, non-literal relative file name"): New test.
* doc/guix.texi (G-Expressions): Update accordingly.
2019-11-30 23:50:40 +01:00
Ludovic Courtès dac7928d50
tests: Fix race condition in profile locking test.
Previously, there was a possibility that "guix install emacs" would grab
the lock before "guix package -m $module_dir/manifest.scm".  When that
happened, the test would start building Emacs and all its dependencies,
which could take a while and some disk space.

This is a followup to b1fb663404.

* tests/guix-package.sh: In profile locking test, emit
"$module_dir/ready" from the manifest and wait for it to exist before
running "guix install emacs".
2019-11-29 15:54:20 +01:00
Ludovic Courtès 434138e2f2
substitute: Make '%allow-unauthenticated-substitutes?' public.
* guix/scripts/substitute.scm (warn-about-missing-authentication): New
procedure.
(%allow-unauthenticated-substitutes?): Turn into a public parameter and
use 'warn-about-missing-authentication'.
(valid-narinfo?): Adjust accordingly.
* tests/substitute.scm (call-with-narinfo): Likewise.
2019-11-27 00:03:03 +01:00
Ludovic Courtès f5698dfb87
tests: Avoid unnecessary use of 'mock'.
* tests/build-utils.scm ("wrap-script, simple case"): Use the real
'which' instead of mocking it.
2019-11-26 00:16:35 +01:00
Ludovic Courtès 1d64afbdc0
tests: Avoid (catch 'srfi-34 …) form.
* tests/build-utils.scm ("wrap-script, raises condition"): Use 'guard'
instead of "catch 'srfi-34".
2019-11-26 00:16:35 +01:00
Ludovic Courtès fde60bfb84
tests: Use (ice-9 threads).
'call-with-new-thread' as a core binding is deprecated in 2.2 and
removed in 3.0.

* tests/publish.scm: Use (ice-9 threads).
2019-11-23 22:45:21 +01:00
Ludovic Courtès ca541f9ce6
pack: Allow multiple '--manifest' options.
* guix/scripts/pack.scm (guix-pack): Collect 'manifest' options, and
concatenate the resulting manifests.
* tests/guix-pack.sh: Test it.
* doc/guix.texi (Invoking guix pack): Document it.
2019-11-22 15:07:59 +01:00
Ludovic Courtès bf9206d8ed
package: Allow multiple '--manifest' options.
* guix/scripts/package.scm (manifest-action): Remove.
(%actions): Remove it.
(load-manifest): New procedure.
(process-actions): Handle 'manifest' options.  Define 'files' from
'manifest' options.  Define 'manifest' based on FILES.  Define 'trans'
to represent the final transaction.
* tests/guix-package.sh: Test it.
* doc/guix.texi (Invoking guix package): Mention
2019-11-22 15:07:58 +01:00
Ludovic Courtès ce30a0eb7e
profiles: Add 'concatenate-manifests'.
* guix/profiles.scm (concatenate-manifests): New procedure.
* tests/profiles.scm ("concatenate-manifests"): New test.
2019-11-22 15:07:58 +01:00
Ludovic Courtès d76df98fa5
environment: Document that '--manifest' can be repeated.
* tests/guix-environment.sh: Test 'guix environment' with two '-m' options.
* doc/guix.texi (Invoking guix environment): Explain that '-m' can be
passed multiple times.
2019-11-22 15:07:58 +01:00
Ludovic Courtès a2e661e95f
pack: Add "--derivation".
* guix/scripts/pack.scm (%options, show-help): Add "--derivation".
(guix-pack): Honor it.
* tests/guix-pack.sh: Test it.
* doc/guix.texi (Invoking guix pack): Document it.
2019-11-21 11:48:30 +01:00
Ludovic Courtès 9c9982dc0c
guix build: Handle "guix build /….drv" correctly for non-existent derivations.
This lets the daemon substitute missing derivations, as in the example
at <https://bugs.gnu.org/38226>, instead of failing with ENOENT.

* guix/scripts/build.scm (options->things-to-build): In the
'derivation-path?' case, don't fail when 'read-derivation-from-file'
raises to ENOENT; return the empty list in that case.
(guix-build): Add non-existent '.drv' files to ITEMS.
Pass ITEMS in addition to DRV to 'build-derivations'.
* tests/guix-build.sh: Add test.
2019-11-17 23:14:54 +01:00
Ludovic Courtès 16ac74033a
tests: Test "guix build /gnu/store/….drv".
* tests/guix-build.sh: Add test for passing "guix build" a .drv.
2019-11-17 23:14:54 +01:00
Julien Lepiller b1fb663404
guix: package: lock profiles when processing them.
* guix/scripts/package.scm (process-actions): Get a per-profile lock to
prevent concurrent actions on profiles.
* tests/guix-package.sh: Add test.
2019-11-08 21:52:53 +01:00
Ludovic Courtès 3e962e59d8
graph: Support package transformation options.
* guix/scripts/graph.scm (%options): Append %TRANSFORMATION-OPTIONS.
(show-help): Call 'show-transformation-options-help'.
(guix-graph): Call 'options->transformation' and use it.
* tests/guix-graph.sh: Add test.
* doc/guix.texi (Invoking guix graph): Document it.
2019-11-07 18:39:55 +01:00
Ludovic Courtès 537b2daba9
gnu: commencement: Ensure 'gnu-make-final' refers to the native 'pkg-config'.
Fixes <https://bugs.gnu.org/38093>.

When running:

  guix build --target=arm-linux-gnueabihf -e '(@ (gnu packages base) coreutils)'

the '%current-target-system' parameter is set by the time the top-level
of (gnu packages commencement) is evaluated.  Consequently, we need to
ensure that the 'pkg-config' macro evaluates in a context where
'%current-target-system' is unset.

* gnu/packages/commencement.scm (gnu-make-final): Refer to '%pkg-config'
instead of 'pkg-config'.
* tests/guix-build.sh: Add test.
2019-11-07 18:39:55 +01:00
Maxim Cournoyer 97bc3cbea5
services: ntp: Ensure no double quotes are output to config file.
* gnu/services/networking.scm (ntp-server->string): Use the textual
representation of the values as printed by 'display' rather than 'write', to
avoid inserting double quotes in the generated config.
* tests/networking.scm (%ntp-server-sample): Add a comment and make one of the
options a string, to exercise the fix.
("ntp-server->string"): Move the expected value to the first argument.
("ntp configuration servers deprecated form"): Likewise.
("openntpd generated config string ends with a newline"): Likewise.
2019-10-30 18:15:54 -04:00
Ludovic Courtès 74afaa37d5
cve: Rewrite to read the JSON feed instead of the XML feed.
The XML feed was discontinued on Oct. 16th, 2019:

  <https://nvd.nist.gov/General/News/XML-Vulnerability-Feed-Retirement-Phase-3>

* guix/cve.scm (string->date*): New procedure.
(<cve-item>, <cve>, <cve-reference>): New record types.
(cpe-match->cve-configuration, configuration-data->cve-configurations)
(json->cve-items, version-matches?): New procedures.
(yearly-feed-uri): Change URL to refer to JSON feed.
(cpe->product-alist, %parse-vulnerability-feed)
(xml->vulnerabilities): Remove.
(cve-configuration->package-list, merge-package-lists)
(cve-item->vulnerability, json->vulnerabilities): New procedures.
(write-cache): Use 'json->vulnerabilities' instead of
'xml->vulnerabilities', and remove 'parameterize'.
(vulnerabilities->lookup-proc): Use 'version-matches?' when VERSION is
true.
* tests/cve.scm (%sample): Use 'tests/cve-sample.json'.
(%expected-vulnerabilities): Rewrite accordingly.
("json->cve-items", "cve-item-published-date")
("json->vulnerabilities"): New tests.
("xml->vulnerabilities"): Remove.
("vulnerabilities->lookup-proc"): Adjust to new vulnerabilities.
* tests/cve-sample.json: New file.
* tests/cve-sample.xml: Remove.
* Makefile.am (EXTRA_DIST): Adjust accordingly.
* doc/guix.texi (Invoking guix lint): Update nist.gov URLs.
2019-10-23 16:40:17 +02:00
Ludovic Courtès 79c03e55e2
tests: Avoid now-deprecated 'make-struct'.
* tests/cve.scm (vulnerability): Use 'make-struct/no-tail' instead of
'make-struct', which is deprecated.
* tests/lint.scm ("cve: one vulnerability")
("cve: one patched vulnerability")
("cve: known safe from vulnerability")
("cve: vulnerability fixed in replacement version")
("cve: patched vulnerability in replacement"): Likewise.
2019-10-20 23:26:50 +02:00
Ludovic Courtès 81c580c866
daemon: Make 'profiles/per-user' non-world-writable.
Fixes <https://bugs.gnu.org/37744>.
Reported at <https://www.openwall.com/lists/oss-security/2019/10/09/4>.

Based on Nix commit 5a303093dcae1e5ce9212616ef18f2ca51020b0d
by Eelco Dolstra <edolstra@gmail.com>.

* nix/libstore/local-store.cc (LocalStore::LocalStore): Set 'perUserDir'
to #o755 instead of #o1777.
(LocalStore::createUser): New function.
* nix/libstore/local-store.hh (LocalStore): Add it.
* nix/libstore/store-api.hh (StoreAPI): Add it.
* nix/nix-daemon/nix-daemon.cc (performOp): In 'wopSetOptions', add
condition to handle "user-name" property and honor it.
(processConnection): Add 'userId' parameter.  Call 'store->createUser'
when userId is not -1.
* guix/profiles.scm (ensure-profile-directory): Note that this is now
handled by the daemon.
* guix/store.scm (current-user-name): New procedure.
(set-build-options): Add #:user-name parameter and pass it to the daemon.
* tests/guix-daemon.sh: Test the creation of 'profiles/per-user' when
listening on a TCP socket.
* tests/store.scm ("profiles/per-user exists and is not writable")
("profiles/per-user/$USER exists"): New tests.
2019-10-16 22:53:40 +02:00
Ludovic Courtès e464ac6672
tests: Skip container test when lacking kernel support.
This is a followup to 96b35998e6.

* tests/containers.scm ("eval/container, non-empty load path"): Add
missing 'skip-if-unsupported' call.
2019-10-15 10:21:41 +02:00
Ricardo Wurmus e08902d3cb
Merge branch 'master' into core-updates 2019-10-06 22:02:20 +02:00
Ludovic Courtès 5e5f716794
syscalls: Add 'add-to-entropy-count'.
* guix/build/syscalls.scm (RNDADDTOENTCNT): New variable.
(add-to-entropy-count): New procedure.
* tests/syscalls.scm ("add-to-entropy-count"): New test.
2019-10-05 22:05:02 +02:00
Ludovic Courtès 5a02f8e384
environment: '--container' honors '--preserve'.
* guix/scripts/environment.scm (launch-environment/container): Add
 #:white-list parameter and  honor it.
(guix-environment): Pass #:white-list to 'launch-environment/container'.
* tests/guix-environment-container.sh: Add test.
2019-10-03 23:48:59 +02:00
Marius Bakke e7f62a41b2
Merge branch 'master' into core-updates 2019-09-27 19:11:27 +02:00
Ludovic Courtès 3972dc5d43
guix package: Add '--list-profiles'.
* guix/scripts/package.scm (show-help, %options): Add '--list-profiles'.
(process-query): Honor it.
* tests/guix-package.sh: Add test.
2019-09-26 11:43:26 +02:00
Ludovic Courtès 11da634a6e
Merge branch 'master' into core-updates 2019-09-24 10:11:38 +02:00
Ludovic Courtès 24ab804ce1
gexp: Catch and report non-self-quoting gexp inputs.
Previously we would, for example, generate build scripts in the store;
when trying to run them, we'd get a 'read' error due to the presence
of #<foo> syntax in there.

* guix/gexp.scm (gexp->sexp)[self-quoting?]: New procedure.
[reference->sexp]: Check whether the argument in a <gexp-input> box is
self-quoting.  Raise a '&gexp-input-error' condition if it's not.
* tests/gexp.scm ("lower-gexp, non-self-quoting input"): New test.
2019-09-23 23:41:19 +02:00
Ludovic Courtès 9719e8d37a
channels: Allow news entries to refer to a tag.
Suggested by Ricardo Wurmus <rekado@elephly.net>.

* guix/channels.scm (<channel-news-entry>)[tag]: New field.
(sexp->channel-news-entry): Accept either 'commit' or 'tag' in 'entry'
forms.
(resolve-channel-news-entry-tag): New procedure.
(channel-news-for-commit): Move 'with-repository' form one level
higher.  Call 'resolve-channel-news-entry-tag' on all the news entries.
* guix/tests/git.scm (populate-git-repository): Add clause for 'tag'.
* tests/channels.scm ("channel-news, one entry"): Create a tag and add
an entry with a tag.  Check that the tag is resolved and also visible in
the <channel-news-entry> record.
* doc/guix.texi (Channels): Mention tags in news entries.
2019-09-23 10:38:44 +02:00
Ludovic Courtès 8ba7fd3cd6
channels: Add support for a news file.
* guix/channels.scm (<channel-metadata>)[news-file]: New field.
(read-channel-metadata): Set the 'news-file' field.
(read-channel-metadata-from-source): Likewise.
(<channel-news>, <channel-news-entry>): New record types.
(sexp->channel-news-entry, read-channel-news)
(channel-news-for-commit): New procedures.
* guix/tests/git.scm (populate-git-repository): For 'add', allow
CONTENTS to be a procedure.
* tests/channels.scm ("channel-news, no news")
("channel-news, one entry"): New tests.
* doc/guix.texi (Channels): Document it.
2019-09-23 10:38:44 +02:00
Ludovic Courtès 873f6f1334
git: Add 'commit-difference'.
* guix/git.scm (commit-closure, commit-difference): New procedures.
* guix/tests/git.scm, tests/git.scm: New files.
* Makefile.am (dist_noinst_DATA): Add guix/tests/git.scm.
(SCM_TESTS): Add tests/git.scm.
2019-09-23 10:38:43 +02:00
Ludovic Courtès 660dbe6564
guix package: '--show' ignores deprecated packages.
* guix/scripts/package.scm (process-query) <'show>: Remove superseded
packages.
* tests/guix-package-aliases.sh: Add test.
2019-09-21 16:48:36 +02:00
zimoun aeb51370da
guix package: Add 'guix show' alias.
* guix/scripts/show.scm: New file.
* Makefile.am (MODULES): Add it.
* po/guix/POTFILES.in: Add it.
* tests/guix-package-aliases.sh: Add test.
* doc/guix.texi (Invoking guix package): Document it and use it in a example.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-09-21 16:48:36 +02:00
Ludovic Courtès 7150743522
inferior: Propagate '&store-protocol-error' error conditions.
Until now '&store-protocol-error' conditions raised in the inferior
would not be correctly propagated because SRFI-35 records lack a read
syntax.

Reported at <https://bugs.gnu.org/37449>
by Carl Dong <contact@carldong.me>.

* guix/inferior.scm (port->inferior): Import (srfi srfi-34) in the inferior.
(inferior-eval-with-store): Define 'error?' and 'error-message'.  Wrap
call to PROC in 'guard'.  Check the response of INFERIOR for a
'store-protocol-error' or a 'result' tag.
* tests/inferior.scm ("inferior-eval-with-store, &store-protocol-error"):
New test.
2019-09-21 16:48:36 +02:00
zimoun d2cdef6560
ui: 'relevance' connects regexps with a logical and.
Fixes <https://bugs.gnu.org/36763>.
Previously, the logical and connecting the regexps did not output the expected
results (introduced in 8874faaaac).

* guix/ui.scm (relevance)
[score]: Change its arguments.
[regexp->score]: New procedure.
* tests/ui.scm ("package-relevance"): Add test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-09-19 23:24:04 +02:00
Ludovic Courtès 96b35998e6
linux-container: 'eval/container' correctly passes -L and -C flags.
This fixes a type error.

* gnu/system/linux-container.scm (eval/container): Use 'append-map', not
'map'.
* tests/containers.scm ("eval/container, non-empty load path"): New test.
2019-09-18 23:08:28 +02:00
Ludovic Courtès f9c0400392
guix package: "guix package -f FILE" ensures FILE returns a package.
* guix/scripts/package.scm (options->installable): Add clause for
'install option with a non-package object.
* tests/guix-package.sh: Add test.
2019-09-18 23:08:28 +02:00
Ludovic Courtès 9ff87bb996
Merge branch 'master' into core-updates 2019-09-17 16:27:15 +02:00
Maxim Cournoyer 2625abc6aa
services: openntpd: Add test for issue #3731.
See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37318.

* gnu/services/networking.scm (openntpd-configuration->string): New procedure,
extracted from top of the `openntpd-shepherd-service' to make it testable.
(openntpd-shepherd-service): Adapt following the move of the code to the above
procedure.
* tests/networking.scm: Add a test for the `openntpd-configuration->string'
procedure.
2019-09-08 23:15:32 +09:00
Maxim Cournoyer 5658ae8a0a
services: ntp: Support different NTP server types and options.
* gnu/services/networking.scm (ntp-server-types): New enum.
(<ntp-server>): New record type.
(ntp-server->string): New procedure.
(%ntp-servers): Define in terms of <htp-server> records.  Use the first
entrypoint server as a pool instead of a list of static servers.  This is more
resilient since a new server of the pool can be interrogated on every
request.  Add the 'iburst' options.
(ntp-configuration-servers): Define a custom accessor that warns but honors
the now deprecated server format.
(<ntp-configuration>): Use it.
(%openntpd-servers): New variable,
(<openntpd-configuration>): Use it, as a pool ('servers' field) instead of a
regular server.
* tests/networking.scm: New file.
* Makefile.am (SCM_TESTS): Register it.
* doc/guix.texi: Update documentation.
2019-09-08 23:15:31 +09:00
Julien Lepiller 1d03a9198d
tests: opam: Fix input type in import test.
* tests/opam.scm: Expect propagated-inputs instead of inputs.
2019-09-07 22:25:14 +02:00
Mark H Weaver 65542a8852
Merge branch 'master' into core-updates 2019-09-06 20:46:00 -04:00
Ludovic Courtès bc60349b5b
packages: 'supported-package?' binds '%current-system' for graph traversal.
Previously, (supported-package? coreutils "armhf-linux")
with (%current-system) = "x86_64-linux" would return false.  That's
because 'supported-package?' would traverse the x86_64 dependency graph,
which contains 'tcc-boot0', which supports x86 only.

Consequently, 'supported-package?' would match only 53 packages for
"armhf-linux" when running on x86, as is the case during continuous
integration.

* guix/packages.scm (package-transitive-supported-systems): Add an
optional 'system' parameter.  Use 'mlambda' instead of 'mlambdaq' for
memoization.
(supported-package?): Pass 'system' to 'package-transitive-supported-systems'.
* tests/packages.scm ("package-transitive-supported-systems, implicit inputs")
("package-transitive-supported-systems: reduced binary seed, implicit inputs"):
Remove calls to 'invalidate-memoization!', which no longer work and were
presumably introduced to work around the bug we're fixing (see commit
0db65c168f).
* tests/packages.scm ("supported-package?"): Rewrite test to use only
existing system name since otherwise 'bootstrap-executable' raises an
exception.
("supported-package? vs. system-dependent graph"): New test.
2019-09-06 14:41:58 +02:00
Ludovic Courtès 191668bc97
import: crate: Correct interpretation of dual-licensing strings.
* guix/import/crate.scm (%dual-license-rx): New variable.
(crate->guix-package)[string->license]: Rewrite to match it.
* tests/crate.scm (test-crate): Adjust "license" field to current
practice.
2019-09-04 13:02:27 +02:00
Ludovic Courtès 2791870d09
import: crate: Separate crates.io API from actual conversion.
This provides a clean separation between bindings to the
https://crates.io/api/v1 API and actual conversion to Guix package
sexps.

As a side-effect, it fixes things like "guix import blake2-rfc", "guix
refresh -t crates", etc.

* guix/import/crate.scm (<crate>, <crate-version>, <crate-dependency>):
New record types.
(lookup-crate, crate-version-dependencies): New procedures.
(crate-fetch): Remove.
(crate->guix-package): Rewrite to use the new API.
(latest-release): Likewise.
* guix/build-system/cargo.scm (%crate-base-url): New variable.
* tests/crate.scm (test-crate): Update accordingly.

fixlet
2019-09-04 13:02:27 +02:00
Ludovic Courtès 3c82f12541
tests: Adjust '--with-commit' test.
This is a followup to 4d04bc50d2.

* tests/guix-build-branch.sh: Expect "v0.1.0" to lead to
"guile-gcrypt-0.1.0".
2019-09-04 13:02:27 +02:00
Ludovic Courtès 55549c7b9b
lint: Add 'archival' checker.
* guix/lint.scm (check-archival): New procedure.
(%network-dependent-checkers): Add 'archival' checker.
* tests/lint.scm ("archival: missing content")
("archival: content available")
("archival: missing revision")
("archival: revision available")
("archival: rate limit reached"): New tests.
* doc/guix.texi (Invoking guix lint): Document it.
2019-09-02 15:25:01 +02:00
Ludovic Courtès ba1c1853a7
swh: Add hooks for rate limiting handling.
* guix/swh.scm (%allow-request?, %save-rate-limit-reset-time)
(%general-rate-limit-reset-time): New variables.
(request-rate-limit-reached?, update-rate-limit-reset-time!): New
procedures.
(call): Call '%allow-request?'.  Change 'swh-error' protocol to pass
METHOD in addition to URL.
* tests/swh.scm ("rate limit reached")
("%allow-request? and request-rate-limit-reached?"): New tests.
2019-09-02 15:25:01 +02:00
Ludovic Courtès 9323ab550f
tests: 'with-http-server' accepts multiple responses.
* guix/tests/http.scm (call-with-http-server): Replace 'code' and 'data'
parameters with 'responses+data'.  Compute RESPONSES as a function of
that.  Remove #:headers parameter.
[http-write]: Quit only when RESPONSES is empty.
[server-body]: Get the response and data from RESPONSES, and set it to
point to the rest.
(with-http-server): Adjust accordingly.
* tests/derivations.scm ("'download' built-in builder")
("'download' built-in builder, invalid hash")
("'download' built-in builder, not found")
("'download' built-in builder, check mode"): Adjust to new
'with-http-server' interface.
* tests/lint.scm ("home-page: 200")
("home-page: 200 but short length")
("home-page: 404", "home-page: 301, invalid"):
("home-page: 301 -> 200", "home-page: 301 -> 404")
("source: 200", "source: 200 but short length")
("source: 404", "source: 404 and 200")
("source: 301 -> 200", "source: 301 -> 404"):
("github-url", github-url): Likewise.
* tests/swh.scm (with-json-result)
("lookup-origin, not found"): Likewise.
2019-09-02 15:25:01 +02:00
Mark H Weaver 0481289cbc
Merge branch 'master' into core-updates 2019-08-29 17:19:18 -04:00
Ludovic Courtès dd4e46edda
accounts: Delete duplicate entries.
When adding multiple instances of a service requiring some user
account/group, we could end up with multiple entries for that account or
group in /etc/passwd or /etc/group.

* gnu/build/accounts.scm (database-writer)[write-entries]: Add call to
'delete-duplicates'.
* tests/accounts.scm ("write-passwd with duplicate entry"): New test.
2019-08-28 00:27:14 +02:00
Ludovic Courtès 7979a287f8
pack: Create /tmp in Docker images.
Fixes <https://bugs.gnu.org/37161>.

* guix/scripts/pack.scm (docker-image)[build]: Add a 'directory' entry
for "/tmp" to DIRECTIVES.
* tests/pack.scm ("docker-image + localstatedir"): Test the presence of /tmp.
* gnu/tests/docker.scm (run-docker-test)["Load docker image and run
it"]: Test the presence and permission bits of "/tmp".
2019-08-27 12:20:44 +02:00
Ludovic Courtès b908fcd8c0
pack: '-R' honors the requested output.
Fixes <https://bugs.gnu.org/36925>.
Reported by Jesse Gibbons <jgibbons2357@gmail.com>.

* guix/scripts/pack.scm (wrapped-package): Add 'output*' parameter.
[build]: Define 'input' and 'target'; use them instead of #$package and
 #$output, respectively.
(wrapped-manifest-entry): New procedure.
(map-manifest-entries): Call PROC directly.
(guix-pack): Pass WRAPPED-MANIFEST-ENTRY to 'map-manifest-entries'.
2019-08-23 18:41:49 +02:00
Mark H Weaver 893c2df00d
Merge branch 'master' into core-updates 2019-08-22 15:53:27 -04:00
Mark H Weaver d020821c0b
Revert "import: cpan: Adapt for the change to guile-json version 3."
This reverts commit 01ce7af25a.
2019-08-22 14:24:11 -04:00
Christopher Baines 01ce7af25a
import: cpan: Adapt for the change to guile-json version 3.
In guile-json version 3, JSON objects are represented as hash tables, rather
than alists.

* guix/import/cpan.scm (string->license): Change the match expression to match
on lists, rather than vectors.
(module->dist-name, cpan-source-url, cpan-version): Change assoc-ref to
hash-ref.
(cpan-module->sexp): Change assoc-ref to hash-ref, and assoc-ref* to
hash-ref*.
* tests/cpan.scm ("source-url-http", "source-url-https"): Convert the alist to
a hash table.
2019-08-21 18:29:30 +01:00
Ludovic Courtès 75a6f66815
tests: Move 'guix environment -C --no-cwd' test where it belongs.
This ensures that this test is skipped in contexts where user namespaces
are not supported, instead of failing.

This is a followup to commit b6dc08393e.

* tests/guix-environment.sh: Move '--container --no-cwd' test to...
* tests/guix-environment-container.sh: ... here.
2019-08-17 16:23:05 +02:00
Ludovic Courtès 37592014e1
tests: Relax expectations for the 'home-page' checker.
Fixes a regression introduced in
50fc2384fe.

* tests/lint.scm (warning-contains?): New procedure.
("home-page: host not found"): Use 'warning-contains?' instead of
testing for equality, as was the case before commit 50fc2384fe.
This handles the case where the 'getaddrinfo' error is not "Name or
service not known" but instead something like "System error" or
"Servname not supported for ai_socktype", as is the case in the build
environment.
2019-08-17 16:23:05 +02:00
Ludovic Courtès 268896444b
derivations: Delete duplicate inputs when computing derivation hash.
Fixes <https://bugs.gnu.org/36777>.
Reported by Carl Dong <contact@carldong.me>.

* guix/derivations.scm (derivation/masked-inputs): Call
'delete-duplicates' on INPUTS.
* tests/derivations.scm ("derivation with duplicate fixed-output inputs"):
New test.
2019-08-16 23:00:26 +02:00
Marius Bakke 6a2e54236e
Merge branch 'master' into core-updates 2019-07-31 14:28:56 +02:00
Ludovic Courtès 2e8cabb8d6
gexp: 'program-file' honors the current system and cross-compilation target.
Fixes <https://bugs.gnu.org/36813>.
Reported by Jakob L. Kreuze <zerodaysfordays.sdf.org@sdf.org>.

* guix/gexp.scm (program-file-compiler): Pass #:system and #:target to
'gexp->script'.
(load-path-expression): Add #:system and #:target and honor them.
(gexp->script): Likewise.
* tests/gexp.scm ("program-file #:system"): New test.
* doc/guix.texi (G-Expressions): Adjust accordingly.
2019-07-26 23:50:12 +02:00
Jakob L. Kreuze 5c793753b3
guix system: Add 'reconfigure' module.
* guix/scripts/system/reconfigure.scm: New file.
* Makefile.am (MODULES): Add it.
* guix/scripts/system.scm (bootloader-installer-script): Export variable.
* gnu/machine/ssh.scm (switch-to-system, upgrade-shepherd-services)
(install-bootloader): Delete variable.
* gnu/machine/ssh.scm (deploy-managed-host): Rewrite procedure.
* gnu/services/herd.scm (live-service): Export variable.
* gnu/services/herd.scm (live-service-canonical-name): New variable.
* tests/services.scm (live-service): Delete variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-07-26 19:19:49 +02:00
Ludovic Courtès 10a8c2bbc6
git: 'switch-to-ref' resolves tag targets.
* guix/git.scm (switch-to-ref): In the 'tag' case, resolve the target of
the tag.
* tests/guix-build-branch.sh: Adjust test accordingly.
2019-07-26 11:21:36 +02:00
Ludovic Courtès 177fecb57c
git: <git-checkout> allows tags in its 'commit' field.
Fixes <https://bugs.gnu.org/36371>.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>.

* guix/git.scm (git-checkout-compiler): Pass 'tag-or-commit' to
'latest-repository-commit*'.
* doc/guix.texi (Package Transformation Options): Update '--with-commit'
documentation accordingly.
* tests/guix-build-branch.sh: Add test.
2019-07-26 11:21:36 +02:00
Ludovic Courtès 81c3dc3224
maint: Switch to Guile-JSON 3.x.
Guile-JSON 3.x is incompatible with Guile-JSON 1.x, which we relied on
until now: it maps JSON dictionaries to alists (instead of hash tables),
and JSON arrays to vectors (instead of lists).  This commit is about
adjusting all the existing code to this new mapping.

* m4/guix.m4 (GUIX_CHECK_GUILE_JSON): New macro.
* configure.ac: Use it.
* doc/guix.texi (Requirements): Mention the Guile-JSON version.
* guix/git-download.scm (git-fetch)[guile-json]: Use GUILE-JSON-3.
* guix/import/cpan.scm (string->license): Expect vectors instead of
lists.
(module->dist-name): Use 'json-fetch' instead of 'json-fetch-alist'.
(cpan-fetch): Likewise.
* guix/import/crate.scm (crate-fetch): Likewise, and call 'vector->list'
for DEPS.
* guix/import/gem.scm (rubygems-fetch): Likewise.
* guix/import/json.scm (json-fetch-alist): Remove.
* guix/import/pypi.scm (pypi-fetch): Use 'json-fetch' instead of
'json-fetch-alist'.
(latest-source-release, latest-wheel-release): Call 'vector->list' on
RELEASES.
* guix/import/stackage.scm (stackage-lts-info-fetch): Use 'json-fetch'
instead of 'json-fetch-alist'.
(lts-package-version): Use 'vector->list'.
* guix/import/utils.scm (hash-table->alist): Remove.
(alist->package): Pass 'vector->list' on the inputs fields, and default
to the empty vector.
* guix/scripts/import/json.scm (guix-import-json): Remove call to
'hash-table->alist'.
* guix/swh.scm (define-json-reader): Expect pair? or null? instead of
hash-table?.
[extract-field]: Use 'assoc-ref' instead of 'hash-ref'.
(json->branches): Use 'map' instead of 'hash-map->list'.
(json->checksums): Likewise.
(json->directory-entries, origin-visits): Call 'vector->list' on the
result of 'json->scm'.
* tests/import-utils.scm ("alist->package with dependencies"): New test.
* gnu/installer.scm (build-compiled-file)[builder]: Use GUILE-JSON-3.
* gnu/installer.scm (installer-program)[installer-builder]: Likewise.
* gnu/installer/locale.scm (iso639->iso639-languages): Use 'assoc-ref'
instead of 'hash-ref', and pass vectors through 'vector->list'.
(iso3166->iso3166-territories): Likewise.
* gnu/system/vm.scm (system-docker-image)[build]: Use GUILE-JSON-3.
* guix/docker.scm (manifest, config): Adjust for Guile-JSON 3.
* guix/scripts/pack.scm (docker-image)[build]: Use GUILE-JSON-3.
* guix/import/github.scm (fetch-releases-or-tags): Update docstring.
(latest-released-version): Use 'assoc-ref' instead of 'hash-ref'.  Pass
the result of 'fetch-releases-or-tags' to 'vector->list'.
* guix/import/launchpad.scm (latest-released-version): Likewise.
2019-07-25 00:16:41 +02:00
Marius Bakke ccad0e4d69
Merge branch 'master' into core-updates 2019-07-22 18:58:48 +02:00
Ludovic Courtès 96f1cbeff8
swh: Add basic tests.
* guix/swh.scm (%swh-base-url): Turn into a parameter and export it.
* tests/swh.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
2019-07-22 11:53:39 +02:00
Ludovic Courtès 99b2042812
lint: Add test for 'source'.
* tests/lint.scm ("source: 404 and 200"): New test.
2019-07-20 01:32:17 +02:00
Ludovic Courtès 571f6e7f4f
lint: Update tests to (guix lint) migration.
This is a followup to f363c836e0.

* tests/lint.scm ("cve")
("cve: one vulnerability")
("cve: one patched vulnerability")
("cve: known safe from vulnerability")
("cve: vulnerability fixed in replacement version")
("cve: patched vulnerability in replacement"): Refer to
'package-vulnerabilities' from (guix lint), not (guix scripts lint).
2019-07-20 01:32:17 +02:00
Ludovic Courtès 723bdb8ef0
ui: 'warn-about-load-error' provides hints for unbound variables.
* guix/ui.scm (warn-about-load-error): Add 'unbound-variable' clause.
* tests/guix-build.sh: Add test.
2019-07-20 01:32:17 +02:00
Ludovic Courtès a2a94b6e58
ui: 'warn-about-load-error' warns about file/module name mismatches.
* guix/discovery.scm (scheme-modules): Rename the inner 'file' to
'relative'.  Pass FILE as an addition argument to WARN.
* guix/ui.scm (warn-about-load-error): Add 'module' argument (actually,
what was called 'file' really contained a module name.)  Call
'check-module-matches-file' in the catch-all error case.
(check-module-matches-file): New procedure.
* tests/guix-build.sh: Test it.
2019-07-20 01:32:17 +02:00
Ludovic Courtès ce5d9ec875
channels: Always provide a <channel-metadata> record.
This simplifies the code since one no longer needs to think about
whether '.guix-channel' was present.

* guix/channels.scm (read-channel-metadata): Always pass a string as the
first argument to 'channel-metadata'.
(read-channel-metadata-from-source): Always return a <channel-metadata>
record.
(channel-instance-dependencies): Remove now unneeded 'match'.
(standard-module-derivation): Assume DIRECTORY is never #f and contains
a leading slash.
* tests/channels.scm (channel-metadata-directory)
(channel-metadata-dependencies): New procedures.
("channel-instance-metadata returns #f if .guix-channel does not
exist"): Remove.
("channel-instance-metadata returns default if .guix-channel does not
exist"): New test.
(make-instance): Use 'write' instead of 'display' when creating
'.guix-channel'.
(instance--no-deps): Remove dependencies.
(instance--sub-directory): New variable.
("channel-instance-metadata and default dependencies")
("channel-instance-metadata and directory"): New tests.
("latest-channel-instances excludes duplicate channel dependencies"):
Expect 'channel-commit' to return a string and adjust accordingly.
2019-07-19 11:53:47 +02:00
Ludovic Courtès 45b903323e
channels: Strictly check the version of '.guix-channel'.
Until now the 'version' field in '.guix-channel' could be omitted, or it
could be any value.

* guix/channels.scm (read-channel-metadata): Rename to...
(channel-instance-metadata): ... this.
(channel-instance-dependencies): Adjust accordingly.
(read-channel-metadata): New procedure.  Use 'match'
to require a 'version' field.  Provide proper error handling when the
channel sexp is malformed or when given an unsupported version number.
(read-channel-metadata-from-source): Use 'catch' and
'system-error-errno' instead of 'file-exists?'.
* tests/channels.scm (instance--unsupported-version): New variable.
(read-channel-metadata): Rename to...
(channel-instance-metadata): ... this.  Rename tests accordingly.
("channel-instance-metadata rejects unsupported version"): New test.
2019-07-19 11:53:47 +02:00
Ludovic Courtès bacfec8611
linux-container: Add 'eval/container'.
* gnu/system/linux-container.scm (eval/container): New procedure.
* tests/containers.scm ("eval/container, exit status")
("eval/container, writable user mapping"): New tests.
2019-07-19 11:53:47 +02:00
Ludovic Courtès 64de896a71
Merge branch 'master' into core-updates 2019-07-17 15:51:10 +02:00
Christopher Baines f363c836e0
lint: Move the linting code to a different module.
To try and move towards making programatic access to the linting code easier,
this commit separates out the linting script, from the linting functionality
that it uses.

* guix/scripts/lint.scm (emit-warnings): Alter to to not use match-lambda, as
<lint-warning> isn't accessible.
(<lint-warning>, lint-warning, make-lint-warning, lint-warning?,
lint-warning-message, lint-warning-message-text, lint-warning-message-data,
lint-warning-location, package-file, %make-warning make-warning,
<lint-checker>, lint-checker, make-lint-checker, lint-checker?,
lint-checker-name, lint-checker-description, lint-checker-check,
properly-starts-sentance?, starts-with-abbreviation?, %quoted-identifier-rx,
check-description-style, package-input-intersection,
check-inputs-should-be-native, check-inputs-should-not-be-an-input-at-all,
package-name-regexp, check-synopsis-style, probe-uri,
tls-certificate-error-string, validate-uri, check-home-page,
%distro-directory, check-patch-file-names, escape-quotes,
official-gnu-packages*, check-gnu-synopsis+description, origin-uris,
check-source, check-source-file-name, check-source-unstable-tarball,
check-mirror-url, check-github-url, check-derivation, check-license,
call-with-networking-fail-safe, with-networking-fail-safe,
current-vulnerabilities*, package-vulnerabilities, check-vulnerabilities,
check-for-updates, report-tabulations, report-trailing-white-space,
report-long-line, %hanging-paren-rx, report-lone-parantheses,
%formatting-reporters, report-formatting-issues, check-formatting, %checkers):
Move to…
* guix/lint.scm: … here
* po/guix/POTFILES.in: Add guix/lint.scm.
* Makefile.am: Add guix/lint.scm.
* tests/lint.scm: Change to import (guix lint), rather than (guix scripts lint).
2019-07-15 22:32:19 +01:00
Christopher Baines 50fc2384fe
scripts: lint: Handle warnings with a record type.
Rather than emiting warnings directly to a port, have the checkers return the
warning or warnings.

This makes it easier to use the warnings in different ways, for example,
loading the data in to a database, as you can work with the <lint-warning>
records directly, rather than having to parse the output to determine the
package and location.

* guix/scripts/lint.scm (<lint-warning>): New record type.
(lint-warning): New macro.
(lint-warning?, lint-warning-package, lint-warning-message,
lint-warning-location, package-file, make-warning): New procedures.
(call-with-accumulated-warnings, with-accumulated-warnings): Remove.
(emit-warning): Rename to emit-warnings, and switch to displaying multiple
warnings.
(check-description-style)[check-not-empty-description, check-texinfo-markup,
check-trademarks, check-quotes, check-proper-start,
check-end-of-sentence-space]: Switch to generating a list of warnings, and
using make-warning, rather than emit-warning.
(check-inputs-should-be-native, check-inputs-should-not-be-an-input-at-all):
Switch to generating a list of warnings, and using make-warning, rather than
emit-warning.
(check-synopsis): Switch to generating a list of warnings, and using
make-warning, rather than emit-warning.
[check-not-empty]: Remove, this is handled in the match clause
to avoid other warnings being emitted.
[check-final-period, check-start-article, check-synopsis-length,
check-proper-start, check-start-with-package-name, check-texinfo-markup]:
Switch to generating a list of warnings, and using make-warning, rather than
emit-warning.
[checks]: Remove check-not-empty.
(validate-uri, check-home-page, check-patch-file-names,
check-gnu-synopsis+description): Switch to generating a list of warnings, and
using make-warning, rather than emit-warning.
(check-source): Switch to generating a list of warnings, and using
make-warning, rather than emit-warning.
[try-uris]: Remove.
[warnings-for-uris]: New procedure, replacing try-uris.
(check-source-file-name, check-source-unstable-tarball, check-mirror-url,
check-github-url, check-derivation, check-vulnerabilities, check-for-updates,
report-tabulations, report-trailing-white-space, report-long-line,
report-lone-parentheses, report-formatting-issues, check-formatting): Switch
to generating a list of warnings, and using make-warning, rather than
emit-warning.
(run-checkers): Call emit-warnings on the warnings returned from the checker.
* tests/lint.scm (string-match-or-error, single-lint-warning-message): New
procedures.
(call-with-warnings, with-warnings): Remove.
("description: not a string", "description: not empty", "description: invalid
Texinfo markup", "description: does not start with an upper-case letter",
"description: may start with a digit", "description: may start with lower-case
package name", "description: two spaces after end of sentence", "description:
end-of-sentence detection with abbreviations", "description: may not contain
trademark signs: ™", "description: may not contain trademark signs: ®",
"description: suggest ornament instead of quotes", "synopsis: not a string",
"synopsis: not empty", "synopsis: valid Texinfo markup", "synopsis: does not
start with an upper-case letter", "synopsis: may start with a digit",
"synopsis: ends with a period", "synopsis: ends with 'etc.'", "synopsis:
starts with 'A'", "synopsis: starts with 'a'", "synopsis: starts with 'an'",
"synopsis: too long", "synopsis: start with package name", "synopsis: start
with package name prefix", "synopsis: start with abbreviation", "inputs:
pkg-config is probably a native input", "inputs: glib:bin is probably a native
input", "inputs: python-setuptools should not be an input at all (input)",
"inputs: python-setuptools should not be an input at all (native-input)",
"inputs: python-setuptools should not be an input at all (propagated-input)",
"patches: file names", "patches: file name too long", "patches: not found",
"derivation: invalid arguments", "license: invalid license", "home-page: wrong
home-page", "home-page: invalid URI", "home-page: host not found", "home-page:
Connection refused", "home-page: 200", "home-page: 200 but short length",
"home-page: 404", "home-page: 301, invalid", "home-page: 301 -> 200",
"home-page: 301 -> 404", "source-file-name", "source-file-name: v prefix",
"source-file-name: bad checkout", "source-file-name: good checkout",
"source-file-name: valid", "source-unstable-tarball",
"source-unstable-tarball: source #f", "source-unstable-tarball: valid",
"source-unstable-tarball: package named archive", "source-unstable-tarball:
not-github", "source-unstable-tarball: git-fetch", "source: 200", "source: 200
but short length", "source: 404", "source: 301 -> 200", "source: 301 -> 404",
"mirror-url", "mirror-url: one suggestion", "github-url", "github-url: one
suggestion", "github-url: already the correct github url", "cve", "cve: one
vulnerability", "cve: one patched vulnerability", "cve: known safe from
vulnerability", "cve: vulnerability fixed in replacement version", "cve:
patched vulnerability in replacement", "formatting: lonely parentheses",
"formatting: alright"): Change test-assert to test-equal, and adjust to work
with the changes above.
("formatting: tabulation", "formatting: trailing white space", "formatting:
long line"): Use string-match-or-error rather than string-contains.
2019-07-15 22:32:18 +01:00
Ludovic Courtès b9373e2627
gexp: 'lowered-gexp-guile' now returns a <derivation-input>.
* guix/derivations.scm (derivation-input-output-path): New procedure.
* guix/gexp.scm (lower-gexp): Wrap GUILE in a <derivation-input>.
(gexp->derivation): Adjust accordingly.
* guix/remote.scm (remote-pipe-for-gexp, remote-eval): Adjust
accordingly.
* tests/gexp.scm ("lower-gexp"): Adjust accordingly.
2019-07-15 10:01:05 +02:00
Ludovic Courtès 9e64302d68
derivations: Update tests to use new calling convention.
* tests/derivations.scm ("build derivation with 1 source"): Adjust to
new 'derivation' calling convention.
("identical files are deduplicated"): Likewise.
("fixed-output-derivation?"): Likewise.
("fixed-output derivation"): Likewise.
("fixed-output derivation, recursive"): Likewise.
("derivation with a fixed-output input"): Likewise.
("multiple-output derivation"): Likewise.
("multiple-output derivation, non-alphabetic order"): Likewise.
("read-derivation vs. derivation"): Likewise.
("user of multiple-output derivation"): Likewise.
("derivation with #:references-graphs"): Likewise.
("derivation #:allowed-references, ok"): Likewise.
("derivation #:allowed-references, not allowed"): Likewise.
("derivation #:allowed-references, self allowed"): Likewise.
("derivation #:allowed-references, self not allowed"): Likewise.
("derivation #:disallowed-references, ok"): Likewise.
("derivation #:disallowed-references, not ok"): Likewise.
("derivation #:leaked-env-vars"): Likewise.
("build derivation with coreutils"): Likewise.
("map-derivation, sources"): Likewise.
("derivation with local file as input"): Remove.
2019-07-15 10:01:05 +02:00
Ludovic Courtès 3868577480
gexp: <lowered-gexp> separates sources from derivation inputs.
* guix/gexp.scm (lower-inputs): Return either <derivation-input> records
or store items.
(lower-reference-graphs): Return file/input pairs.
(<lowered-gexp>)[sources]: New field.
(lower-gexp): Adjust accordingly.
(gexp->input-tuple): Remove.
(gexp->derivation)[graphs-file-names]: Handle only the
'derivation-input?' and 'string?' cases.
Pass #:sources to 'raw-derivation'; ensure #:inputs contains only
<derivation-input> records.
* guix/remote.scm (remote-eval): Adjust to the new <lowered-gexp>
interface.
* tests/gexp.scm ("lower-gexp"): Adjust to expect <derivation-input>
records instead of <gexp-input>
2019-07-15 10:01:05 +02:00
Marius Bakke fb9a23a3f3
Merge branch 'master' into core-updates
Conflicts:
	gnu/local.mk
	gnu/packages/python-xyz.scm
	gnu/packages/xml.scm
	guix/gexp.scm
	po/guix/POTFILES.in
2019-07-12 01:03:53 +02:00
Carl Dong b6dc08393e
scripts: environment: Add --no-cwd.
* doc/guix.texi (Invoking guix environment): Add --no-cwd.
* guix/scripts/environment.scm (show-help, %options): Add --no-cwd.
(launch-environment/container): Add 'map-cwd?' param; only add mapping
for cwd if #t.  Only change to cwd within container if #t, otherwise
home.
(guix-environment): Error if --no-cwd without --container.  Provide
'(not no-cwd?)' to launch-environment/container as 'map-cwd?'.
* tests/guix-environment.sh: Add test for no-cwd.

Co-authored-by: Mike Gerwitz <mtg@gnu.org>
2019-07-08 10:33:20 -04:00
Ludovic Courtès b1510fd8d2
derivations: 'derivation-build-plan' recurses on substituables.
This fixes a bug whereby "guix build texlive -n" would report:

  0.0 MB would be downloaded:
     /gnu/store/…-texlive-20180414

instead of:

  The following derivation would be built:
     /gnu/store/…-texlive-texmf-20180414.drv
  2,595.2 MB would be downloaded:
     /gnu/store/…-texlive-20180414-texmf.tar.xz
     /gnu/store/…-texlive-20180414

where 'texlive-texmf' is a non-substitutable dependency of 'texlive'.

* guix/derivations.scm (dependencies-of-substitutables): New procedure.
(derivation-build-plan): When 'input-substitutable-info' returns true,
append the subset of DEPS that corresponds to SUBSTITUABLES to the first
argument of 'loop'.
* guix/ui.scm (show-what-to-build): Remove half-baked traversal of
DOWNLOAD.
* tests/derivations.scm ("derivation-build-plan and substitutes,
non-substitutable dep"): New test.
2019-07-05 00:51:17 +02:00
Ludovic Courtès 2ca41030d5
gexp: Add 'lower-gexp' and express 'gexp->derivation' in terms of it.
* guix/gexp.scm (gexp-input-thing, gexp-input-output)
(gexp-input-native?): Export.
(lower-inputs): Return <gexp-input> records instead of tuples.
(lower-reference-graphs): Adjust accordingly.
(<lowered-gexp>): New record type.
(lower-gexp, gexp-input->tuple): New procedure.
(gexp->derivation)[%modules]: Remove.
[requested-graft?]: New variable.
[add-modules]: New procedure.
Rewrite in terms of 'lower-gexp'.
(gexp-inputs): Add TODO comment.
* tests/gexp.scm ("lower-gexp"): New test.
2019-07-04 18:05:02 +02:00
Marius Bakke 4fb9165515
Merge branch 'staging' into core-updates 2019-07-02 20:18:16 +02:00
Maxim Cournoyer d514276b93
import: pypi: Include optional test inputs as native-inputs.
* guix/import/pypi.scm (maybe-inputs): Add INPUT-TYPE argument, and use it.
(test-section?): New predicate.
(parse-requires.txt): Collect the optional test inputs, and return them as the
second element of the returned list.
(parse-wheel-metadata): Likewise.
(guess-requirements): Adapt.
(make-pypi-sexp): Likewise, and include the test inputs requirements as native
inputs in the returned package expression.

* tests/pypi.scm (test-requires.txt): Include a test section in the
test-requires.txt data.
(test-requires.txt-beaker): New variable.
("parse-requires.txt"): Adapt.
("parse-requires.txt - Beaker"): New test.
("parse-wheel-metadata, with extras"): Adapt.
("parse-wheel-metadata, with extras - Jedi"): Adapt.
("pypi->guix-package, no wheel"): Re-indent, and add the expected
native-inputs.
("pypi->guix-package, wheels"): Likewise.
2019-07-02 10:08:00 +09:00
Maxim Cournoyer f0190a5dcd
import: pypi: Parse wheel METADATA instead of metadata.json.
With newer Wheel releases, there is no more metadata.json file; the METADATA
file should be used instead (see: https://github.com/pypa/wheel/issues/195).

This change updates our PyPI importer so that it uses the latter.

* guix/import/pypi.scm (define-module): Remove unnecessary modules and export
the PARSE-WHEEL-METADATA procedure.
(parse-wheel-metadata): Add procedure.
(guess-requirements): Use it.
* tests/pypi.scm (test-metadata): Test it.
2019-07-02 10:08:00 +09:00
Maxim Cournoyer c799ad7276
import: pypi: Support more types of archives.
This change enables the PyPI importer to look for requirements in a source
archive of a different type than "tar.gz" or "tar.bz2".  Also, scan the source
archive to find a requires.txt file.

* guix/import/pypi.scm: (guess-requirements)[tarball-directory]: Remove procedure.
[guess-requirements-from-source]: Use COMRESSED-FILE? to determine if an
archive type is supported, and some file extension logic that chooses either
"tar" or "unzip" as the extractor.  Search for the requires.txt file in the
archive instead of using a static, expected location.
(guess-requirements): Rename the TARBALL argument to ARCHIVE, to denote the
archive format is no longer bound specifically to the Tar format.
(compute-inputs): Likewise.
* tests/pypi.scm ("pypi->guix-package, no wheel"): Mock the requires.txt at a
non-standard location.
("pypi->guix-package, no usable requirement file."): New test.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer 803fb336d6
import: pypi: Improve parsing of requirement specifications.
The previous solution was fragile and could leave unwanted characters in a
requirement name, such as '[' or ']'.

Partially fixes <https://bugs.gnu.org/33047>.

* guix/import/pypi.scm (use-modules): Export SPECIFICATION->REQUIREMENT-NAME
(%requirement-name-regexp): New variable.
(clean-requirement): Rename to...
(specification->requirement-name): this, which now uses
%requirement-name-regexp to select the requirement name from the requirement
specification.
(parse-requires.txt): Adapt.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer c4797121be
import: pypi: Do not parse optional requirements from source.
* guix/import/pypi.scm: Export PARSE-REQUIRES.TXT.
(clean-requirement): Move procedure to the top level.
(guess-requirements): Move the READ-REQUIREMENTS procedure to the top level,
and rename it to PARSE-REQUIRES.TXT.  Move the CLEAN-REQUIREMENT procedure to
the top level.  Move the COMMENT? functions inside the PARSE-REQUIRES.TXT
procedure.
(parse-requires.txt): Add a SECTION-HEADER? predicate, and use it to prevent
parsing optional requirements.

* tests/pypi.scm (test-requires-with-sections): New variable.
("parse-requires.txt, with sections"): New test.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer a853acebe1
tests: pypi: Mute the output of tar.
The output of tar when creating archives for the purpose of tests is not
useful, so we mute it.

* tests/pypi.scm ("pypi->guix-package"): Mute the output of tar.
("pypi->guix-package, wheels"): Likewise.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer 01589acc5e
import: pypi: Do not consider requirements.txt files.
PyPI packages are mandated to have a setup.py file, which contains a listing
of the required dependencies.  The setuptools/distutils machinery embed
metadata in the archives they produce, which contains this information. There
is no need nor gain to collect the requirements from a "requirements.txt"
file, as it is not the true record of dependencies for PyPI packages and may
contain extraneous requirements or not exist at all.

* guix/import/pypi.scm (guess-requirements): Update comment.
[guess-requirements-from-source]: Do not attempt to parse the file
requirements.txt.  Streamline logic.
* tests/pypi.scm (test-requires.txt): Rename from test-requirements, to hint
at the file being tested.
("pypi->guix-package"): Adapt so that the fake package contains a requires.txt
file rather than a requirements.txt file.
("pypi->guix-package, wheels"): Likewise.
2019-07-02 10:07:59 +09:00
Ivan Petkov 022288ba53
guix: import: crate: fix redundant inputs list nesting
* guix/import/crate.scm (maybe-cargo-inputs): Remove one level of lists.
* guix/import/crate.scm (maybe-cargo-development-inputs): Same.
* tests/crate.scm: (crate->guix-package)[package]<#:arguments>: Remove
one level of list nesting.
2019-06-30 09:01:27 -07:00
Ludovic Courtès 5cc1075a76
Merge branch 'master' into core-updates 2019-06-27 23:33:48 +02:00
Ludovic Courtès c30d117822
tests: Avoid TCP port collision between lint.scm and guix-daemon.sh.
This could lead to random deadlocks in one of these two tests when
running "make check -j5".

* tests/guix-daemon.sh (tcp_socket): Change port to 9998 to avoid
collision with tests/lint.scm.
2019-06-27 11:14:42 +02:00
Ludovic Courtès 066eeae1a1
packages: 'specification->package+output' distinguishes "no output specified".
Until now the caller couldn't tell the different between a spec like
"foo:out" and one like "foo".  This change allows users to distinguish
between these two cases.

* gnu/packages.scm (specification->package+output): Disable output
membership test when OUTPUT = #f and SUB-DRV = #f.
* tests/packages.scm ("specification->package+output")
("specification->package+output invalid output")
("specification->package+output no default output")
("specification->package+output invalid output, no default"): New tests.
2019-06-27 11:14:41 +02:00
Ludovic Courtès 7c690a4738
derivations: 'build-derivations' can be passed derivation inputs.
* guix/derivations.scm (build-derivations): Accept <derivation-input>
records among DERIVATIONS.
* tests/derivations.scm ("build-derivations with specific output"): Test
it.
2019-06-27 11:14:41 +02:00
Ludovic Courtès 5cf4b26d52
derivations: <derivation-input> now aggregates a <derivation>.
Consequently, the whole graph of <derivation> object is readily
available without having to go through 'read-derivation-from-file',
which could have cache misses if the requested <derivation> object had
been GC'd in the meantime.  This is an important property for the
performance of things like 'derivation-build-plan' that traverse the
derivation graph.

* guix/derivations.scm (<derivation-input>): Replace 'path' field by
'derivation'.
(derivation-input-path): Adjust accordingly.
(derivation-input-key): New procedure.
(derivation-input-output-paths): Adjust accordingly.
(coalesce-duplicate-inputs): Likewise.
(derivation-prerequisites): Use 'derivation-input-key' to compute keys
for INPUT-SET.
(derivation-build-plan): Likewise.
(read-derivation): Add optional 'read-derivation-from-file' parameter.
[make-input-drvs]: Call it.
(write-derivation)[write-input]: Adjust to new <derivation-input>.
(derivation/masked-inputs): Likewise, and remove redundant
'coalesce-duplicate-inputs' call.
(derivation)[input->derivation-input]: Change to consider only the
derivation case.  Update call to 'make-derivation-input'.
[input->source]: New procedure.
Separate sources from inputs.
(map-derivation): Adjust to new <derivation-input>.
* tests/derivations.scm ("parse & export"): Pass a second argument to
'read-derivation'.
("build-expression->derivation and derivation-prerequisites")
("derivation-prerequisites and valid-derivation-input?"): Adjust to new
<derivation-input>.
2019-06-27 11:14:41 +02:00
Ludovic Courtès ba04f80e2e
derivations: Rewrite and replace 'derivations-prerequisites-to-build'.
The new 'derivation-build-plan' procedure has a more appropriate
signature: it takes a list of <derivation-inputs> instead of taking one
<derivation>.  Its body is also much simpler.

* guix/derivations.scm (derivation-build-plan): New procedure.
(derivation-prerequisites-to-build): Express in terms of
'derivation-build-plan' and mark as deprecated.
* tests/derivations.scm: Change 'derivation-prerequisites-to-build'
tests to 'derivation-build-plan' and adjust accordingly.
2019-06-27 11:14:41 +02:00
Ludovic Courtès c89985d91d
derivations: Add 'derivation-input'.
* guix/derivations.scm (derivation-input): New procedure.
* tests/grafts.scm (make-derivation-input): Remove.
("graft-derivation, unused outputs not depended on"): Use
'derivation-input'.
2019-06-27 11:14:41 +02:00
Ludovic Courtès 4593f5a654
syscalls: Add 'terminal-rows'.
* guix/build/syscalls.scm (terminal-dimension): New procedure.
(terminal-columns): Rewrite in terms of 'terminal-dimension'.
(terminal-rows): New procedure.
* tests/syscalls.scm ("terminal-rows"): New test.
2019-06-27 11:14:40 +02:00
Ludovic Courtès 8874faaaac
ui: 'relevance' considers regexps connected with a logical and.
* guix/ui.scm (relevance)[score]: Change to return 0 when one of REGEXPS
doesn't match.
* tests/ui.scm ("package-relevance"): New test.
2019-06-27 11:14:40 +02:00
Marius Bakke 6cb1ef9ea2
Merge branch 'staging' into core-updates 2019-06-20 23:38:56 +02:00
Robert Vollmert b46a9b9a5e
import: hackage: Add two expected failing test cases.
This adds failing test cases for two hackage import bugs:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25138
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35743

* tests/hackage.scm: Make comment style consistent. Add two
cabal parsing tests, marked as expected failures.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-20 14:07:01 +02:00
Robert Vollmert 3149c00264
utils: canonical-newline-port: Fix handling of carriage return at buffer end.
Prior to this change the added test fails for me locally at byte
1024. It might depend on some default buffer sizes.

Fixes <https://bugs.gnu.org/35863>.

* tests/utils.scm ("canonical-newline-port-1024"): Add test.
* guix/utils.scm (canonical-newline-port): Correct comments on CR/LF.
Remove CR even when they're at the end of the buffer.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-20 14:07:01 +02:00
Ludovic Courtès 5c7f87881a
tests: Avoid 'delete-paths' calls for 'derivation-prerequisites-to-build'.
* tests/derivations.scm ("derivation-prerequisites-to-build when outputs
already present"): Insert random text in BUILDER, and remove two calls
to 'delete-paths'.  Use 'derivation->output-path' for INPUT-PATH instead
of an old idiom.
2019-06-18 16:25:09 +02:00
Ludovic Courtès 45d46223f9
utils: Add 'invoke/quiet'.
* gnu/build/bootloader.scm (G_): Remove.
(open-pipe-with-stderr, invoke/quiet): Move to...
* guix/build/utils.scm: ... here.  Use 'let-values' instead of
'define-values' because Guile 2.0 (the bootstrap Guile) doesn't know
about 'define-values'.
* po/guix/POTFILES.in: Remove gnu/build/bootloader.scm, and add
guix/build/utils.scm.
* tests/build-utils.scm: Remove import of (gnu build bootloader).
2019-06-17 16:13:36 +02:00
Ludovic Courtès 92d00ca466
build: Remove 'gnu/packages/bootstrap' and its binaries.
* gnu/local.mk (bootstrapdir, bootstrap_i686_linuxdir)
(bootstrap_armhf_linuxdir, bootstrap_aarch64_linuxdir)
(bootstrap_mips64el_linuxdir, dist_bootstrap_i686_linux_DATA)
(dist_bootstrap_armhf_linux_DATA, dist_bootstrap_aarch64_linux_DATA)
(dist_bootstrap_mips64el_linux_DATA): Remove.
(set-bootstrap-executable-permissions): Remove target.
* Makefile.am (install-data-hook): Remove dependency on
'set-bootstrap-executable-permissions'.
* gnu/packages/bootstrap: Remove directory.
* tests/search-paths.scm ("evaluate-search-paths, separator is #f"):
Adjust to match .../aux-files/linux-libre.
2019-06-14 22:09:38 +02:00
Ludovic Courtès 1ba0b1e6ec
packages: Remove 'search-bootstrap-binary'.
* gnu/packages.scm (%bootstrap-binaries-path, search-bootstrap-binary):
Remove.
* gnu/packages/bootstrap.scm (bootstrap-executable): Export.
* guix/tests.scm (bootstrap-binary-file, search-bootstrap-binary):
Export.
* tests/derivations.scm: Remove (gnu packages) import.
* tests/grafts.scm: Likewise.
* tests/guix-daemon.sh: Likewise.
2019-06-14 21:57:39 +02:00
Ludovic Courtès 03d76577b9
tests: Make builds less expensive.
The switch to the reduced bootstrap broke build time assumptions made by
tests, notably the assumption that GNU-MAKE-BOOT0 was cheap to build.
This commit adjusts this to make these tests cheaper.

* gnu/packages/bootstrap.scm (%bootstrap-inputs-for-tests): New variable.
* guix/tests.scm (gnu-make-for-tests): New variable.
* tests/guix-environment.sh: Use GNU-MAKE-FOR-TESTS instead of
GNU-MAKE-BOOT0.  Remove test with FINDUTILS-BOOT0.
* tests/guix-package-net.sh (boot_make): Use GNU-MAKE-FOR-TESTS.
* tests/packages.scm ("GNU Make, bootstrap"): Likewise.
* tests/profiles.scm ("profile-derivation relative symlinks, two entries"):
Likewise.
* tests/union.scm (%bootstrap-inputs): Remove.
("union-build"): Use %BOOTSTRAP-INPUTS-FOR-TESTS instead of
%BOOTSTRAP-INPUTS.
2019-06-14 21:57:39 +02:00
Ludovic Courtès 11b4a8716c
tests: Remove expensive and pointless test.
This test had become too expensive since the introduction of the reduced
bootstrap.

* tests/builders.scm ("gnu-build"): Remove.
(%bootstrap-inputs, %bootstrap-search-paths): Remove.
2019-06-14 21:57:18 +02:00
Robert Vollmert ca45da9fc9
import: hackage: Handle Hackage revisions.
Hackage packages can have metadata revisions (Cabal file only) that are
not reflected in the source archive.  The Haskell build system has
support for this, but until now the Hackage importer would create a
package based on the revised Cabal file which would then build using the
old Cabal file.

Fixes <https://bugs.gnu.org/35750>.

* guix/import/cabal.scm (<cabal-package>): Add 'revision' field.
(eval-cabal): Parse 'x-revision:' property.
* guix/import/hackage.scm (read-cabal-and-hash): New procedure.
(hackage-fetch-and-hash): New procedure.
(hackage-fetch): Rewrite using 'hackage-fetch-and-hash'.
(hackage-module->sexp): Add 'cabal-hash' argument and use it to populate
the '#:cabal-revision' argument.
(hackage->guix-package): Use the new '-and-hash' functions to get the
hash of the Cabal file and pass it to 'hackage-module->sexp'.
* guix/tests/hackage.scm: Test import of Cabal file revision.

Signed-off-by: Timothy Sample <samplet@ngyro.com>
2019-06-13 22:18:52 -04:00
Ludovic Courtès d9bbfe042e
Merge branch 'master' into core-updates 2019-06-13 13:24:35 +02:00
Ivan Petkov 5a9ef8a960
import: crate: Define dependencies as arguments.
* guix/import/crate.scm:
(crate-fetch)[input-crates]: Rename to dev-crates.
[native-input-crates]: Rename to dev-dep-crates.
[inputs]: Rename to cargo-inputs.
[native-inputs]: Rename to cargo-development-inputs.
(maybe-cargo-inputs, maybe-cargo-development-inputs, maybe-arguments): Add
them.
(make-crate-sexp)[inputs]: Rename to cargo-inputs.
[native-inputs]: Rename to cargo-development-inputs.
[maybe-native-inputs, maybe-inputs]: Replace with maybe-arguments.
* guix/import/utils.scm: (package-names->package-inputs): Make public.  Add
docstring.
* tests/crate.scm (crate->guix-package): Update the match pattern.

Signed-off-by: Chris Marusich <cmmarusich@gmail.com>
2019-06-11 18:05:44 -07:00
Ludovic Courtès f8a9f99cd6
store: 'build-things' accepts derivation/output pairs.
This allows callers to request the substitution of a single derivation
output.

* guix/store.scm (build-things): Accept derivation/output pairs among
THINGS.
* guix/derivations.scm (build-derivations): Likewise.
* tests/store.scm ("substitute + build-things with specific output"):
New test.
* tests/derivations.scm ("build-derivations with specific output"):
New test.
* doc/guix.texi (The Store): Adjust accordingly.
2019-06-10 22:42:59 +02:00
Ludovic Courtès c0a4db6697
import: print: Honor the outputs of inputs (!).
Fixes <http://bugs.gnu.org/35893>.
Reported by Jesse Gibbons <jgibbons2357@gmail.com>.

* guix/import/print.scm (package->code)[package-lists->code]: Preserve
OUT in the result.
* tests/print.scm (define-with-source): New macro.
(pkg): Use it.
(pkg-source): New variable.
(pkg-with-inputs, pkg-with-inputs-source): New variables.
("simple package"): Refer to 'pkg-source'.
("package with inputs"): New test.
2019-06-07 22:49:47 +02:00
Robert Vollmert 959c9d159d
import: hackage: Parse braced properties.
This adds partial support for Cabal properties that use curly
braces instead of the layout rule.  See for example
https://hackage.haskell.org/package/cassava/

* guix/import/cabal.scm (read-braced-value): New procedure.
(is-property): Remove.
(is-layout-property, is-braced-property): New variables.
(lex-property): Rename to...
(lex-layout-property): ... this.
(lex-braced-property, lex-property): New procedures.
(lex-token): Add call to 'lex-property'.
* guix/tests/hackage.scm: Test braced description import.
* tests/hackage.scm (test-cabal-multiline-desc): Rename to...
(test-cabal-multiline-layout): ... this.
("hackage->guix-package test multiline desc"): Rename to...
("hackage->guix-package test multiline desc (layout)"): ... this.
(test-cabal-multiline-braced): New variable.
("hackage->guix-package test multiline desc (braced)"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-02 22:16:05 +02:00
Robert Vollmert 64d3181357
tests: hackage: Test multiline cabal description.
* tests/hackage.scm (test-cabal-multiline-desc): New variable.
("hackage->guix-package test multiline desc"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-02 22:12:19 +02:00
Robert Vollmert ea35f5c599
tests: Fix hackage tests.
This is a followup to 1cc12357a6.

* tests/hackage.scm: ghc-mtl is no longer added as an input.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-02 22:07:53 +02:00
Ludovic Courtès b90ae065b5
substitute: Select the best compression methods.
When a server publishes several URLs with different compression methods,
'guix substitute' can now choose the best one among the compression
methods that it supports.

* guix/scripts/substitute.scm (<narinfo>)[uri]: Replace with...
[uris]: ... this.
[compression]: Replace with...
[compressions]: ... this.
[file-size]: Replace with...
[file-sizes]: ... this.
[file-hash]: Replace with...
[file-hashes]: ... this.
(narinfo-maker): Adjust accordingly.  Ensure 'file-sizes' and
'file-hashes' have the right length.
(assert-valid-signature, valid-narinfo?): Use the first element of
'narinfo-uris' in error messages.
(read-narinfo): Expect "URL", "Compression", "FileSize", and "FileHash"
to occur multiple times.
(display-narinfo-data): Call 'select-uri' to determine the file size.
(%compression-methods): New variable.
(supported-compression?, compresses-better?, select-uri): New
procedures.
(process-substitution): Call 'select-uri' to select the URI and
compression.
* guix/scripts/weather.scm (report-server-coverage): Account for all the
values returned by 'narinfo-file-sizes'.
* tests/substitute.scm ("substitute, narinfo with several URLs"): New
test.
2019-06-02 22:01:57 +02:00
Ludovic Courtès b8fa86adfc
publish: '--compression' can be repeated.
This allows 'guix publish' to compress and advertise multiple
compression methods from which users can choose.

* guix/scripts/publish.scm (actual-compression): Rename to...
(actual-compressions): ... this.  Expect REQUESTED to be a list, and
always return a list.
(%default-options): Remove 'compression.
(store-item->recutils): New procedure.
(narinfo-string): Change #:compression to #:compressions (plural).
Adjust accordingly.
(render-narinfo, render-narinfo/cached): Likewise.
(bake-narinfo+nar): Change #:compression to #:compressions.
[compressed-nar-size]: New procedure.
Call 'compress-nar' for each item returned by 'actual-compressions'.
Create a narinfo for each compression.
(effective-compression): New procedure.
(make-request-handler): Change #:compression to #:compressions.
Use 'effective-compression' to determine the applicable compression.
(guix-publish): Adjust handling of '--compression'.
Print a message for each compression that is enabled.
* tests/publish.scm ("/*.narinfo"): Adjust to new narinfo field
ordering.
("/*.narinfo with properly encoded '+' sign"): Likewise.
("/*.narinfo with lzip + gzip"): New test.
("with cache, lzip + gzip"): New test.
* doc/guix.texi (Invoking guix publish): Document it.
2019-06-02 22:01:57 +02:00
Robert Vollmert 0be465924c
tests: Indent hackage tests
* tests/hackage.scm: Reindent using etc/indent-code.el.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-01 15:26:30 +02:00
Robert Vollmert 4110cde005
tests: hackage: Don't mock hackage-fetch.
* tests/hackage.scm: Pass a string input port to tests instead of
mocking hackage download.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-01 15:26:30 +02:00
Robert Vollmert 55c98f3261
tests: hackage: Factor out package pattern.
* tests/hackage.scm: Import result pattern matching via helper.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-06-01 15:26:30 +02:00
Ludovic Courtès 66229b04ae
publish: Add support for lzip.
* guix/scripts/publish.scm (show-help, %options): Support '-C METHOD'
and '-C METHOD:LEVEL'.
(default-compression): New procedure.
(bake-narinfo+nar): Add lzip.
(nar-response-port): Likewise.
(string->compression-type): New procedure.
(make-request-handler): Generalize /nar/gzip handler to handle /nar/lzip
as well.
* tests/publish.scm ("/nar/lzip/*"): New test.
("/*.narinfo with lzip compression"): New test.
* doc/guix.texi (Invoking guix publish): Document it.
(Requirements): Mention lzlib.
2019-05-27 22:47:24 +02:00
Ludovic Courtès 4e48923e75
utils: Support compression and decompression with lzip.
* guix/utils.scm (lzip-port): New procedure.
(decompressed-port, compressed-port, compressed-output-port): Add 'lzip
case.
* tests/utils.scm <top level>: Call 'test-compression/decompression' for
'lzip as well.
2019-05-27 22:47:24 +02:00
Ludovic Courtès 4c7ebe318f
utils: Test 'compressed-port' and 'decompressed-port' for both gzip and xz.
* tests/utils.scm (test-compression/decompression): New procedure.
<top level>: Call it for both 'xz and 'gzip.
2019-05-27 22:47:24 +02:00
Ludovic Courtès 2a991f3ae4
lzlib: Add 'make-lzip-input-port/compressed'.
* guix/lzlib.scm (lzwrite!, make-lzip-input-port/compressed): New
procedures.
* tests/lzlib.scm ("make-lzip-input-port/compressed"): New test.
* guix/tests.scm (%seed): Export.
2019-05-27 22:47:24 +02:00
Ludovic Courtès ad7466aafd
import: hackage: Fix Cabal test.
* guix/import/hackage.scm (hackage->guix-package): Remove call to 'memoize'.
(hackage->guix-package/m): New procedure.
(hackage-recursive-import): Use it.
* tests/hackage.scm ("hackage->guix-package test 6"): Adjust.

Co-authored-by: Robert Vollmert <rob@vllmrt.net>
2019-05-26 23:20:30 +02:00