Commit Graph

665 Commits

Author SHA1 Message Date
Ludovic Courtès 4c0416ae17
guix system: Reduce size of image produced for 'vm' action.
This reduces the size of the image produced by 'guix system vm' from
26 MiB to 9 MiB.

* gnu/system/vm.scm (system-qemu-image/shared-store):
(system-qemu-image/shared-store-script): Change the default
value of #:disk-image-size to 30 MiB when not FULL-BOOT?.
* guix/scripts/system.scm (system-derivation-for-action): Likewise for
the 'vm' action.
2016-04-29 18:05:44 +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 a17417a812
challenge: Use exit code 2 when discrepancies are found.
Suggested by John Darrington <john@darrington.wattle.id.au>.

* guix/scripts/challenge.scm (guix-challenge): Exit with 2 when MISSING
is not empty.
* doc/guix.texi (Invoking guix challenge): Document it.
2016-04-27 23:35:39 +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 0054e47036
guix gc: Add '--free-space'.
* guix/scripts/gc.scm (show-help, %options): Add '--free-space'.
(guix-gc)[ensure-free-space]: New procedure.
Handle '--free-space'.
2016-04-25 23:27:09 +02:00
Ludovic Courtès 85fc958d9b substitute: Sanitize the client-provided column number.
* guix/scripts/substitute.scm (client-terminal-columns): Sanitize the
client's column number.
2016-04-20 23:21:49 +02:00
Ludovic Courtès 38f50f49f3 substitute: Install the client's locale.
* guix/store.scm (set-build-options): Add #:locale parameter and honor
it.
* guix/scripts/substitute.scm (guix-substitute): Install the client's
locale.
2016-04-20 23:16:47 +02:00
Ludovic Courtès f954c9b5da substitute: Internationalize signature and download messages.
* guix/scripts/substitute.scm (assert-valid-narinfo): Use gettext for
messages.
2016-04-20 23:16:02 +02:00
Ludovic Courtès cf5e58297d substitute: Better abbreviate substitute URL in progress report.
Suggested by Danny Milosavljevic <dannym@scratchpost.org>.

* guix/build/download.scm (nar-uri-abbreviation): New procedure.
* guix/scripts/substitute.scm (process-substitution): Use it instead of
'store-path-abbreviation'.
2016-04-20 23:01:41 +02:00
Ludovic Courtès b0a6a97130 substitute: Honor the number of columns of the client terminal.
* guix/store.scm (set-build-options): Add #:terminal-columns parameter
and honor it.
* guix/scripts/substitute.scm (client-terminal-columns): New procedure.
(guix-substitute): Use it to parameterize 'current-terminal-columns'.
2016-04-15 00:32:18 +02:00
Ludovic Courtès cc44fbb8d9 guix download: Honor the number of columns of the terminal.
* guix/scripts/download.scm (guix-download): Parameterize
'current-terminal-columns'.
2016-04-15 00:32:18 +02:00
Danny Milosavljevic 013c3fb8c7 lint: Emit an ANSI erase-in-line sequence.
* guix/scripts/lint.scm (run-checkers): Add '\x1b[K' to progress
messages and after 'for-each'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-04-14 10:20:14 +02:00
David Thompson fe463dbcf7 environment: container: Work around read-only /etc/resolv.conf issue.
* guix/scripts/environment.scm (launch-environment/container): Mount
/etc/resolv.conf as a writable file.
2016-04-07 11:48:31 -04:00
Ludovic Courtès 7cffaeb604 challenge: Really exit with non-zero upon hash mismatch.
Reported by John Darrington.

* guix/scripts/challenge.scm (guix-challenge): Add an explicit 'exit'
call when ISSUES is empty.
* scripts/guix.in: Add comment about 'exit'.
* doc/guix.texi (Invoking guix challenge): Mention the behavior and exit
code.
2016-04-06 23:21:26 +02:00
Alex Kost 5f2928456b emacs: Use 'build-and-use-profile' from (guix scripts package).
* guix/scripts/package.scm: Export 'build-and-use-profile'.
* emacs/guix-main.scm (process-package-actions): Use it.
2016-04-04 20:11:22 +03:00
Eric Bavier 42efe27a30 import: Add Hackage updater.
* guix/import/hackage.scm (guix-package->hackage-name, hackage-package?)
  (latest-release): New procedures.
  (%hackage-updater): New variable.
