Commit graph

867 commits

Author SHA1 Message Date
Ludovic Courtès deac976d3d
daemon: Client settings no longer override daemon settings.
Fixes <http://bugs.gnu.org/20217>.

* nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x161.
* nix/nix-daemon/nix-daemon.cc (performOp): "build-max-jobs",
"build-max-silent-time", and "build-cores" are no longer read upfront;
instead, read them from the key/value list at the end.
* nix/nix-daemon/guix-daemon.cc (main): Explicitly set
'settings.maxBuildJobs'.
* guix/store.scm (%protocol-version): Bump to #x161.
(set-build-options): #:max-build-jobs, #:max-silent-time, and
 #:build-cores now default to #f.  Adjust handshake to new protocol.
* tests/store.scm ("build-cores"): New test.
* tests/guix-daemon.sh: Add test for default "build-cores" value.
2017-01-15 15:43:22 +01:00
Ludovic Courtès 4d8e95097e
challenge: Return comparison reports instead of just discrepancies.
This makes it easier to distinguish between matches, mismatches, and the
various cases of inconclusive reports.

* guix/scripts/challenge.scm (<discrepancy>): Rename to...
(<comparison-report>): ... this.  Add 'result' field.
(comparison-report): New macro.
(comparison-report-predicate, comparison-report-mismatch?)
(comparison-report-match?)
(comparison-report-inconclusive?): New procedures.
(discrepancies): Rename to...
(compare-contents): ... this.  Change to return a list of
<comparison-report>.  Remove calls to 'warning'.
(summarize-discrepancy): Rename to...
(summarize-report): ... this.  Adjust to <comparison-report>.
(guix-challenge): Likewise.
* tests/challenge.scm ("no discrepancies")
("one discrepancy"): Adjust to new API.
("inconclusive: no substitutes")
("inconclusive: no local build"): New tests.
2017-01-14 00:57:51 +01:00
Ludovic Courtès 9b5364a3af
daemon: Allow check builds of 'builtin:download' derivations.
Fixes <http://bugs.gnu.org/25089>.
Reported by Leo Famulari <leo@famulari.name>.

* nix/libstore/build.cc (DerivationGoal::runChild): In the 'isBuiltin'
case, check whether DRV's output is in 'redirectedOutputs', and pass an
'output' argument to the built-in builder.
(DerivationGoal::addHashRewrite): Add 'printMsg' call.
* nix/libstore/builtins.hh (derivationBuilder): Add 'output' parameter.
* nix/libstore/builtins.cc (builtinDownload): Likewise.
Add OUTPUT to ARGV.
* guix/scripts/perform-download.scm (perform-download): Add 'output'
parameter.
(guix-perform-download): Adjust 'match' clauses accordingly.
* tests/derivations.scm ("'download' built-in builder, check mode"): New
test.
2017-01-11 17:06:31 +01:00
Ludovic Courtès aa042770da
guix package: Fix version and output for 'guix package -i /gnu/store/…'.
* guix/utils.scm (package-name->name+version): Add optional 'delimiter'
parameter.
* guix/scripts/package.scm (store-item->manifest-entry): Pass #\- as the
delimiter for 'package-name->name+version'.  Use "out" instead of #f for
the 'output' field.
* tests/guix-package.sh: Add test.
2017-01-11 11:58:21 +01:00
Ludovic Courtès b96a0640a3
graph: Add '%reverse-package-node-type'.
* guix/scripts/graph.scm (%reverse-package-node-type): New variable.
(%node-types): Add it.
* tests/graph.scm ("reverse package DAG"): New test.
* doc/guix.texi (Invoking guix refresh): Add cross-reference to
"Invoking guix graph".
(Invoking guix graph): Document 'reverse-package'.
2017-01-04 16:18:53 +01:00
Ludovic Courtès 5e2e4a51f9
gexp: Support 'ungexp' forms in improper lists.
* guix/gexp.scm (gexp)[collect-escapes, substitute-references]: Replace
the (exp0 exp ...) patterns with (exp0 . exp) to match improper lists.
Adjust clause bodies accordingly.
* tests/gexp.scm ("one input package, dotted list"): New test.
2017-01-01 23:30:30 +01:00
David Craven f1d136957d
build-system: cargo: Handle Cargo.lock file not present.
* guix/build-system/cargo.scm (cargo-build): Add src output.
  (private-keywords): Add #:outputs.
* guix/build/cargo-build-system.scm (configure): Use /share/rust-source
  when replacing inputs.
  (build, check): Don't do anything when there isn't a Cargo.lock file
  present.
  (install): Install sources to src output. When a Cargo.lock file is
  present use cargo install to install binaries to out.
* guix/import/crate.scm (make-crate-sexp): Importer uses the src output
  for crate inputs by default.
* guix/import/utils.scm (package-names->package-inputs, maybe-inputs,
  maybe-native-inputs): Take an optional output argument.
* tests/crate.scm (crate->guix-package test): Update.

Problem reported by Francisco Gómez García <espectalll@kydara.com>.
2017-01-01 18:20:52 +01:00
David Craven f53a5514e0
import: crate: Provide a default home-page value.
* guix/import/crate.scm (make-crate-sexp): Provide a default home-page
  value.
* tests/crate.scm (test-crate): Add repository field.

