Commit Graph

584 Commits (919370291f4f9cc93878eea7db11013949ee8473)

Author SHA1 Message Date
Ludovic Courtès 919370291f gexp: Add 'computed-file'.
* guix/gexp.scm (<computed-file>): New record type.
  (computed-file, computed-file-compiler): New procedures.
* tests/gexp.scm ("lower-object, computed-file"): New test.
* doc/guix.texi (G-Expressions): Document 'computed-file'.
2015-10-10 22:46:14 +02:00
David Thompson a72ccbc251 build: container: Fix call-with-clean-exit.
Before, call-with-clean-exit would *always* return an exit code of 1.

* gnu/build/linux-container.scm (call-with-clean-exit): Exit with status
  code of 0 if thunk does not throw an exception.
* tests/containers.scm: Add test.
2015-10-10 09:00:49 -04:00
David Thompson 1de2fe95e0 scripts: environment: Use system* instead of system.
This allows for direct program invokation without needing a shell to act
as a command interpreter.

* guix/scripts/environment.scm (%default-shell): New variable.
  (show-help): Adjust description.  Remove '--exec' reference.
  (%default-options): Use '%default-shell'.
  (%options): Adjust '--exec' to run command via the default shell.
  (parse-args): New procedure.
  (guix-environment): Use 'parse-args'.  Use 'system*' instead of
  'system'.
* tests/guix-environment.sh: Add test for '--' command invokation.
* doc/guix.texi ("Invoking guix environment"): Use new syntax.  Remove
  '--exec' documentation.
2015-10-09 12:17:01 -04:00
David Thompson bbd00d2012 utils: Add split procedure.
* guix/utils.scm (split): New procedure.
* tests/utils.scm: Add tests.
2015-10-09 12:17:01 -04:00
Ludovic Courtès f073e52382 utils: Remove Nixpkgs helpers.
* guix/config.scm.in (%nixpkgs): Remove.
* guix/utils.scm (%nixpkgs-directory, nixpkgs-derivation,
  nixpkgs-derivation*): Remove.
* test-env.in: Export 'NIXPKGS'.
* tests/derivations.scm (%coreutils): Remove use of
  'nixpkgs-derivation'.
* tests/snix.scm (%nixpkgs-directory): New variable.
  Adjust users accordingly.
2015-10-06 23:51:04 +02:00
Ludovic Courtès 16748d8015 store: Add 'query-failed-paths' and 'clear-failed-paths' RPCs.
Suggested by Mark H Weaver <mhw@netris.org>.

* guix/store.scm (query-failed-paths, clear-failed-paths): New
  procedures.
* tests/guix-daemon.sh: Add test with daemon started with
  --cache-failures.
2015-09-28 22:54:04 +02:00
Ludovic Courtès 1007b6bf0b Merge branch 'master' into core-updates 2015-09-24 22:18:07 +02:00
Ludovic Courtès 08d7e3592f ui: Gracefully handle Unicode description strings.
Fixes <http://bugs.gnu.org/21536>.
Reported by Alex Kost <alezost@gmail.com>.

* guix/ui.scm (texi->plain-text): Wrap body in 'with-fluids'.
* tests/ui.scm ("package-description-string vs. Unicode"): New test.
2015-09-24 22:04:51 +02:00
Ludovic Courtès 12cd4dd3a9 tests: Unset 'LOCPATH' before running bootstrap program.
Reported by Mark H Weaver <mhw@netris.org>.

* tests/build-utils.scm ("wrap-program, one input, multiple calls"): Add
  'unsetenv' call.
2015-09-24 21:21:02 +02:00
Ricardo Wurmus a77adfe022 tests: cran: Use cran-uri in expected output.
* tests/cran.scm: Expect output to use "cran-uri" procedure.
2015-09-24 12:05:53 +02:00
Ludovic Courtès d6445dff14 tests: Adjust snippet test to '.file_list' hack.
This is a followup to commit 140b4bc.

* tests/packages.scm ("package-source-derivation, snippet")[source]: Add
  'chmod' call for "..".
2015-09-24 10:36:24 +02:00
Ludovic Courtès e0566f12f8 lint: Report lonely parentheses.
* guix/scripts/lint.scm (%hanging-paren-rx): New variable.
  (report-lone-parentheses): New procedure.
  (%formatting-reporters): Use it.
* tests/lint.scm ("formatting: lonely parentheses"): New test.
2015-09-18 21:54:04 +02:00
Alex Kost 88981dd3e2 Add (guix scripts).
* guix/ui.scm: Add missing copyright lines.
  (args-fold*, environment-build-options, %default-argument-handler,
  parse-command-line): Move to ...
