Commit Graph

717 Commits (f82ce8f6b1e1f64aad08e66eec77d72d8e53b1ad)

Author SHA1 Message Date
Ludovic Courtès babc2c80a7
records: Improve reporting of invalid field specifiers.
Fixes <http://bugs.gnu.org/23969>.
Reported by Vincent Legoll <vincent.legoll@gmail.com>.

* guix/records.scm (report-invalid-field-specifier): New procedure.
* tests/records.scm ("define-record-type* & wrong field specifier"): New
test.
2016-07-14 19:07:07 +02:00
Ludovic Courtès bfcb3d767b
lint: 'validate-uri' reports suspiciously small 200 responses.
* guix/scripts/lint.scm (validate-uri): Upon 200 http-response, check
the 'response-content-length' and emit a warning when it is <= 1000.
* tests/lint.scm (call-with-http-server): Add 'data' parameter.
(with-http-server): Likewise.
(%long-string): New variable.
("home-page: 200"): Pass %LONG-STRING to 'with-http-server'.
("home-page: 404", "source: 200", "source: 404"): Likewise.
("home-page: 200 but short length"): New test.
("source: 200 but short length"): New test.
2016-07-13 00:50:05 +02:00
Ludovic Courtès c1629416d8
gnu: Remove unneeded 'imported-modules' fields for 'origin'.
* gnu/packages/engineering.scm (fastcap)[source](modules,
imported-modules): Remove.
* gnu/packages/wm.scm (awesome)[source](imported-modules): Remove.
* tests/packages.scm ("package-source-derivation, snippet"): Remove
'imported-modules' field.
2016-07-12 22:47:08 +02:00
Ludovic Courtès 66a35ceb43
gexp: Remove more uses of #:modules.
* guix/scripts/system.scm (switch-to-system): Adjust comment.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Use
'with-imported-modules' instead of #:modules.
* tests/grafts.scm ("graft-derivation, preserve empty directories"):
Likewise.
2016-07-12 22:47:08 +02:00
Ludovic Courtès 0bb9929eaa
gexp: Add 'with-imported-modules' macro.
* guix/gexp.scm (<gexp>)[modules]: New field.
(gexp-modules): New procedure.
(gexp->derivation): Use it and append the result to %MODULES.
Update docstring to mark #:modules as deprecated.
(current-imported-modules, with-imported-modules): New macros.
(gexp): Pass CURRENT-IMPORTED-MODULES as second argument to 'gexp'.
(gexp->script): Use and honor 'gexp-modules'; define '%modules'.
* tests/gexp.scm ("gexp->derivation & with-imported-modules")
("gexp->derivation & nested with-imported-modules")
("gexp-modules & ungexp", "gexp-modules & ungexp-splicing"):
New tests.
("program-file"): Use 'with-imported-modules'.  Remove #:modules
argument to 'program-file'.
* doc/guix.texi (G-Expressions): Document 'with-imported-modules'.
Mark #:modules of 'gexp->derivation' as deprecated.
* emacs/guix-devel.el: Add syntax for 'with-imported-modules'.
(guix-devel-keywords): Add it.
* .dir-locals.el: Likewise.
2016-07-12 22:47:08 +02:00
Alex Sassmannshausen 5b8e564ccd
import: cpan: Use our mirrors for 'https' URLs.
* guix/import/cpan.scm (fix-source-url): New procedure.
  (cpan-module->sexp): Use it to construct our source-url.
* tests/cpan.scm: Add tests for fix-source-url.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-07-03 23:58:29 +02:00
Ludovic Courtès 25a3bfbe77
tests: Skip all the container tests when needed.
Reported by myglc2 <myglc2@gmail.com>
at <http://bugs.gnu.org/23836>.