Problem reported by ng0 <ng0@libertad.pw>.
2017-01-01 18:12:06 +01:00
Ludovic Courtès 7c247809ef
guix build: '--with-source' overrides the 'replacement' of a package.
* guix/scripts/build.scm (package-with-source): Set 'replacement' to #f.
* tests/scripts-build.scm ("options->transformation, with-source,
replacement"): New test.
2016-12-21 23:48:14 +01:00
Ludovic Courtès f943c317fb
environment: Add '--root' option.
* guix/scripts/environment.scm (show-help, %options): Add --root.
(register-gc-root): New procedure.
(guix-environment): Call 'register-gc-root' when OPTS has a 'gc-root'
option.
* doc/guix.texi (Invoking guix environment): Document it.
* tests/guix-environment.sh: Add tests.
2016-12-20 19:14:41 +01:00
Ludovic Courtès 5b14a7902c
gexp: Native inputs of nested gexps are properly accounted for.
Previously, 'gexp-native-inputs' would not return the native inputs of
nested gexps.  For example, this:

  (gexp-native-inputs #~(foo #$#~(bar #+coreutils)))

would return '().

* guix/gexp.scm (gexp-inputs)[add-reference-inputs]: In the
non-recursive cases, check whether N? and NATIVE? are the same, and act
accordingly.
[native-input?]: Remove.
Fold over all of (gexp-references exp).
* tests/gexp.scm ("ungexp + ungexp-native, nested, special mixture"):
New test.
* tests/gexp.scm ("input list splicing + ungexp-native-splicing"): Pass
 #:native? #t to 'gexp-input'.
2016-12-19 17:51:00 +01:00
Ricardo Wurmus 662a1aa6b0
tests: Mock up http-fetch.
This is a follow-up to commit 63773200d7.

* tests/cpan.scm ("cpan->guix-package"): Add mock definition of
http-fetch.
2016-12-18 13:39:21 +01:00
Ricardo Wurmus e69c1a5446
tests: Adjust cpan tests.
This is a follow-up to commit ff55fe5599.

* tests/cpan.scm (source-url-http, source-url-https): Use
cpan-source-url.
2016-12-18 13:39:20 +01:00
Ricardo Wurmus 239f46325d
tests: Mock up http-fetch in import test.
This is a follow-up to commit 63773200d7.

* tests/pypi.scm ("pypi->guix-package, wheels"): Add mock definition of
"http-fetch".
2016-12-18 10:54:11 +01:00
Ricardo Wurmus 506abddb99
tests: Mock up http-fetch in import tests.
This is a follow-up to commit 63773200d7.

* tests/gem.scm ("gem->guix-package"): Replace mock definition of
"url-fetch" with "http-fetch".
* tests/pypi.scm ("pypi->guix-package"): Add mock definition of
"http-fetch".
2016-12-18 09:55:17 +01:00
Ludovic Courtès a6562c7e20
profiles: Remove dependency on 'glibc-utf8-locales' for tests.
Commit 1af0860e8b added a mandatory
dependency on 'glibc-utf8-locales', which entails long rebuilds for
tests.

* guix/profiles.scm (profile-derivation): Add #:locales? parameter.
Add 'set-utf8-locale' variable.  Use it when LOCALES? is true.
(link-to-empty-profile): Pass #:locales? #f.
* guix/scripts/environment.scm (inputs->profile-derivation): Pass
  #:locales?.
* guix/scripts/package.scm (build-and-use-profile): Likewise.
* tests/packages.scm ("--search-paths with pattern"): Pass #:locales? #f.
* tests/profiles.scm ("profile-derivation")
("profile-derivation, inputs", "profile-manifest, search-paths")
("etc/profile", "etc/profile when etc/ already exists"):
("etc/profile when etc/ is a symlink"): Likewise.
2016-12-17 14:46:42 +01:00
Ricardo Wurmus 51377437a1
graph: Backend must have name and description.
* guix/graph.scm (<graph-backend>): Add fields "name" and "description".
(%graphviz-backend): Provide values for name and description.
(export-graph): Ignore name and description when matching backends.
(graph-backend-name, graph-backend-description): New procedures.
* tests/graph.scm (make-recording-backend): Initialize name and
description fields of test graph-backend.
2016-12-14 21:43:06 +01:00
David Craven 3e0c036584
import: Add importer for rust crates.
* guix/import/crate.scm: New file.
* guix/scripts/import/crate.scm: New file.
* guix/scripts/import.scm (importers): Add crate importer.
* tests/crate.scm: New file.
* doc/guix.texi: Add crate importer to table.
* Makefile.am (MODULES, SCM_TESTS): Add files.
2016-12-14 16:30:42 +01:00
Ludovic Courtès 13d5e8dae5
store: 'open-connection' no longer raises '&nar-error' for protocol errors.
* guix/store.scm (open-connection): Guard body against 'nar-error?' and
re-raise as '&nix-connection-error'.
* tests/store.scm ("connection handshake error"): New test.
2016-12-08 23:12:11 +01:00
Leo Famulari de32aa74b4
Merge branch 'master' into python-build-system 2016-11-25 11:20:21 -05:00
Ludovic Courtès 9e38e3cf52
syscalls: Add 'add-network-route/gateway' and 'delete-network-route'.
* guix/build/syscalls.scm (SIOCADDRT, SIOCDELRT): New variables.
(%rtentry): New C struct.
(RTF_UP, RTF_GATEWAY, %sockaddr-any): New variables.
(add-network-route/gateway, delete-network-route): New procedures.
* tests/syscalls.scm ("add-network-route/gateway")
("delete-network-route"): New tests.
2016-11-21 00:34:48 +01:00
Ludovic Courtès fac46e3f5e
lint: Add 'mirror-url' checker.
* guix/scripts/lint.scm (origin-uris): New procedure.
(check-source): Use it.
(check-mirror-url): New procedure.
(%checkers): Add 'mirror-url' checker.
* tests/lint.scm ("mirror-url")
("mirror-url: one suggestion"): New tests.
* doc/guix.texi (Invoking guix lint): Document it.
2016-11-19 18:44:53 +01:00
Ludovic Courtès e74f64b9e5
store: Add 'references*'.
* guix/store.scm (references*): New procedure.
* guix/profiles.scm (manifest-lookup-package)[references*]: Remove.
* guix/scripts/system.scm (references*): Remove.
* tests/gexp.scm ("gexp->file", "gexp->file + file-append")
("gexp->derivation", "gexp->derivation, cross-compilation")
("gexp->derivation, ungexp + ungexp-native")
("scheme-file", "text-file*", "mixed-text-file"): Remove 'references*'
instead of (store-lift references).
2016-11-19 18:44:53 +01:00
Ludovic Courtès 67e5f3b71d
syscalls: Add bindings for SIOCGIFNETMASK and SIOCSIFNETMASK.
* guix/build/syscalls.scm (SIOCGIFNETMASK, SIOCSIFNETMASK): New
variables.
(set-network-interface-netmask, network-interface-netmask): New
procedures.
* tests/syscalls.scm ("network-interface-netmask lo")
("set-network-interface-netmask"): New tests.
2016-11-16 23:38:06 +01:00
Ludovic Courtès f9aefa2d5f
daemon: Add 'built-in-builders' RPC.
* nix/libstore/builtins.cc (builtinBuilderNames): New function.
* nix/libstore/builtins.hh (builtinBuilderNames): New declaration.
* nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x160.
(WorkerOp)[wopBuiltinBuilders]: New value.
* nix/nix-daemon/nix-daemon.cc (performOp): Handle it.
* guix/store.scm (operation-id)[built-in-builders]: New value.
* guix/store.scm (read-arg): Add 'string-list'.
(built-in-builders): New procedure.
* tests/derivations.scm ("built-in-builders"): New test.
2016-11-16 18:19:54 +01:00
Ludovic Courtès 94d92c7796
daemon: Add "builtin:download" derivation builder.
This ensures that 1) the derivation doesn't change when Guix changes;
2) the derivation closure doesn't contain Guix and its dependencies; 3)
we don't have to rely on ugly chroot hacks.