* guix/scripts.scm: ...here.  New file.
* guix/scripts/archive.scm: Use it.
* guix/scripts/build.scm: Likewise.
* guix/scripts/download.scm: Likewise.
* guix/scripts/edit.scm: Likewise.
* guix/scripts/environment.scm: Likewise.
* guix/scripts/gc.scm: Likewise.
* guix/scripts/graph.scm: Likewise.
* guix/scripts/hash.scm: Likewise.
* guix/scripts/import/cpan.scm: Likewise.
* guix/scripts/import/cran.scm: Likewise.
* guix/scripts/import/elpa.scm: Likewise.
* guix/scripts/import/gem.scm: Likewise.
* guix/scripts/import/gnu.scm: Likewise.
* guix/scripts/import/hackage.scm: Likewise.
* guix/scripts/import/nix.scm: Likewise.
* guix/scripts/import/pypi.scm: Likewise.
* guix/scripts/lint.scm: Likewise.
* guix/scripts/package.scm: Likewise.
* guix/scripts/publish.scm: Likewise.
* guix/scripts/pull.scm: Likewise.
* guix/scripts/refresh.scm: Likewise.
* guix/scripts/size.scm: Likewise.
* guix/scripts/system.scm: Likewise.
* tests/ui.scm (with-environment-variable, "parse-command-line",
  "parse-command-line and --no options"): Move to ...
* tests/scripts.scm: ...here.  New file.
* Makefile.am (MODULES): Add guix/scripts.scm.
  (SCM_TESTS): Add tests/scripts.scm.
* po/guix/POTFILES.in: Add guix/scripts.scm.
2015-09-18 21:42:06 +03:00
Mathieu Lirzin 3500e659f1 lint: Add 'check-texinfo-markup' checker.
* guix/script/lint.scm (check-description-style): Check for invalid
  Texinfo markup.
* tests/lint.scm: Test it.
2015-09-15 19:01:23 +02:00
Eric Bavier 50f5c46d06 guix: lint: Check for meaningful origin file names.
* guix/scripts/lint.scm (check-source-file-name): New procedure.
  (%checkers): Add 'source-file-name' checker.
* tests/lint.scm ("source-file-name", "source-file-name: v prefix")
  ("source-file-name: valid", "source-file-name: bad checkout")
  ("source-file-name: good checkout"): New tests.
* doc/guix.texi (Invoking guix lint): Mention file name check.
2015-09-14 18:03:33 -05:00
Eric Bavier 3b4d01035f guix: packages: Add origin-actual-file-name.
* guix/scripts/graph.scm (uri->file-name, node-full-name): Move origin file
  name logic to...
* guix/packages.scm (origin-actual-file-name): ...here.
* tests/packages.scm ("origin-actual-file-name")
  ("origin-actual-file-name, file-name"): New tests.
2015-09-14 18:02:37 -05:00
Eric Bavier a6d0b306c2 guix: packages: Add transitive-input-references.
* guix/packages.scm (transitive-input-references): New procedure.
* gnu/packages/version-control.scm (package-transitive-propagated-labels*)
  (package-propagated-input-refs): Delete.
  (git)[arguments]: Adjust to transitive-input-references.
2015-09-10 03:21:55 -05:00
Ludovic Courtès 52b9efe337 lint: Add 'license' checker.
* guix/scripts/lint.scm (check-license): New procedure.
  (%checkers): Add 'license' checker.
* tests/lint.scm ("license: invalid license"): New test.
2015-09-06 12:36:15 +02:00
Ludovic Courtès cfc5d39888 tests: Fix typos.
* tests/derivations.scm ("substitutable-derivation?",
  "derivation-prerequisites-to-build and substitutes, local build"): Fix
  harmless typos.
2015-09-05 22:11:03 +02:00
Ludovic Courtès dbbc248aee monads: Fix 'liftN' fallback case.
Reported by Andy Wingo <wingo@igalia.com>.

* guix/monads.scm (define-lift) <fallback case>: Add missing #'.  Remove
  extra formal parameter.
* tests/monads.scm ("lift"): Add test with 'lift1' as a procedure.
2015-09-04 18:31:06 +02:00
Ludovic Courtès 4c8f997a7d graph: Add '--expression'.
* guix/scripts/graph.scm (%options, show-help): Add '--expression'.
  (guix-graph): Call 'read/eval-package-expression' for 'expression'
  pairs in OPTS.