* guix/scripts/refresh.scm (%updaters): Add it.
* doc/guix.texi (Invoking guix refresh): Mention it.
2016-03-30 23:19:24 -05:00
David Thompson aa2a0d4bb8 environment: Set a default value for PS1.
* guix/scripts/environment.scm (launch-environment/container): Set PS1
  during container initialization.
2016-03-30 09:09:40 -04:00
Ludovic Courtès 7f949db03e guix system: Warn against missing 'guix pull'.
Suggested by Leo Famulari and others.

* guix/scripts/system.scm (maybe-suggest-running-guix-pull): New
procedure.
(perform-action): Call it when ACTION is 'reconfigure.
2016-03-28 22:50:25 +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
David Thompson a01ad63893 environment: container: Create dummy home directory and /etc/passwd.
* guix/scripts/environment.scm (launch-environment/container): Change
$HOME to the current user's home directory instead of
/homeless-shelter.  Create a dummy /etc/passwd with a single entry for
the current user.
* doc/guix.texi ("invoking guix environment"): Add a note about the
dummy home directory and /etc/passwd.
2016-03-26 09:38:27 -04: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 8c321299c5 substitute: Gracefully handle TLS errors.
* guix/scripts/substitute.scm (with-networking): Use 'match-lambda*' and
add case for 'gnutls-error'.
2016-03-23 00:23:12 +01:00
Ludovic Courtès b879b3e848 substitute: Do not leak file descriptors for TLS connections.
Partially fixes <http://bugs.gnu.org/20145>.

* guix/scripts/substitute.scm (fetch, download-cache-info):
(http-multiple-get, fetch-narinfos, progress-report-port): Use
'close-connection' instead of 'close-port'.
2016-03-17 23:53:53 +01:00
Ludovic Courtès 958fb14cdb substitute: Cache transient HTTP errors for 10mn.
* guix/scripts/substitute.scm (fetch-narinfos)[handle-narinfo-response]:
Cache transient errors for 10mn.
(%narinfo-transient-error-ttl): New variable.
2016-03-17 23:53:53 +01:00
Ludovic Courtès 14d6ca3e4d lint: Do not leak file descriptors for TLS connections.
Partially fixes <http://bugs.gnu.org/20145>.

* guix/scripts/lint.scm (probe-uri): Use 'close-connection' instead of
'close-port'.
2016-03-17 23:53:53 +01:00
Ludovic Courtès fc3ea24bf4 substitute: Update progress for responses different from 200/404.
* guix/scripts/substitute.scm (fetch-narinfos)[handle-narinfo-response]:
Add missing call to 'update-progress!'.
2016-03-17 23:53:53 +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
Ludovic Courtès 23d60ba65c substitute: Honor the 'max-age' of 'Cache-Control' headers.
This allows substitute servers to tell 'guix substitute' how long they
can cache narinfo lookups.

* guix/scripts/substitute.scm (cache-narinfo!): Add 'ttl' parameter.
[cache-entry]: Honor it.
(fetch-narinfos)[handle-narinfo-response]: Check the 'Cache-Control'
header of RESPONSE and pass its 'max-age' value to 'cache-narinfo!'.
2016-03-16 15:57:47 +01:00
Ludovic Courtès 1cf7e31898 substitute: Make room for a 'ttl' field in cached entries.
* guix/scripts/substitute.scm (cached-narinfo): Expect 'narinfo' sexp
version 2 with a 'ttl' field.
(cache-narinfo!)[cache-entry]: Produce 'narinfo' sexp version 2 with a
'ttl' field.
(remove-expired-cached-narinfos)[expired?]: Read 'narinfo' sexp version 2.
2016-03-16 15:57:47 +01:00
Ludovic Courtès 026ca50fa4 substitute: Keep the initial connection alive.
The connection used to fetch /nix-cache-info is now reused for the
subsequent narinfo requests.

* guix/scripts/substitute.scm (download-cache-info)[download]: Remove.
[uri, read-cache-info]: New variables.
Rewrite in terms of 'http-fetch' instead of 'fetch'.  Return an open
port in addition to a <cache-info>.
* guix/scripts/substitute.scm (http-multiple-get): Add #:port parameter
and honor it.
(fetch-narinfos)[do-fetch]: Add 'port' parameter.
Adjust to new 'download-cache-info' and 'do-fetch' signatures.
2016-03-14 23:34:33 +01:00
Ludovic Courtès cc27dbcf4a substitute: Remove dead code.
This parameter became unused with the switch to HTTP pipelining in
commit d3a652037e.