Adapted from Nix commit 0a2bee307b20411f5b0dda0c662b1f9bb9e0e131.

* nix/libstore/build.cc (DerivationGoal::runChild): Add special case for
'isBuiltin(drv)'.  Disable chroot when 'isBuiltin(drv)'.
* nix/libstore/builtins.cc, nix/libstore/builtins.hh,
nix/scripts/download.in, guix/scripts/perform-download.scm: New files.
* guix/ui.scm (show-guix-help)[internal?]: Add 'perform-download'.
* nix/local.mk (libstore_a_SOURCES): Add builtins.cc.
(libstore_headers): Add builtins.hh.
(nodist_pkglibexec_SCRIPTS): Add 'scripts/download'.
* config-daemon.ac: Emit 'scripts/download'.
* Makefile.am (MODULES): Add 'guix/scripts/perform-download.scm'.
* tests/derivations.scm ("unknown built-in builder")
("'download' built-in builder")
("'download' built-in builder, invalid hash")
("'download' built-in builder, not found")
("'download' built-in builder, not fixed-output"): New tests.

Co-authored-by: Eelco Dolstra <eelco.dolstra@logicblox.com>
2016-11-16 18:19:47 +01:00
Ludovic Courtès 17ab08bcf0
tests: Move HTTP server to (guix tests http).
* tests/lint.scm (%http-server-port, %local-url)
(%http-server-socket, http-write, %http-server-lock)
(%http-server-ready, http-open, stub-http-server)
(call-with-http-server, with-http-server): Move to (guix tests http).
Adjust tests for %HTTP-SERVER-SOCKET as a promise and %LOCAL-URL as a
parameter.
* guix/tests/http.scm: New file.
* Makefile.am (dist_noinst_DATA): Add it.
(GOBJECTS): Add .go files for all of $(dist_noinst_DATA).
(make-go): Depend on $(dist_noinst_DATA).
2016-11-16 18:00:41 +01:00
Ludovic Courtès 1bcc87bb68
guix download: Add '-o' option.
* guix/scripts/download.scm (download-to-file, download-to-store*): New
procedures.
(%default-options): Add 'download-proc'.
(show-help): Adjust description and document '-o'.
(%options): Add '-o'.
(guix-download): Remove 'store' variable.  Add 'fetch' and define 'path'
to as its result.
* tests/guix-download.sh: Add test.
2016-11-16 18:00:41 +01:00
Hartmut Goebel 891a843d51
guix: Add lint-checker for packages which should be no inputs at all.
Also refactor some common code into a new function.

Examples for these pacakges are python(2)-setuptools and python(2)-pip, which
are installed together with python itself.

* guix/scripts/lint.scm (warn-if-package-has-input): New procedure.
  (check-inputs-should-be-native package): Use it; rename and clean-up
  variables. (check-inputs-should-not-be-an-input-at-all): New procedure.
  (%checkers) Add it.