* tests/containers.scm (skip-if-unsupported): New procedure.
Call it before each test.
2016-06-25 01:13:23 +02:00
Ludovic Courtès 77559f23b0
tests: Strengthen regexp in 'packages.scm'.
* tests/packages.scm ("--search-paths with pattern"): Call
'regexp-quote' on the result of 'derivation->output-path'.
2016-06-20 00:52:53 +02:00
Ludovic Courtès 4ff76a0a34
gexp: Add 'local-file' file name resolution test.
* tests/gexp.scm ("local-file, relative file name"): New test.
2016-06-16 09:34:37 +02:00
Ludovic Courtès 0687fc9cd9
gexp: Add #:select? parameter to 'local-file'.
* guix/gexp.scm (<local-file>)[select?]: New field.
(true): New procedure.
(%local-file): Add #:select? and honor it.
(local-file): Likewise.
* tests/gexp.scm ("local-file, #:select?"): New test.
* doc/guix.texi (G-Expressions): Adjust accordingly.
2016-06-16 09:34:32 +02:00
Ludovic Courtès da675305dd
packages: The 'source' can be any lowerable object.
* guix/packages.scm (expand-input): Use 'struct?' instead of 'origin?'
when matching SOURCE.
(package-source-derivation): Use 'lower-object' instead of
'origin->derivation'.
* tests/packages.scm ("package-source-derivation, local-file"): New
test.
* doc/guix.texi (package Reference): Update 'source' documentation
accordingly.
2016-06-15 15:26:30 +02:00
Cyril Roelandt 266785d21e import: pypi: read requirements from wheels.
* doc/guix.tex (Invoking guix import): Mention that the pypi importer
works better with "unzip".
* guix/import/pypi.scm (latest-wheel-release,
wheel-url->extracted-directory): New procedures.
* tests/pypi.scm (("pypi->guix-package, wheels"): New test.
2016-06-14 22:03:22 +02:00
Ludovic Courtès fe585be9aa
serialization: Add #:select? parameter to 'write-file'.
* guix/serialization.scm (write-file): Add #:select? parameter and honor it.
* tests/nar.scm ("write-file #:select? + restore-file"): New test.
2016-06-12 23:55:22 +02:00
Ludovic Courtès 638c5b7939
ui: 'string->duration' supports hours and seconds.
* guix/ui.scm (string->duration): Add seconds and hours.
* tests/ui.scm ("duration, 1 second"): New test.
2016-06-09 23:34:56 +02:00
Ludovic Courtès 93961f0298
publish: Encore URIs that appear in narinfos.
Fixes <http://bugs.gnu.org/21888>.
Reported by iyzsong@member.fsf.org (宋文武).

* guix/scripts/publish.scm (narinfo-string): Use
'encode-and-join-uri-path' instead of 'string-append' to compute URL.
* tests/publish.scm ("/*.narinfo with properly encoded '+' sign"):
("/nar/ with properly encoded '+' sign"): New tests.
2016-06-08 19:07:58 +02:00
Ludovic Courtès f82c58539e
bournish: Allow compilation of multiple expressions.
* guix/build/bournish.scm (%bournish-language): Add a joiner to SCHEME.
Compile only to Scheme.
* tests/bournish.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
2016-06-06 18:14:52 +02:00
Ludovic Courtès 40d71e44f5
profiles: 'profile-derivation' now honors #:system.
Fixes <http://bugs.gnu.org/23682>.
Reported by Ander GM <anthk@openmailbox.org>.

* guix/profiles.scm (profile-derivation): Pass #:system to
'gexp->derivation'.
* tests/guix-environment.sh: Add 'guix environment -s' test.
2016-06-05 00:05:38 +02:00
Ludovic Courtès 151afd84dc
daemon: Substitute queries return immediately when substitutes are disabled.
Reported by Federico Beffa <beffa@ieee.org>
at <https://lists.gnu.org/archive/html/guix-devel/2016-05/msg00928.html>.

* nix/libstore/local-store.cc (LocalStore::querySubstitutablePaths)
(LocalStore::querySubstitutablePathInfos): Return when
'settings.useSubstitutes' is false.
* tests/store.scm ("references/substitutes missing reference info"):
Make sure to return #f on failure.
* tests/store.scm ("substitutable-path-info when substitutes are turned off"):
("substitutable-paths when substitutes are turned off"): New tests.
2016-05-31 18:22:14 +02:00
Ludovic Courtès c06f6db7a4
container: Gracefully report mount errors in the child process.
Fixes <http://bugs.gnu.org/23306>.

* gnu/build/linux-container.scm (run-container): Use 'socketpair'
instead of 'pipe'.  Rename 'in' to 'child' and 'out' to 'parent'.  Send
a 'ready message or an exception argument list from the child to the
parent; adjust the parent accordingly.
* tests/containers.scm ("call-with-container, mnt namespace, wrong bind
mount"): New test.
* tests/guix-environment-container.sh: Add test with
--expose=/does-not-exist.
2016-05-31 00:11:04 +02:00
Ludovic Courtès 870bf71eb0
cve: Use a more compact format for the list of package/versions.
On a warm cache, "guix lint -c cve vorbis-tools" goes down
from 6.5s to 2.4s.

* guix/cve.scm (cpe->package-name): Change to return two values instead
of a pair.
(cpe->product-alist): New procedure.
(%parse-vulnerability-feed): Use it instead of 'filter-map'.
(fetch-vulnerabilities): Bump sexp format version to 1.
(vulnerabilities->lookup-proc): Adjust accordingly.  When #:version is
omitted, return a list of vulnerabilities instead of a list of
version/vulnerability pairs.
* tests/cve.scm (%expected-vulnerabilities)
("vulnerabilities->lookup-proc): Adjust accordingly.
2016-05-28 01:07:12 +02:00
Ludovic Courtès 494dc2fc62
guix package: Inherit the transformed version number.
Previously, 'guix package -i emacs --with-source=./emacs-42.tar.gz'
would fail to use "42" as the version number in the manifest entry.

Reported by piyo on #guix.

* guix/scripts/package.scm (process-actions)[transform-entry]: Inherit
the version number from the result of TRANSFORM when it's a package.
* tests/guix-package.sh: Test it.
2016-05-27 22:05:34 +02:00
Ludovic Courtès f6fee16e93
store: 'requisites' now takes a list of store items.
* guix/store.scm (fold-path): Change 'path' to 'paths' and adjust body
accordingly.
(requisites): Likewise.
* guix/scripts/environment.scm (inputs->requisites): Adjust
user accordingly.
* guix/scripts/size.scm (requisites*): Likewise.
* guix/scripts/gc.scm (guix-gc): Likewise.
* tests/store.scm ("requisites"): Likewise.
2016-05-24 23:35:28 +02:00
Ludovic Courtès a371aa225c
size: 'store-profile' takes a list of store items.
* guix/scripts/size.scm (mappend-map): New procedure.
(store-profile): Change 'item' to 'items' and adjust code accordingly.
(guix-size): Update caller.
* tests/size.scm ("store-profile"): Likewise.
2016-05-24 23:05:28 +02:00
Ludovic Courtès a61cd1d0fd
tests: Do not run 'cve' checker in 'tests/guix-lint.sh'.
Reported by Malcolm, Cook <MEC@stowers.org>.

* tests/guix-lint.sh: Pass '-c synopsis,description' in first invocation
so we don't run the 'cve' checker.
2016-05-24 14:45:18 +02:00
Ludovic Courtès e144e3427d
graph: Add 'node-reachable-count'.
* guix/graph.scm (node-reachable-count): New procedure.
* tests/graph.scm ("node-reachable-count"): New test.
2016-05-24 00:06:01 +02:00
Ludovic Courtès ece6864bd0
grafts: Rename files whose name matches a graft.
Fixes <http://bugs.gnu.org/23132>.
Reported by Mark H Weaver <mhw@netris.org>.

* guix/build/graft.scm (rename-matching-files): New procedure.
(rewrite-directory): Use it.
* tests/grafts.scm ("graft-derivation, renaming"): New test.
2016-05-21 01:35:14 +02:00
Ludovic Courtès cf8b312d18
grafts: Preserve empty directories when grafting.
* guix/build/graft.scm (rewrite-directory)[rewrite-leaf]: Add case for
'directory.
Pass #:directories? #t to 'find-files'.
2016-05-21 01:35:14 +02:00
Ludovic Courtès a773c3142d
graph: Allow store file names for 'derivation' and 'references' graphs.
* guix/scripts/graph.scm (%derivation-node-type)[convert]: Add
'derivation-path?' and catch-all clauses.
(%reference-node-type)[convert]: Add 'store-path?' and catch-all
clauses.
(assert-package, nodes-from-package): New procedures.
(%package-node-type, %bag-node-type,%bag-with-origins-node-type)
(%bag-emerged-node-type): Add 'convert' field
(guix-graph): Rename 'packages' to 'items' and
allow 'store-path?' arguments.
* guix/graph.scm (<node-type>)[convert]: Adjust comment.
* doc/guix.texi (Invoking guix graph): Document it.
2016-05-21 01:35:14 +02:00
Ludovic Courtès 97507ebedc
derivations: 'derivation' sorts items in the resulting object.
* guix/derivations.scm (derivation-input<?): New procedure.
(write-derivation)[coalesce-duplicate-inputs]: Remove.
Remove calls to 'sort'.
(coalesce-duplicate-inputs): New procedure.
(derivation-hash): Sort INPUTS and use 'coalesce-duplicate-inputs'.
(derivation)[input->derivation-input]
[coalesce-duplicate-inputs]: New procedures.
Sort OUTPUTS, INPUTS, and ENV-VARS.
* tests/derivations.scm ("read-derivation vs. derivation"): New test.
2016-05-21 01:35:14 +02:00
Ludovic Courtès 4e0ea3eb28
utils: Move 'fcntl-flock' to (guix build syscalls).
* guix/utils.scm (%struct-flock, F_SETLKW, F_SETLK, F_xxLCK)
(fcntl-flock): Move to...
* guix/build/syscalls.scm: ... here.  New variables.
* guix/nar.scm: Adjust imports accordingly.
* tests/utils.scm ("fcntl-flock wait", "fcntl-flock non-blocking"): Move
to...
* tests/syscalls.scm: ... here.  New tests.
(temp-file): New variable.
2016-05-06 13:25:30 +02:00
Ludovic Courtès 958dd3ce68
utils: Move combinators to (guix combinators).
* guix/utils.scm (compile-time-value, memoize, fold2)
(fold-tree, fold-tree-leaves): Move to...
* guix/combinators: ... here.  New file.
* tests/utils.scm ("fold2, 1 list", "fold2, 2 lists")
(fold-tree tests): Move to...
* tests/combinators.scm: ... here.  New file.
* Makefile.am (MODULES, SCM_TESTS): Add them.
* gnu/packages.scm, gnu/packages/bootstrap.scm,
gnu/services/herd.scm, guix/build-system/gnu.scm,
guix/build-system/python.scm, guix/derivations.scm,
guix/gnu-maintenance.scm, guix/import/elpa.scm,
guix/scripts/archive.scm, guix/scripts/build.scm,
guix/scripts/graph.scm, guix/scripts/lint.scm,
guix/scripts/size.scm, guix/scripts/substitute.scm,
guix/serialization.scm, guix/store.scm, guix/ui.scm: Adjust imports
accordingly.
2016-05-04 23:35:55 +02:00
Ludovic Courtès 4b6fa8b339
utils: Remove 'split'.
This procedure was redundant with SRFI-1's 'break'.

* guix/utils.scm (split): Remove.
* tests/utils.scm ("split, element is in list")
("split, element is not in list"): Remove.
2016-05-04 23:35:55 +02:00
Ludovic Courtès a8f3424b25
syscalls: Wrap TCSA* constants in 'tcsetattr-action' macro.
* guix/build/syscalls.scm (tcsetattr-action): New macro.
(TCSANOW, TCSADRAIN, TCSAFLUSH): Remove.
(tcsetattr): Adjust docstring accordingly.
* tests/syscalls.scm ("tcsetattr"): Adjust accordingly.
2016-05-03 17:45:29 +02:00
Ludovic Courtès ae4ff9f359
syscalls: Add 'tcgetattr' and 'tcsetattr' bindings.
* guix/build/syscalls.scm (bits->symbols-body, define-bits)
(local-flags): New macros.
(TCSANOW, TCSADRAIN, TCSAFLUSH): New variables.
(<termios>): New record type.
(%termios): New C structure.
(tcgetattr, tcsetattr): New procedures.
* tests/syscalls.scm ("tcgetattr ENOTTY", "tcgetattr")
("tcsetattr"): New tests.
2016-05-02 00:05:36 +02:00
Ludovic Courtès 5c6a062d48
lint: 'check-vulnerabilities' follows package replacements.
* guix/scripts/lint.scm (check-vulnerabilities): Check the replacement
of PACKAGE.
* tests/lint.scm ("cve: patched vulnerability in replacement"): New test.
2016-04-28 18:03:01 +02:00
Ludovic Courtès 20be23c3b6
lint: Report synopses/descriptions that are not strings.
Suggested by John Darrington.

* guix/scripts/lint.scm (check-description-style): Emit a warning when
DESCRIPTION is not a string.
(check-synopsis-style): Likewise.
(check-gnu-synopsis+description): Likewise.
* tests/lint.scm ("description: not a string", "synopsis: not a
string"): New tests.
2016-04-27 11:57:48 +02:00
Ludovic Courtès 5cd25aad3c
syscalls: 'terminal-columns' catches EINVAL on the TIOCGWINSZ ioctl.
Reported by Mark H Weaver <mhw@netris.org>.

* guix/build/syscalls.scm (terminal-columns): Tolerate EINVAL.
* tests/syscalls.scm ("terminal-window-size ENOTTY"): Likewise.
2016-04-25 23:34:20 +02:00
Ludovic Courtès a1f708787d
syscalls: Add 'statfs'.
* guix/build/syscalls.scm (<file-system>): New record type.
(fsword): New macro.
(%statfs): New C struct.
(statfs): New procedure.
2016-04-25 23:27:09 +02:00
Ludovic Courtès 6d2b43915f syscalls: 'terminal-columns' ignores non-file ports.
* guix/build/syscalls.scm (terminal-columns): Call
'terminal-window-size' only when PORT is a file port.
* tests/syscalls.scm ("terminal-columns non-file port"): New test.
2016-04-16 00:52:19 +02:00
Ludovic Courtès 29ff6d9fcc syscalls: Add TIOCGWINSZ bindings.
* guix/build/syscalls.scm (TIOCGWINSZ): New macro.
(<window-size>): New record type.
(winsize): New C struct.
(winsize-struct): New variable.
(terminal-window-size, terminal-columns): New procedures.
2016-04-15 00:32:18 +02:00
宋文武 50a3d59473 utils: Add 'edit-expression'.
* guix/utils.scm (edit-expression): New procedure.
* tests/utils.scm (edit-expression): New test.
2016-04-13 09:16:54 +08:00
Mathieu Lirzin a9edb211e7 build: Add a Guile custom test driver using SRFI-64.
Before that '.log' files for scheme tests were fragmented and not
included in test-suite.log.  This unifies the semantics of SRFI-64 API
with Automake test suite.

* build-aux/test-driver.scm: New file.
* Makefile.am (SCM_LOG_DRIVER, AM_SCM_LOG_DRIVER_FLAGS): New variables.
(SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables.
(AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0.
* test-env.in: Silence guix-daemon.
* doc/guix.texi (Running the Test Suite): Describe how to display the
detailed results.  Bug reports require only 'test-suite.log' file.
* tests/base32.scm, tests/build-utils.scm, tests/builders.scm,
tests/challenge.scm, tests/cpan.scm, tests/cpio.scm, tests/cran.scm,
tests/cve.scm, tests/derivations.scm, tests/elpa.scm,
tests/file-systems.scm, tests/gem.scm, tests/gexp.scm,
tests/gnu-maintenance.scm, tests/grafts.scm, tests/graph.scm,
tests/gremlin.scm, tests/hackage.scm, tests/hash.scm,
tests/import-utils.scm, tests/lint.scm, tests/monads.scm, tests/nar.scm,
tests/packages.scm, tests/pk-crypto.scm, tests/pki.scm,
tests/profiles.scm, tests/publish.scm, tests/pypi.scm,
tests/records.scm, tests/scripts-build.scm, tests/scripts.scm,
tests/services.scm, tests/sets.scm, tests/size.scm, tests/snix.scm,
tests/store.scm, tests/substitute.scm, tests/syscalls.scm,
tests/system.scm, tests/ui.scm, tests/union.scm, tests/upstream.scm,
tests/utils.scm: Don't exit at the end of test groups.
* tests/containers.scm: Likewise.  Use 'test-skip' instead of exiting
with error code 77.
2016-04-03 14:19:09 +02:00
David Thompson 13bc8d5e4f environment: Properly handle SIGINT.
Switching to execlp means that the process spawned in a container is PID
1, which obsoleted one of the 'guix environment --container' tests
because the init process can't be killed in the usual manner.

* guix/scripts/environment.scm (launch-environment/fork): New procedure.
(launch-environment): Switch from system* to execlp.  Add handler for
SIGINT.
(guix-environment): Use launch-environment/fork.
* tests/guix-environment-container.sh: Replace abnormal exit test with
one that works now that the spawned process is PID 1.
2016-03-27 15:09:21 -04:00
Ludovic Courtès 7adbe85e60 syscalls: 'interface-address' can return #f.
Fixes <http://bugs.gnu.org/22612>.
Reported by Danny Milosavljevic <dannym@scratchpost.org>.

* tests/syscalls.scm ("network-interfaces returns one or more
interfaces"): Accept 'interface-address' value of #f.
2016-03-25 17:29:36 +01:00
Ludovic Courtès 9a2a20052a guix build: '--with-source' correctly matches versioned file names.
* guix/scripts/build.scm: Use the right 'package-name->name+version'
procedure.  Fixes a regression introduced in
1b846da8c3.
* tests/scripts-build.scm ("options->transformation, with-source, with
version"): New test.
2016-03-23 23:43:50 +01:00
Ludovic Courtès d26e19671e derivations: Raise an error when a module file is not found.
Suggested by Jookia.

* guix/derivations.scm (&file-search-error): New error condition.
(search-path*): Raise it when 'search-path' returns #f.
* guix/gexp.scm (search-path*): Remove.
* guix/ui.scm (call-with-error-handling): Add case for
'file-search-error?'.
* tests/derivations.scm ("build-expression->derivation and invalid
module name"): New test.
2016-03-23 00:23:12 +01:00
Ludovic Courtès 3f4ecf3229 gexp: Add #:disallowed-references.
* guix/gexp.scm (gexp->derivation): Add #:disallowed-references and
honor it.
* tests/gexp.scm ("gexp->derivation #:disallowed-references, allowed")
("gexp->derivation #:disallowed-references"): New tests.
* doc/guix.texi (G-Expressions): Adjust accordingly.
2016-03-20 22:46:14 +01:00
Ludovic Courtès 35b5ca7869 derivations: Add #:disallowed-references.
* guix/derivations.scm (derivation): Add #:disallowed-references.
[user+system-env-vars]: Honor it.
(build-expression->derivation): Likewise.
* tests/derivations.scm ("derivation #:disallowed-references, ok")
("derivation #:disallowed-references, not ok"): New tests.
* doc/guix.texi (Derivations): Adjust accordingly.
2016-03-20 22:45:35 +01:00
Ludovic Courtès 522773b700 import: pypi: Emit 'pypi-uri' only when it yields the right URL.
Fixes <http://bugs.gnu.org/23062>.
Reported by Danny Milosavljevic <dannym@scratchpost.org>.

* guix/import/pypi.scm (make-pypi-sexp): Check whether 'pypi-uri'
returns SOURCE-URL and fall back to the full URL otherwise.
* tests/pypi.scm ("pypi->guix-package"): Adjust expected URI
accordingly.

Co-authored-by: Danny Milosavljevic <dannym@scratchpost.org>
2016-03-19 23:54:19 +01:00
Ludovic Courtès 71e2065a38 substitute: Honor client-provided empty URL list.
Before that, 'guix build --substitute-urls=""' would lead to using the
daemon's own URL list instead of the empty list.  The 'or*' hack, which
is to blame, had become unnecessary since commit
fb4bf72be3.

Reported by Mark H Weaver <mhw@netris.org>.

* guix/scripts/substitute.scm (or*): Remove.
(%cache-urls): Use 'or' instead of 'or*'.
* tests/store.scm ("substitute query, alternating URLs"): Add test with
empty URL list.
* doc/guix.texi (Common Build Options): Mention the empty string.
2016-03-16 18:34:53 +01:00