* tests/guix-graph.sh: Add tests.
* doc/guix.texi (Invoking guix graph): Document it.
2015-09-02 23:40:07 +02:00
David Thompson a96524cc7d import: gem: Fix minor bug and add unit test.
* guix/import/gem.scm (make-gem-sexp): Properly handle an empty list of
  licenses.  When rendering a list of licenses, cons 'list onto the front of
  the expression.
* tests/gem.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
2015-09-01 20:00:01 -04:00
Ricardo Wurmus e1248602f9 import: Add 'cran' importer.
* guix/import/cran.scm: New file.
* guix/scripts/import.scm: Add "cran" to 'importers'.
* guix/scripts/import/cran.scm: New file.
* tests/cran.scm: New file.
* Makefile.am (MODULES): Add 'guix/import/cran.scm' and
  'guix/scripts/import/cran.scm'.
  (SCM_TESTS): Add 'tests/cran.scm'.
* doc/guix.texi (Invoking guix import): Document it.
* po/guix/POTFILES.in: Add 'guix/scripts/import/cran.scm'.
2015-08-31 15:39:34 +02:00
Ludovic Courtès 54e515eb75 tests: Skip 'set-network-interface-address' test when running as root.
Reported by Eric Hanchrow <eric.hanchrow@gmail.com>
in <http://bugs.gnu.org/21354>.

* tests/syscalls.scm ("set-network-interface-address"): Skip when (getuid)
  returns zero.
2015-08-27 10:52:11 +02:00
Ludovic Courtès 888569161c Add 'guix graph'.
* guix/scripts/graph.scm, tests/graph.scm, tests/guix-graph.sh,
  doc/images/coreutils-bag-graph.dot, doc/images/coreutils-graph.dot: New
  files.
* Makefile.am (MODULES): Add guix/scripts/graph.scm.
  (SH_TESTS): Add tests/guix-graph.sh.
  (SCM_TESTS): Add tests/graph.scm.
* doc.am (DOT_FILES, DOT_VECTOR_GRAPHICS): New variables.
  (EXTRA_DIST): Use them.
  (dist_infoimage_DATA): Use $(DOT_FILES).
  (pdf-local, info-local, ps-local): Likewise.
* doc/guix.texi (Packages with Multiple Outputs): Add cross-reference to 'guix
  graph'.
  (Invoking guix gc): Likewise.
  (Invoking guix graph): New section.
2015-08-27 00:49:23 +02:00
Ludovic Courtès c2b8467645 gexp: Add 'lower-object'.
* guix/gexp.scm (lower-object): New procedure.
  (lower-inputs, lower-references, gexp->sexp): Use it.
* tests/gexp.scm ("lower-object"): New test.
* doc/guix.texi (G-Expressions): Document it.
2015-08-27 00:49:23 +02:00
Ludovic Courtès fe32241ad5 tests: Work around Btrfs handling of nlink for empty directories.
Fixes <http://bugs.gnu.org/21280>.
Reported by Leo Famulari <leo@famulari.name>.

* tests/nar.scm (file-tree-equal?): Use #t as the initial result.  Btrfs would
  set nlink to 1 instead of 2 for an empty directory, thereby leading
  'file-tree-equal?' to return #f.
2015-08-26 00:43:36 +02:00
David Thompson 0d2794005c scripts: package: Add --install-from-file option.
* guix/scripts/package.scm (show-help): Add help text for --install-from-file
  option.
  (%options): Add --install-from-file option.
* tests/guix-package.sh: Test it.
* doc/guix.texi ("invoking guix package"): Document it.
* doc/package-hello.scm: New file.
* doc.am (EXTRA_DIST): Add it.
2015-08-19 22:23:59 -04:00
Ludovic Courtès 40a7d4e58b lint: Add 'formatting' checker.
* guix/scripts/lint.scm (report-tabulations, report-trailing-white-space,
  report-long-line, report-formatting-issues, check-formatting): New
  procedures.
  (%formatting-reporters): New variable.
  (%checkers): Add 'formatting' checker.