* guix/scripts/substitute.scm (fetch): Remove #:quiet-404? and adjust
accordingly.
2016-03-14 23:34:33 +01:00
Ludovic Courtès 3667bb6cb0 size: Disable grafts.
* guix/scripts/size.scm (guix-size): Parametrize '%graft?'.
2016-03-14 23:34:33 +01:00
Ludovic Courtès ec278439f3 substitute: Optimize HTTP pipelining over TLS.
* guix/scripts/substitute.scm (http-multiple-get): Write the requests
to a bytevector output port before sending them.
2016-03-10 13:55:30 +01:00
Ludovic Courtès 9b7bd1b160 substitute: Add HTTPS support.
Fixes <http://bugs.gnu.org/22937>.
Reported by Chris Marusich <cmmarusich@gmail.com>.

* guix/scripts/substitute.scm (fetch): Add 'https' alongside 'http'.
Use 'open-connection-for-uri' instead of 'open-socket-for-uri'.  Call
'setvbuf' only when PORT matches 'file-port?'.
(http-multiple-get): Likewise.  Change 'base-url' parameter to
'base-uri'.
(fetch-narinfos)[do-fetch]: Add 'https' case alongside 'http'.  Pass URI
instead of URL to 'http-multiple-get'.
* doc/guix.texi (Requirements): Move GnuTLS one level higher and mention
HTTPS substitutes.
(Substitutes): Mention HTTPS and recommend it.  Explain why servers
are not authenticated.  Add "On Trusting Binaries" subsection.
2016-03-10 13:55:30 +01:00
Ludovic Courtès 204d34ff96 substitute: Error out on unsupported URL schemes.
Reported in <http://bugs.gnu.org/22937>
by Chris Marusich <cmmarusich@gmail.com>.

* guix/scripts/substitute.scm (fetch): Add 'else' case and call 'leave'.
2016-03-09 23:47:49 +01:00
Ludovic Courtès 5284339d9d guix build: Add '--quiet'.
Fixes <http://bugs.gnu.org/19772>.
Reported by Andrei Osipov <andrspv@gmail.com>.

* guix/scripts/build.scm (show-help, %options): Add --quiet.
(guix-build): Parameterize 'current-build-output-port' accordingly.
* doc/guix.texi (Invoking guix build): Use it in example.
(Additional Build Options): Document it.
2016-03-08 22:00:17 +01:00
Ludovic Courtès 16210486e6 guix system: Write the GC root on the target file system.
Fixes <http://bugs.gnu.org/22802>.
Reported by Jookia <166291@gmail.com>.

* guix/scripts/system.scm (install-grub*): Prepend TARGET to GC-ROOT.
2016-03-08 11:11:28 +01:00
Ludovic Courtès c8f9f24776 guix build: Set the build options early.
This fixes a bug whereby, with grafts leading to builds very early,
build options such as --substitute-urls would not be taken into account
yet.

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

* guix/scripts/build.scm (guix-build): Move 'opts' to the beginning.
Use 'with-store' instead of 'open-connection'.  Call
'set-build-options-from-command-line' right after 'with-store'.
2016-03-05 00:19:10 +01:00
Ludovic Courtès 4ce783a2f9 lint: cve: Gracefully handle HTTP errors.
* guix/scripts/lint.scm (current-vulnerabilities*): New procedure.
(package-vulnerabilities): Use it.
2016-03-04 11:48:52 +01:00
Ludovic Courtès 937690f909 lint: derivation: Disable grafts, but check replacements.
* guix/scripts/lint.scm (check-derivation): Pass #:graft? #f.  When
'package-replacement' exists, compute its derivation.
2016-03-03 09:46:17 +01:00
Ludovic Courtès 94d609aba8 guix build: -S returns the replacement's source.
Reported by Mark H Weaver.

* guix/scripts/build.scm (options->derivations): When SRC and GRAFT? are
true, use the source of P's replacement.
* tests/guix-build.sh: Add test.
2016-03-03 00:18:30 +01:00
Mathieu Lirzin 1b846da8c3 utils: Use '@' for separating package names and version numbers.
This provides the ability to use numbers in package names.

Fixes <http://bugs.gnu.org/19219>.