* doc/guix.texi (Python Modules): Document it.
* tests/lint.scm: ("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)"): Add tests.
2016-11-15 17:37:49 +01:00
Andy Patterson a24b56fa8d
tests: Don't check file-systems in container tests.
Hello,

The containers test was hanging for me, and this patch fixed the
problem.

--
Andy

From 945ad44acf489b7f3a398d4ab739ec2b48477502 Mon Sep 17 00:00:00 2001
From: Andy Patterson <ajpatter@uwaterloo.ca>
Date: Sat, 12 Nov 2016 22:10:01 -0500
Subject: [PATCH] tests: Don't check file-systems in container tests.

* tests/containers.scm ("call-with-container, mnt namespace"): Don't
check file-system in 'call-with-container' call.
* tests/containers.scm
("call-with-container, mnt namespace, wrong bindmount"): Likewise.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-11-13 13:04:00 +01:00
Ludovic Courtès 2cab1dd58b
Merge branch 'core-updates' 2016-11-13 00:34:16 +01:00
Ludovic Courtès 5970e8e248
container: Pass a list of <file-system> objects as things to mount.
* gnu/build/linux-container.scm (mount-file-systems): 'mounts' is now a
list of <file-system> objects instead of a list of lists ("specs").
Add call to 'file-system->spec' as the argument to 'mount-file-system'.
(run-container, call-with-container): Adjust docstring accordingly.
* gnu/system/file-systems.scm (spec->file-system): New procedure.
* gnu/system/linux-container.scm (container-script)[script]: Call
'spec->file-system' inside gexp.
* guix/scripts/environment.scm (launch-environment/container): Remove
call to 'file-system->spec'.
* tests/containers.scm ("call-with-container, mnt namespace")
("call-with-container, mnt namespace, wrong bind mount"): Pass a list of
<file-system> objects.
2016-11-10 18:01:44 +01:00
Ludovic Courtès 324a2ba56c
tests: Adjust 'url-fetch' mocks to TLS changes.
This is a followup to bc3c41ce36.

* tests/cpan.scm ("cpan->guix-package"): Add #:verify-certificate?
parameter in 'url-fetch' mock.
* tests/cran.scm ("description->package"): Likewise.
2016-11-10 11:58:43 +01:00
Ludovic Courtès b66d6d52cc
tests: Fix 'fold-packages' for hidden packages.
* tests/packages.scm ("fold-packages, hidden package"): Expect
GUILE-2.0, not GUILE-2.0/FIXED.  This is a followup to
c62a31ca80.
2016-11-08 23:32:41 +01:00
Leo Famulari 062c7e43ed
Merge branch 'master' into core-updates 2016-10-29 21:44:44 -04:00
Ludovic Courtès 343dc11702
guix hash: Interpret '-' as standard input.
* guix/scripts/hash.scm (guix-hash)[file-hash]: Special-case "-".
* tests/guix-hash.sh: Add test.
* doc/guix.texi (Invoking guix hash): Document it.
2016-10-28 22:30:17 +02:00
Mark H Weaver 3d82676919
Merge branch 'master' into core-updates 2016-10-27 20:21:26 -04:00
Ludovic Courtès d6aca5835a
tests: Adjust pypi test to recent importer change.
This is a followup to b5c347ad3d.

* tests/pypi.scm ("pypi->guix-package"): Expect 'propagated-inputs', not
'inputs'.
("pypi->guix-package, wheels"): Likewise.
2016-10-27 01:00:41 +02:00
Ludovic Courtès a91d75ecbd
tests: Skip 'pivot-root' test on Linux > 4.7.5.
* tests/syscalls.scm ("pivot-root"): Skip when 'uname' returns a
'utsname:release' > 4.7.5.
2016-10-27 01:00:41 +02:00
Mark H Weaver d2478b4cdd
Merge branch 'master' into core-updates 2016-10-19 10:54:36 -04:00
Ludovic Courtès fe9bdb581e
tests: Make sure child process of 'pivot-root' test exits.
* tests/syscalls.scm ("pivot-root"): Use 'test-equal'.  Wrap child body
in 'dynamic-wind'.
2016-10-19 15:54:11 +02:00
Ludovic Courtès 0d7034ca4f
tests: Fix typo in 'with-graft' transformation test.
This is a followup to 645b9df858.

* tests/scripts-build.scm ("options->transformation, with-graft"): Use
'with-graft', not 'with-input'.
2016-10-19 15:54:10 +02:00
Ludovic Courtès 4bb54cc42f
lint: Suggest @code instead of quotes.
* guix/scripts/lint.scm (%quoted-identifier-rx): New variable.
(check-description-style)[check-quotes]: New procedure.
Use it.
* tests/lint.scm ("description: suggest ornament instead of quotes"):
New test.
2016-10-19 15:54:10 +02:00
Ludovic Courtès 7fee5b5397
container: Allow 'container-excursion' to the same namespaces.
Before that, 'container-excursion' would call 'setns' even when the
target namespace is the one the caller is already in, which would fail.

* gnu/build/linux-container.scm (container-excursion): Introduce
'source' and 'target'.  Compare the result of 'readlink' on these
instead of comparing file descriptors to decide whether to call
'setns'.
* tests/containers.scm ("container-excursion, same namespace"): New test.
2016-10-19 15:54:10 +02:00
Ludovic Courtès 3d47aa81ba
grafts: Apply the right grafts in the presence of multiple outputs.
Fixes <http://bugs.gnu.org/24712>.