* tests/lint.scm ("formatting: tabulation", "formatting: trailing white
  space", "formatting: long line", "formatting: alright"): New tests.
* doc/guix.texi (Invoking guix lint): Mention the 'formatting' checker.
2015-08-19 11:39:17 +02:00
David Thompson bc459b617f tests: containers: Skip if setgroups file does not exist.
Fixes bug #21226.

Linux 3.19 introduced a fix for a security vulnerability in user namespaces.
This fix introduced a new proc file called 'setgroups' and was backported to
many older kernels.  However, some users run a kernel that is new enough to
support user namespaces yet old enough to not include the patch, so we must
skip the tests.

* tests/containers.scm: Skip all tests if /proc/self/setgroups does not exist.
2015-08-11 08:30:28 -04:00
David Thompson 831bc1468e build: container: Add #:host-uids argument to call-with-container.
It's not always possible to map 65536 uids when creating a container as the
root user within another user namespace.  This is true when building Guix
within the build daemon's container.  By using a uid range of 1 by default,
even as the root user, the tests now pass.

* gnu/build/linux-container.scm (initialize-user-namespace, run-container):
  Add 'host-uids' argument.
  (call-with-container): Add #:host-uids keyword argument.
* tests/containers.scm ("container-excursion"): Update 'run-container' call.
2015-08-08 14:04:13 -04:00
Ludovic Courtès e7f5691d45 syscalls: Add 'network-interfaces', which wraps libc's 'getifaddrs'.
Based on discussions with Rohan Prinja <rohan.prinja@gmail.com>.

* guix/build/syscalls.scm (<interface>): New record type.
  (write-interface, values->interface, unfold-interface-list,
  network-interfaces, free-ifaddrs): New procedures.
  (ifaddrs): New C struct.
  (%struct-ifaddrs-type, %sizeof-ifaddrs): New macros.
* tests/syscalls.scm ("network-interfaces returns one or more interfaces",
  "network-interfaces returns \"lo\""): New tests.
2015-07-25 14:43:45 +02:00
Ludovic Courtès b89e74054e syscalls: Rename 'network-interfaces' and 'all-network-interfaces'.
* guix/build/syscalls.scm (network-interfaces): Rename to...
  (network-interface-names): ... this.
  (all-network-interfaces): Rename to...
  (all-network-interface-names): ... this.
* gnu/services/networking.scm (dhcp-client-service): Adjust accordingly.
* tests/syscalls.scm ("all-network-interfaces"): Rename to...
  ("all-network-interface-names"): ... this, and adjust accordingly.
  ("network-interfaces"): Rename to...
  ("network-interface-names"): ... this, and adjust accordingly.
2015-07-25 14:43:44 +02:00
David Thompson 8bff3d1e44 tests: Skip container tests if namespaces are not available.
* tests/containers.scm: Skip all tests if user namespaces do not exist.
2015-07-20 12:05:23 -04:00
Ludovic Courtès 72cd8ec0b1 tests: Make #:references-graphs gexp test more tolerant.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Use 'lset=' instead
  of 'equal?' since the order in which references are listed in not
  guaranteed.
2015-07-20 13:37:45 +02:00
Mark H Weaver 1b4e48d498 Merge branch 'master' into core-updates 2015-07-19 18:12:34 -04:00
Alex Kost 9cced52610 tests: Fix 'publish' test for nix-base32 format.
This is a followup to commit 3b307162e8.

* tests/publish.scm ("/*.narinfo"): Use 'bytevector->nix-base32-string',
  not 'bytevector->base32-string'.
2015-07-18 17:05:28 +03:00
Ludovic Courtès 1cab9e810e file-systems: 'uuid' raises a syntax error for invalid UUIDs.
* gnu/system/file-systems.scm (uuid): Call 'syntax-violation' when
  'string->uuid' returns #f.
* tests/file-systems.scm ("uuid, syntax error"): New test.
2015-07-16 09:49:36 +02:00
Mark H Weaver 35995769b5 Merge branch 'master' into core-updates 2015-07-15 15:10:32 -04:00
Ludovic Courtès 661a1d7924 file-systems: Allow users to specify file system UUIDs as strings.
Fixes <http://bugs.gnu.org/19778>.
Reported by Mark H Weaver <mhw@netris.org>.

* gnu/system/file-systems.scm (%uuid-rx): New variable.
  (string->uuid): New procedure.
  (uuid): New macro.
* tests/file-systems.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
* doc/guix.texi (File Systems): Give an example of UUID.
2015-07-14 15:24:20 +02:00
Ludovic Courtès 24f5aaaf24 substitute: Honor "substitute-urls" option passed by "untrusted" clients.
* guix/scripts/substitute.scm (or*): New macro.
  (%cache-url): Honor "untrusted-substitute-urls".
* guix/tests.scm (%test-substitute-urls): New variable.
  (open-connection-for-tests): Use it.
* tests/derivations.scm ("derivation-prerequisites-to-build and substitutes",
  "derivation-prerequisites-to-build and substitutes, non-substitutable
  build", "derivation-prerequisites-to-build and substitutes, local build"):
  Pass it to 'set-build-options'.
* tests/guix-daemon.sh: Likewise.
* tests/store.scm ("substitute query, alternating URLs"): New test.
  ("substitute query", "substitute", "substitute + build-things with output
  path", "substitute, corrupt output hash", "substitute --fallback"): Pass
  #:substitute-urls to 'set-build-options'.
2015-07-13 18:29:01 +02:00
Ludovic Courtès 895d1eda54 substitute: Store cached narinfo in cache-specific sub-directories.
This ensures that switching between different substitute servers doesn't lead
to a polluted narinfo cache.

* guix/scripts/substitute.scm (narinfo-cache-file): Add 'cache-url'
  parameter.  Add the base32 of CACHE-URL as a sub-directory under
  %NARINFO-CACHE-DIRECTORY.  Update callers.
  (cached-narinfo): Likewise.  Call 'mkdir-p' on the dirname of the cache
  file.  Update callers.
  (remove-expired-cached-narinfos): Add 'directory' parameter and use it
  instead of %NARINFO-CACHE-DIRECTORY.
  (narinfo-cache-directories): New procedure.
  (maybe-remove-expired-cached-narinfo): Call 'remove-expired-cached-narinfos'
  for each item returned by 'narinfo-cache-directories'.
2015-07-13 18:29:01 +02:00
Ludovic Courtès 161094c8e2 packages: Rewrite 'transitive-inputs' to be linear and remove duplicates.
There were two issues:

  1. Use of 'delete-duplicates', which is quadratic, was a serious problem for
     closures with lots of propagated inputs, such as that of the 'hydra'
     package (several minutes for 'guix build hydra -n'!).

  2. The 'delete-duplicates' call essentially had no effect since duplicate
     inputs typically had a different label and were thus kept.  For
     instance, (bag-transitive-inputs (package->bag inkscape)) would return
     216 items whereas (delete-duplicates (map cdr THAT)) contains only 67
     items.

     The new implementation returns 67 items in this case.  For 'hydra', we're
     down from 42211 items to 361, and roughly 13s for 'guix build hydra'.

* guix/packages.scm (transitive-inputs): Rewrite as a breadth-first
  traversal.  Remove duplicate propagated inputs.
* tests/packages.scm ("package-transitive-inputs", "package->bag, propagated
  inputs"): Adjust to use simple labels for propagated inputs, without "/".
  ("package-transitive-inputs, no duplicates"): New test.
2015-07-12 01:27:00 +02:00
Ludovic Courtès 686784d0b9 tests: Adjust tests for new bootstrap Guile.
This is a followup to commit 5d6792f ("gnu: bootstrap: Create a wrapper for
guile to set the system load path.")

* tests/size.scm ("store-profile"): Expect profile of 'bash' bootstrap binary.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Expect GUILE-DRV to
  depend on 'bash' bootstrap binary.
2015-07-12 01:27:00 +02:00
Ludovic Courtès b62a3ebcdd tests: Skip namespace-related tests when that feature is missing.
* tests/syscalls.scm ("clone", "setns", "pivot-root"): Skip
  unless (user-namespace (getpid)) exists.
2015-07-10 23:46:52 +02:00
David Thompson c1f6a0c2ed gnu: build: Add Linux container module.
* gnu/build/linux-container.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* .dir-locals.el: Add Scheme indent rules for 'call-with-container', and
  'container-excursion'.
* tests/containers.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
2015-07-09 08:23:03 -04:00
Ludovic Courtès 80ea7526db tests: Use the right identifier in tests/elpa.scm.
* tests/elpa.scm: Change 'nil->empty' to 'ensure-list' in the whole file.
2015-07-08 15:30:49 +02:00
Federico Beffa 7f74a931dd import: Add 'elpa' importer.
* guix/import/elpa.scm: New file.
* guix/scripts/import.scm: Add "elpa" to 'importers'.
* guix/scripts/import/elpa.scm: New file.
* Makefile.am (MODULES): Add 'guix/import/elpa.scm' and
  'guix/scripts/import/elpa.scm'.
  (SCM_TESTS): Add 'tests/elpa.scm'.
* doc/guix.texi (Invoking guix import): Document it.
* tests/elpa.scm: New file.
* po/guix/POTFILES.in: Add 'guix/scripts/import/elpa.scm'.
2015-07-08 10:53:05 +02:00
David Thompson df3ce5c123 build: syscalls: Add pivot-root.
* guix/build/syscalls.scm (pivot-root): New procedure.
* tests/syscalls.scm ("pivot-root"): New test.
2015-07-07 21:16:25 -04:00
David Thompson 43ace6ea76 build: syscalls: Add setns.
* guix/build/syscalls.scm (setns): New procedure.
* tests/syscalls.scm ("setns"): New test.

squash: setns
2015-07-07 20:55:09 -04:00