* guix/utils.scm (package-name->name+version): New procedure.
* gnu/packages.scm (%find-package): Add a FALLBACK? keyword argument.
Use the previous method when no package is found.
(specification->package+output, specification->package): Adapt
documentation to new syntax.
* doc/guix.texi (Invoking guix package, Invoking guix import): Likewise.
* guix/ui.scm (package-specification->name+version+output): Likewise.
* guix/scripts/import/hackage.scm (show-help): Likewise.
* tests/guix-build.sh: Adapt to new syntax.
* tests/guix-lint.sh: Likewise.
* tests/guix-package.sh: Likewise.
* tests/ui.scm ("package-specification->name+version+output"): Likewise.
* tests/utils.scm ("package-name->name+version"): Likewise.
* NEWS: Mention new syntax.
2016-03-02 21:41:41 +01:00
Ludovic Courtès 637cd12543 graph: Ignore 'GUIX_BUILD_OPTIONS'.
Previously 'GUIX_BUILD_OPTIONS' would be honored, but 'guix graph' does
not support the common build options.

* guix/scripts/graph.scm (guix-graph): Use 'args-fold*' instead of
'parse-command-line'.
2016-03-02 14:47:07 +01:00
Ludovic Courtès 7573d30ff8 guix build: Move '--no-grafts' to the common build options.
* guix/scripts/build.scm (%options): Move --no-grafts to...
(%standard-build-options): ... here.
(show-help, show-build-options-help): Adjust accordingly.
* guix/scripts/archive.scm (%default-options): Add 'graft?'.
(guix-archive): Parametrize '%graft?'.
* guix/scripts/environment.scm (%default-options): Add 'graft?'.
(guix-environment): Parametrize '%graft?'.
* guix/scripts/package.scm (%default-options): Add 'graft?'.
(guix-package): Parametrize '%graft?'.
* guix/scripts/system.scm (%default-options): Add 'graft?'.
(guix-system): Parametrize 'graft?'.
* doc/guix.texi (Additional Build Options): Move --no-grafts to...
(Common Build Options): ... here.
2016-03-02 14:47:07 +01:00
Ludovic Courtès 1cbdf82d3b guix archive: Use 'with-store'.
* guix/scripts/archive.scm (guix-archive): Use 'with-store' instead of
an explicit 'open-connection'.
2016-03-02 14:47:07 +01:00
Ludovic Courtès c22a1324e6 grafts: Graft recursively.
Fixes <http://bugs.gnu.org/22139>.

* guix/grafts.scm (graft-derivation): Rename to...
(graft-derivation/shallow): ... this.
(graft-origin-file-name, item->deriver, non-self-references)
(cumulative-grafts, graft-derivation): New procedures
* tests/grafts.scm ("graft-derivation, grafted item is a direct
dependency"): Clarify title.  Use 'grafted' instead of 'graft' to refer
to the grafted derivation.
("graft-derivation, grafted item is an indirect dependency")
("graft-derivation, no dependencies on grafted output"): New tests.
* guix/packages.scm (input-graft): Change to take a package instead of
an input.
(input-cross-graft): Likewise.
(fold-bag-dependencies): New procedure.
(bag-grafts): Rewrite in terms of 'fold-bag-dependencies'.
* tests/packages.scm ("package-derivation, indirect grafts"): Comment out.
* doc/guix.texi (Security Updates): Mention run-time dependencies and
recursive grafting.
2016-03-01 16:00:46 +01:00
Ben Woodcroft 917a2a58ec import: Add github-updater.
* guix/import/github.scm: New file.
* guix/scripts/refresh.scm (%updaters): Add %GITHUB-UPDATER.
* doc/guix.texi (Invoking guix refresh): Mention it.
* Makefile.am (MODULES): Add gnu/import/github.scm.
2016-02-26 22:06:34 -05:00
Ludovic Courtès 22572d56cb store: 'path-info-deriver' is #f when there is no deriver.
* guix/store.scm (read-path-info): Use #f when we get the empty string
for DERIVER.
* guix/scripts/publish.scm (narinfo-string): Adjust accordingly.
* tests/store.scm ("path-info-deriver"): New test.
2016-02-26 23:35:29 +01:00
Mark H Weaver e62b5c6903 Merge branch 'media-updates' 2016-02-25 13:50:19 -05:00
Ludovic Courtès cfd503205e guix system: Restore load path after running the activation script.
Fixes <http://bugs.gnu.org/22753>.
Reported by Mark H Weaver <mhw@netris.org>.

* guix/scripts/system.scm (save-load-path-excursion): New variable.
(upgrade-shepherd-services): Add comment about the issue.
(switch-to-system): Use 'save-load-path-excursion' around
'primitive-load' call.
2016-02-25 12:44:41 +01:00