* guix/grafts.scm (cumulative-grafts): Add grafts for all the outputs of
DRV.
* tests/grafts.scm ("graft-derivation, replaced derivation has multiple
outputs"): New test.
2016-10-17 23:59:03 +02:00
Ludovic Courtès 645b9df858
guix build: Add '--with-graft'.
* guix/scripts/build.scm (transform-package-inputs/graft): New procedure.
(%transformations): Add 'with-graft'.
(%transformation-options): Likewise.
(show-transformation-options-help): Document it.
* tests/scripts-build.scm ("options->transformation, with-graft"): New
test.
* doc/guix.texi (Package Transformation Options): Document it.
2016-10-17 23:59:02 +02:00
Mark H Weaver dcaf70897a
Merge branch 'master' into core-updates 2016-10-17 16:47:12 -04:00
Ludovic Courtès 7f8fec0fa4
graph: Add '%referrer-node-type'.
* guix/scripts/graph.scm (ensure-store-items): New procedure.
(%reference-node-type)[convert]: Use it.
(non-derivation-referrers): New procedure.
(%referrer-node-type): New variable.
(%node-types): Add it.
* tests/graph.scm ("referrer DAG"): New test.
* doc/guix.texi (Invoking guix graph): Document it.
2016-10-15 23:46:39 +02:00
Ludovic Courtès b013c33f6f
grafts: 'graft-derivation' does now introduce grafts that shadow other grafts.
Partly fixes <http://bugs.gnu.org/24418>.

* guix/grafts.scm (cumulative-grafts)[graft-origin?]: New procedure.
[dependency-grafts]: Use it in new 'if' around recursive call.
* tests/grafts.scm ("graft-derivation, grafts are not shadowed"): New test.
2016-10-14 23:31:50 +02:00
Ludovic Courtès d0025d0144
packages: 'package-grafts' applies grafts on replacement.
Partly fixes <http://bugs.gnu.org/24418>.

* guix/packages.scm (input-graft): Compute 'new' with #:graft? #t.
(input-cross-graft): Likewise.
* tests/packages.scm ("package-grafts, indirect grafts, cross"): Comment
out.
("replacement also grafted"): New test.
2016-10-14 23:05:41 +02:00
Mark H Weaver abcf4858cd
Merge branch 'master' into core-updates 2016-10-12 09:28:14 -04:00
Eric Bavier b8b129ebd8
utils: Support defaults in substitute-keyword-arguments.
* guix/utils.scm (collect-default-args, expand-default-args): New
syntax.
(substitute-keyword-arguments): Allow default value declarations.
* tests/utils.scm (substitute-keyword-arguments): New test.
2016-10-07 07:42:05 -05:00
Eric Bavier 347df60158
utils: Fix default-keyword-arguments.
* guix/utils.scm (default-keyword-arguments): Properly test for present
keywords.
* tests/utils.scm (default-keyword-arguments): New test.
2016-10-07 07:41:57 -05:00
Leo Famulari b19c7989b7
Merge branch 'master' into core-updates 2016-10-05 19:15:25 -04:00
Ludovic Courtès 9bee2bd1b0
lint: 'cve' checker reports the replacement's vulnerabilities.
Before, 'guix lint -c cve' would report the vulnerabilities of the
original package while pretending they are the vulnerabilities of the
replacement.

* guix/scripts/lint.scm (check-vulnerabilities): Consider the package
replacement before calling 'package-vulnerabilities'.
* tests/lint.scm ("cve: vulnerability fixed in replacement version"):
New test.
2016-10-03 23:30:49 +02:00
Ludovic Courtès 57bdd79e48
grafts: Allow the replacement to have a different name.
* guix/build/graft.scm (replace-store-references): REPLACEMENT is now
the full string, not just the hash.
(rewrite-directory)[hash-mapping](valid-suffix?): Remove.
(hash+suffix): Rename to...
(hash+rest): ... this.  Change to return the whole string as the second
element of the list.  Adjust 'match-lambda' expression accordingly;
check whether the string length of the origin and replacement match.
* tests/grafts.scm ("graft-derivation, grafted item uses a different
name"): New test.
* doc/guix.texi (Security Updates): Update sentence on the name/version
restriction.
2016-10-03 23:16:48 +02:00
Leo Famulari 9c2130757c
Merge branch 'master' into core-updates 2016-10-03 17:08:05 -04:00
Ludovic Courtès d223ac4acc
tests: Adjust 'guix build -S' test for source-less packages.
This is a followup to 8a54c0ec69.

* tests/guix-build.sh: Allow 'guix build -S' to succeed with source-less
packages.  Check that the result is the empty string.
2016-10-03 15:24:21 +02:00
Ludovic Courtès 79355ae3e8
Merge branch 'master' into core-updates 2016-09-30 12:05:27 +02:00
David Craven 11e296ef30
import: utils: Refactor license->symbol.
* guix/import/utils.scm (license->symbol): Work for all licenses.
* tests/import-utils.scm (license->symbol): Add test.
2016-09-28 13:17:15 +02:00
Ludovic Courtès a9e5e92f94
gexp: Add 'file-append'.
* guix/gexp.scm (<file-append>): New record type.
(file-append): New procedure.
(file-append-compiler): New gexp compiler.
* tests/gexp.scm ("file-append", "file-append, output")
("file-append, nested", "gexp->file + file-append"): New tests.
* doc/guix.texi (G-Expressions): Use it in 'nscd' and 'list-files'
examples.  Document 'file-append'.
2016-09-09 23:54:43 +02:00
Ludovic Courtès b14a838509
utils: 'wrap-program' produces only one wrapper file.
* guix/build/utils.scm (wrap-program)[wrapper-file-name]
[next-wrapper-number, wrapper-target]: Remove.
[wrapped-file, already-wrapped?]: New variables.
[last-line]: New procedure.
Use it to append to PROG when a wrapper already exists.
* tests/build-utils.scm ("wrap-program, one input, multiple calls"):
Adjust the list of files to delete.
2016-09-07 23:59:02 +02:00
Jan Nieuwenhuizen 392a4e1223
guix hash: Add --exclude-vcs option.
* guix/scripts/hash.scm (show-help): Add help text for --exclude-vcs option.
(%options): Add --exclude-vcs option.
(guix-hash): Handle exclude-vcs option.
* doc/guix.texi ("Invoking guix hash"): Update doc.
* tests/guix-hash.sh: Add test.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2016-09-07 12:00:35 +02:00
Ludovic Courtès 01afdab89c
packages: Add 'package-superseded' and associated support.
This provides a way to mark a package as superseded by another one.
Upgrades replace superseded packages with their replacement.

* guix/packages.scm (package-superseded, deprecated-package): New
procedures.
* gnu/packages.scm (%find-package): Check for 'package-superseded'.
* guix/scripts/package.scm (transaction-upgrade-entry)[supersede]: New
procedure.  Call it when 'package-superseded' is true.
* tests/guix-build.sh: Add test for a superseded package.
* tests/packages.scm ("package-superseded")
("transaction-upgrade-entry, superseded package"): New tests.
2016-09-06 23:22:10 +02:00
Ludovic Courtès 5239f3d908
guix package: Build up the transaction incrementally.
* guix/scripts/package.scm (upgraded-manifest-entry): Rename to...
(transaction-upgrade-entry): ... this.  Add 'transaction' parameter and
return a transaction.
(options->installable): Likewise.
[to-upgrade]: Rename to...
[upgraded]: ... this, and change to be a transaction.  Return a
transaction.
(options->removable): Likewise.
(process-actions): Adjust accordingly.
* tests/packages.scm ("transaction-upgrade-entry, zero upgrades")
("transaction-upgrade-entry, one upgrade"): New tests.
2016-09-06 23:22:10 +02:00
Ludovic Courtès c8c25704ae
profiles: Add manifest-transaction helper procedures.
* guix/profiles.scm (manifest-transaction-install-entry)
(manifest-transaction-remove-pattern)
(manifest-transaction-null?): New procedures.
* tests/profiles.scm ("manifest-transaction-null?"): New test.
2016-09-06 23:22:10 +02:00
Ludovic Courtès 7ca87354db
Add (guix modules).
* guix/modules.scm, tests/modules.scm: New files.
* Makefile.am (MODULES, SCM_TESTS): Add them.
* doc/guix.texi (G-Expressions): Add an example of
'source-module-closure'.
2016-09-05 00:06:47 +02:00
Ludovic Courtès 072e10615f
Merge branch 'master' into core-updates 2016-09-02 15:39:50 +02:00
Ludovic Courtès 7370c02148
tests: Test 'wrap-program' without building a package.
* tests/build-utils.scm (%store): Remove.
("wrap-program, one input, multiple calls"): Rewrite without resorting
to packages and derivations.
2016-09-02 15:39:10 +02:00
Ludovic Courtès 2a75b0b63d
packages: Add 'package-input-rewriting'.
* guix/packages.scm (package-input-rewriting): New procedure.
* tests/packages.scm ("package-input-rewriting"): New test.
* doc/guix.texi (Defining Packages): Document it.
(Package Transformation Options): Add cross-reference.
2016-09-01 23:07:54 +02:00
Efraim Flashner 7060b28171
tests: hackage: Fix mock urls.
Followup to 18f7473504.

* tests/hackage.scm (hackage->guix-package): Use 'https' in mock urls.
2016-09-01 13:40:49 +03:00
Eric Bavier 83ab1a812f
tests: cpan: Fix mock urls.
Followup to 7a62263ee5.

* tests/cpan.scm (cpan->guix-package): Use "https" in mock urls.
2016-08-31 09:58:39 -05:00
Ludovic Courtès 7b44cae50a
services: shepherd: Add 'shepherd-service-upgrade', from 'guix system'.
* guix/scripts/system.scm (service-upgrade): Move to...
* gnu/services/shepherd.scm (shepherd-service-upgrade): ... here.
* tests/system.scm ("service-upgrade: nothing to do", "service-upgrade:
one unchanged, one upgraded, one new", "service-upgrade: service
depended on is not unloaded", "service-upgrade: obsolete services that
depend on each other"): Move to...
* tests/services.scm: ... here.  Adjust to 'service-upgrade' rename.
2016-08-31 15:44:20 +02:00
Ludovic Courtès d4f8884fdb
guix system: Do not unload services depended on.
Reported by Mark H Weaver <mhw@netris.org>
at <https://lists.gnu.org/archive/html/guix-devel/2016-08/msg01470.html>.

* guix/scripts/system.scm (service-upgrade)[live-service-required?]: New
procedure.
[obsolete?]: Use it.
* tests/system.scm ("service-upgrade: service depended on is not
unloaded", "service-upgrade: obsolete services that depend on each
other"): New tests.
2016-08-31 15:44:20 +02:00
Ludovic Courtès f20a7b8696
guix system: Use 'shepherd-service-lookup-procedure' in 'service-upgrade'.
* guix/scripts/system.scm (service-upgrade)[essential?]: SERVICE is now
a <live-service>.
[lookup-target, lookup-live, running?, stopped, obsolete?]: New
procedures.
[to-load, to-unload]: Use them.  TO-UNLOAD is now a list of
<live-service>.
(call-with-service-upgrade-info): Extract symbols from TO-UNLOAD.
* tests/system.scm ("service-upgrade: one unchanged, one upgraded, one
new"): Adjust accordingly.
2016-08-31 15:44:20 +02:00
Ludovic Courtès a5d78eb64b
services: shepherd: Add 'shepherd-service-lookup-procedure'.
* gnu/services/shepherd.scm (shepherd-service-lookup-procedure): New
procedure.
(shepherd-service-back-edges)[provision->service]: Use it.
* tests/services.scm ("shepherd-service-lookup-procedure"): New test.
2016-08-31 15:44:20 +02:00
Ludovic Courtès b8692e4696
guix system: Extract and test the service upgrade procedure.
* guix/scripts/system.scm (service-upgrade): New procedure, with code
from...
(call-with-service-upgrade-info): ... here.  Use it.
* tests/system.scm (live-service, service-upgrade): New variables.
("service-upgrade: nothing to do", "service-upgrade: one unchanged, one
upgraded, one new"): New tests.
2016-08-31 15:44:20 +02:00
Eric Bavier 83f18e0653
guix: lint: Check descriptions for trademark signs.
* guix/scripts/lint.scm (check-description-style): Emit a warning if
trademark signs found in description.
* tests/lint.scm (description: may not contain trademark signs): Add
test.
2016-08-28 23:24:18 -05:00
Ludovic Courtès 7cdec6a90a
tests: Fix 'guix environment --container' test in the presence of tmpfs.
Reported by Ting-Wei Lan <lantw44@gmail.com>.
This is a followup to 1250034d5a.

* tests/guix-environment-container.sh (mount_test_code): Reverse order
of 'string-prefix?' arguments.
2016-08-29 00:09:44 +02:00
David Craven a34b236c17
import: Importers return prefixed licenses.
* guix/import/utils.scm
(define-module): Import licenses with license: prefix.
(string->licenses): Use prefixed licenses.
(license->symbol): Return symbols with the prefix license:.
* guix/tests/pypi.scm (pypi->guix-package): Update test cases.
* guix/tests/gem.scm (gem->guix-package): Update test case.
2016-08-28 14:04:50 +02:00
Mark H Weaver 536fc5f8cd
Merge branch 'core-updates' 2016-08-04 08:17:05 -04:00
Mark H Weaver 0832787e5c
Revert "Merge branch 'core-updates'"
This reverts commit 455859a50f.
2016-08-04 08:16:38 -04:00
Ludovic Courtès a5c376034f
tests: Make sure threads use separate output ports.
* tests/publish.scm (with-separate-output-ports): New macro.
<top level>: Use it when spawning new thread.
("/*.narinfo with compression"): Likewise.
2016-08-02 18:07:19 +02:00
Ludovic Courtès 2c7b48c2fb
tests: Work around Guile bug with unbuffered custom binary input ports.
Reported by Chris Marusich <cmmarusich@gmail.com>
at <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24060#19>

* tests/publish.scm (http-get-port): Remove 'setvbuf' call for the
response port.
2016-08-02 18:07:19 +02:00
Ludovic Courtès 455859a50f
Merge branch 'core-updates' 2016-08-01 23:30:52 +02:00
Ludovic Courtès 089b167812
publish: Do not compress already-compressed files.
* guix/scripts/publish.scm (narinfo-string): Force %NO-COMPRESSION when
STORE-PATH matches 'compressed-file?'.
* guix/utils.scm (compressed-file?): New procedure.
* tests/publish.scm ("/*.narinfo for a compressed file"): New test.
2016-08-01 17:58:56 +02:00
Ludovic Courtès 1250034d5a
tests: 'guix-environment-container.sh' works when run from a tmpfs.
Fixes <http://bugs.gnu.org/22004>.
Reported by Ting-Wei Lan <lantw44@gmail.com>.

* tests/guix-environment-container.sh (mount_test_code): Add 'match'
clause to ignore "/"; augment clause that ignores specific file system
types such that it does not ignore parent mount points.
2016-07-31 18:51:38 +02:00
Ludovic Courtès 57c7e46d39
tests: Improve synchronization in 'tests/guix-register.sh'.
* tests/guix-register.sh: When launching guix-daemon, add retry loop
around 'open-connection'.  This fixes test failures that could occur
under heavy load where the daemon's socket file wouldn't be ready yet
when the client connects.
2016-07-29 11:39:30 +02:00
Ludovic Courtès 386b71d1b9
gnu: commencement: 'guile-final' is now "hidden".
This way, we no longer have this annoying warning:

  $ guix build guile -n
  guix build: warning: ambiguous package specification `guile'
  guix build: warning: choosing guile-2.0.11 from gnu/packages/guile.scm:128:2

* gnu/packages/commencement.scm (guile-final): Use 'hidden-package'.
* tests/packages.scm ("fold-packages, hidden package"): New test.
2016-07-28 18:53:13 +02:00
Ludovic Courtès 6980511b73
packages: Add 'hidden-package'.
* guix/packages.scm (hidden-package, hidden-package?): New procedures.
* gnu/packages.scm (fold-packages): Filter out 'hidden-package?'.
* tests/packages.scm ("hidden-package"): New test.
2016-07-28 18:50:43 +02:00
Ludovic Courtès 37402ecb43
tests: Use unbuffered input ports when decompressing from 'guix publish'.
Fixes <http://bugs.gnu.org/24060>.
Reported by Chris Marusich <cmmarusich@gmail.com>.

* tests/publish.scm (http-get-port): Explicitly call
'open-socket-for-uri' and add calls to 'setvbuf'.
2016-07-27 12:45:01 +02:00
Ludovic Courtès 9e90fc7713
profiles: Output in 'package->manifest-entry' defaults to "out".
Fixes <http://bugs.gnu.org/24029>.
Reported by Dylan Jeffers <sapientech@openmailbox.org>.

* guix/profiles.scm (package->manifest-entry): Change #:output to
default to "out".
(packages->manifest): Add 'package?' in second 'match' clause.
* tests/profiles.scm ("package->manifest-entry defaults to \"out\""):
New test.
2016-07-26 18:18:53 +02:00
Ludovic Courtès 201855221f
environment: Set 'GUIX_ENVIRONMENT' to the profile.
* guix/scripts/environment.scm (create-environment): Set
'GUIX_ENVIRONMENT' to PROFILE.
* tests/guix-environment.sh: Test it.
* doc/guix.texi (Invoking guix environment): Document it.
2016-07-26 17:59:25 +02:00
Ludovic Courtès 8173ceee1f
import: pypi: Correctly handle new-style URLs.
Fixes <http://bugs.gnu.org/23997>.

* guix/import/pypi.scm (guix-package->pypi-name): Rewrite using
'basename' and 'hyphen-package-name->name+version'.
* tests/pypi.scm ("guix-package->pypi-name, old URL style")
("guix-package->pypi-name, new URL style"): New tests.
2016-07-26 17:49:34 +02:00
David Craven 99fe215cc1
lint: 'inputs-should-be-native' checks for intltool, itstool and glib:bin.
* guix/scripts/lint.scm (check-inputs-should-be-native): Warn when intltool,
itstool or glib:bin isn't a native-input.
* tests/lint.scm (inputs: glib:bin is probably a native input): Add test.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2016-07-24 19:54:15 +02:00
Ludovic Courtès ff6638d112
publish: Handle '/file' URLs, for content-addressed files.
* guix/scripts/publish.scm (render-content-addressed-file): New procedure.
(http-write): Add 'application/octet-stream' case.
(make-request-handler): Add /file/NAME/sha256/HASH URLs.
* tests/publish.scm ("/file/NAME/sha256/HASH")
("/file/NAME/sha256/INVALID-NIX-BASE32-STRING")
("/file/NAME/sha256/INVALID-HASH"): New tests.
* doc/guix.texi (Invoking guix publish): Mention the /file URLs.
2016-07-20 16:54:31 +02:00
Ludovic Courtès a849273509
tests: Adjust to Shepherd error message change.
This is a followup to commit 2c2ec261a8.

* tests/guix-system.sh: Adjust expected error message for Shepherd
services that are not provided.
2016-07-20 14:49:01 +02:00
Ludovic Courtès 4a1fc562ae
publish: Add '--compression'.
* guix/scripts/publish.scm (show-help, %options): Add '--compression'.
(<compression>): New record type.
(%no-compression, %default-gzip-compression): New variables.
(%default-options): Add 'compression' key.
(narinfo-string): Add #:compression parameter and honor it.
(render-narinfo): Likewise.
(render-nar): Likewise.
<top level>: Add call to 'declare-header!'.
(swallow-zlib-error): New macro.
(nar-response-port): New procedure.
(http-write): Add call to 'force-output'.  Use 'nar-response-port'
instead of 'response-port'.  Use 'swallow-zlib-error'.
(make-request-handler): Add #:compression parameter and honor it.  Add
"nar/gzip" URL handler.
(run-publish-server): Add #:compression parameter and honor it.
(guix-publish): Honor --compression.
* tests/publish.scm (http-get-port, wait-until-ready): New procedures.
<top level>: Run main server with "-C0".  Call 'wait-until-ready'.
("/nar/gzip/*", "/*.narinfo with compression"): New tests.
* doc/guix.texi (Invoking guix publish): Document it.
2016-07-19 00:07:12 +02:00
Ludovic Courtès 721539026d
Add (guix zlib).
* guix/zlib.scm, tests/zlib.scm: New files.
* Makefile.am (MODULES): Add guix/zlib.scm.
(SCM_TESTS): Add tests/zlib.scm.
* m4/guix.m4 (GUIX_LIBGCRYPT_LIBDIR): New macro.
* configure.ac (LIBGCRYPT_LIBDIR): Use it.  Define and substitute
'LIBZ'.
* guix/config.scm.in (%libz): New variable.
2016-07-19 00:07:12 +02:00
Ludovic Courtès 2bdd7ac17c
system: Honor the 'dependencies' field of file systems.
This allows mapped devices listed in 'dependencies' to be properly taken
into account.

Reported by Andreas Enge <andreas@enge.fr>.

* gnu/system.scm (mapped-device-user): Check whether DEVICE is a member
of the 'dependencies' of FS.
* tests/system.scm (%luks-device, %os-with-mapped-device): New variables.
("operating-system-user-mapped-devices")
("operating-system-boot-mapped-devices")
("operating-system-boot-mapped-devices, implicit dependency"): New tests.
2016-07-18 01:26:03 +02:00