Commit Graph

264 Commits

Author SHA1 Message Date
Ludovic Courtès 4311cf965c
ui: Add 'display-search-results' and use it.
* guix/ui.scm (display-search-results): New procedure.
* guix/scripts/package.scm (find-packages-by-description): Remove
'unzip2' call and return a list of pairs.
(process-query): Change to use 'display-search-results'.
* guix/scripts/system/search.scm (find-service-types): Remove 'unzip2'
call and return a list of pairs.
(guix-system-search): Use 'display-search-results'.
2019-06-27 11:14:41 +02:00
Ludovic Courtès 8874faaaac
ui: 'relevance' considers regexps connected with a logical and.
* guix/ui.scm (relevance)[score]: Change to return 0 when one of REGEXPS
doesn't match.
* tests/ui.scm ("package-relevance"): New test.
2019-06-27 11:14:40 +02:00
Ludovic Courtès 1b5ee3bdaa
Add (guix diagnostics).
* guix/ui.scm (warning, info, report-error, leave)
(location->string, guix-warning-port, program-name)
(highlight-argument, %highlight-argument, define-diagnostic)
(%warning-color, %info-color, %error-color)
(print-diagnostic-prefix): Move to...
* guix/diagnostics.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
2019-06-03 23:18:47 +02:00
Chris Marusich 387e6b9e34
ui: Make package outputs searchable.
* guix/ui.scm (relevance): Allow the "field" procedure of a metric to
return a list, and handle that case appropriately.  Update docstring.
(%package-metrics): Add a metric for package outputs.
* guix/scripts/package.scm (find-packages-by-description): Update
docstring.
* tests/guix-package.sh: Add a test case to verify that package outputs are
included in search results.

Co-authored-by: Tobias Geerinckx-Rice <me@tobias.gr>
2019-05-09 00:10:34 -07:00
Ludovic Courtès 3dae43a929
ui: Highlight heading of generation lists.
* guix/ui.scm (display-generation): Highlight the "Generation" heading.
2019-04-14 23:40:52 +02:00
Ludovic Courtès c1c5d68a94
colors: Add 'highlight'.
* guix/colors.scm (%highlight-color): New variable.
(highlight): New procedure.
* guix/ui.scm (%highlight-argument)[highlight]: Remove.
(%highlight-color): Remove.
2019-04-14 23:40:52 +02:00
Ludovic Courtès 2569ef9dab
colors: Introduce a disjoint type and pre-compute ANSI escapes.
* guix/colors.scm (color-table, color): Remove.
(<color>): New record type.
(print-color): New procedure.
(define-color-table, color): New macros.
(color-codes->ansi): New procedure.
(%reset): New variable.
(colorize-string): Rewrite accordingly.
(color-rules): Adjust accordingly.
* guix/status.scm (print-build-event): Adjust to new 'colorize-string'
interface.
* guix/ui.scm (%highlight-argument): Likewise.
(%warning-colors, %info-colors, %error-colors, %hint-colors)
(%highlight-colors): Remove.
(%warning-color, %info-color, %error-color, %hint-color)
(%highlight-color): New variables.
2019-04-11 18:18:13 +02:00
Ludovic Courtès 238589e566
ui: Highlight diagnostic format string arguments.
* guix/ui.scm (highlight-argument): New macro.
(%highlight-argument): New procedure.
(define-diagnostic): Use 'highlight-argument'.
2019-04-10 17:09:47 +02:00
Ludovic Courtès a7ae18b1b9
ui: Colorize hints.
* guix/ui.scm (%info-colors): Remove CYAN.
(%hint-colors): New variable.
(display-hint): Adjust so that the "hint:" prefix is colorized.
2019-04-10 17:09:46 +02:00
Ludovic Courtès 9e1e046040
ui: Colorize diagnostics.
* guix/ui.scm (define-diagnostic): Add 'colors' parameter and pass it to
'print-diagnostic-prefix'.
(warning, info, report-error): Add extra argument.
(%warning-colors, %info-colors, %error-colors): New variables.
(print-diagnostic-prefix): Add #:colors parameter and honor it.
2019-04-10 12:40:59 +02:00
Ludovic Courtès 402627714b
ui: Diagnostic procedures can display error location.
* guix/ui.scm (define-diagnostic): Add optional 'location' parameter.
Pass it to 'print-diagnostic-prefix'.
(print-diagnostic-prefix): Add optional 'location' parameter and honor
it.
(report-load-error): Use 'report-error' and 'warning' instead
of (format (current-error-port) …).
2019-04-10 12:40:59 +02:00
Ludovic Courtès cc3697d543
ui: Factorize 'print-diagnostic-prefix'.
* guix/ui.scm (define-diagnostic): Emit call to 'print-diagnostic-prefix'.
(print-diagnostic-prefix): New procedure.
2019-04-10 12:40:59 +02:00
Ludovic Courtès 26a2021a1f
ui: Make diagnostic message prefix translatable.
* guix/ui.scm (define-diagnostic): Expect PREFIX to be enclosed in
'G_'.   Emit call to 'gettext' on PREFIX.
(warning, info, report-error): Wrap prefix in 'G_'.
2019-04-10 12:40:59 +02:00
Ludovic Courtès 32813e8440
ui: Fix i18n for diagnostic messages.
Until now, we'd pass 'gettext' the "augmented" format string, which
'gettext' would not find in message catalogs.  Now we pass it FMT as is,
which is what catalogs contain.

* guix/ui.scm (define-diagnostic)[augmented-format-string]: Remove.
Emit one 'format' call to print the prefix, and a second one to print
the actual message.
2019-04-10 12:40:59 +02:00
Ludovic Courtès 5d9f9ad631
Add (guix colors).
* guix/colors.scm: New file.
* Makefile.am (MODULES): Add it.
* guix/ui.scm (color-table, color, colorize-string): Remove.
* guix/status.scm (isatty?*, color-output? color-rules): Remove.
2019-04-10 12:40:58 +02:00
Ludovic Courtès 94aeec0aef
ui: Bypass Texinfo parsing and rendering for searches.
This makes search queries such as:

  LANGUAGE=fr guix package -s utilitaire -s recherche

about 6 times faster.

* guix/ui.scm (%package-metrics): Do not use 'package-synopsis-string'
and 'package-description-string' to bypass Texinfo parsing and
rendering.
2019-03-24 00:13:53 +01:00
Ludovic Courtès 70a50305c4
ui: Always print the exception upon load errors.
Fixes <https://bugs.gnu.org/34402>.
Reported by <pkill9@runbox.com>.

Previously 'display-error' could be called with the wrong number of
arguments (e.g., for 'git-error' exceptions), and thus nothing at all
was displayed.

* guix/ui.scm (report-load-error): Check whether ARGS matches the
parameters for 'display-error' and call 'print-exception' otherwise.
2019-02-11 23:23:28 +01:00
Ludovic Courtès 487cbb0164
profiles: Raise an error for unmatched patterns.
Previously, "guix package -r something-not-installed" would silently
complete.  Now an error is raised.

* guix/profiles.scm (&unmatched-pattern-error): New condition type.
(manifest-matching-entries): Rewrite to raise an error when one of
PATTERNS is not matched.
* guix/ui.scm (call-with-error-handling): Handle 'unmatched-pattern-error?'.
* tests/guix-package.sh: Add test.
* tests/profiles.scm ("manifest-matching-entries"): Don't try to remove
unmatched pattern.
("manifest-matching-entries, no match"): New test.
("manifest-transaction-effects"): Remove 'remove' field.
2019-02-07 15:46:45 +01:00
Ludovic Courtès e6b065b299
ui: Don't report "build failed:" for daemon error messages.
Until now we'd get things like:

  guix build: error: build failed: build of `/gnu/store/….drv' failed

or:

  $ guix gc -d /sdf
  guix gc: error: build failed: path `/sdf' is not in the store

which is kinda ridiculous.

* guix/ui.scm (call-with-error-handling): Remove "build failed:" prefix
for 'store-protocol-error?'.
2019-01-23 23:35:12 +01:00
Ludovic Courtès f9e8a12379
store: Rename '&nix-error' to '&store-error'.
* guix/store.scm (&nix-error): Rename to...
(&store-error): ... this, and adjust users.
(&nix-connection-error): Rename to...
(&store-connection-error): ... this, and adjust users.
(&nix-protocol-error): Rename to...
(&store-protocol-error): ... this, adjust users.
(&nix-error, &nix-connection-error, &nix-protocol-error): Define these
condition types and their getters as deprecrated aliases.
* build-aux/run-system-tests.scm, guix/derivations.scm,
guix/grafts.scm, guix/scripts/challenge.scm,
guix/scripts/graph.scm, guix/scripts/lint.scm,
guix/scripts/offload.scm, guix/serialization.scm,
guix/ssh.scm, guix/tests.scm, guix/ui.scm,
tests/derivations.scm, tests/gexp.scm, tests/guix-daemon.sh,
tests/packages.scm, tests/store.scm, doc/guix.texi: Adjust to use the
new names.
2019-01-21 23:09:55 +01:00
Ludovic Courtès 76832d3420
Remove most uses of the _IO*F constants.
These constants, for use with 'setvbuf', were deprecated in Guile 2.2
and disappeared in Guile 3.0.  Here we keep these constants in
build-side code where removing them is not feasible.

* guix/build/download-nar.scm (download-nar): Adjust 'setvbuf' calls to
the Guile 2.2+ API.
* guix/build/download.scm (open-socket-for-uri): Likewise.
(open-connection-for-uri, url-fetch): Likewise.
* guix/build/make-bootstrap.scm (make-stripped-libc): Likewise.
* guix/build/union.scm (setvbuf) [guile-2.0]: New conditional wrapper.
(union-build): Adjust to new API.
* guix/ftp-client.scm (ftp-open, ftp-list, ftp-retr): Likewise.
* guix/http-client.scm (http-fetch): Likewise.
* guix/inferior.scm (proxy): Likewise.
* guix/scripts/substitute.scm (fetch, http-multiple-get): Likewise.
* guix/self.scm (compiled-modules): Likewise.
* guix/ssh.scm (remote-daemon-channel, store-import-channel)
(store-export-channel): Likewise.
* guix/ui.scm (initialize-guix): Likewise.
* tests/publish.scm (http-get-port): Likewise.
* guix/store.scm (%newlines): Adjust comment.
2019-01-09 14:47:53 +01:00
Ludovic Courtès a65177a657
maint: Remove 'cond-expand' forms for Guile 2.0.
Note: Leave 'cond-expand' forms used in the build-side modules that can
run on %BOOTSTRAP-GUILE, which is currently Guile 2.0.

* guix/build/compile.scm: Move 'use-modules' clause from 'cond-expand'
to 'define-module' form.
(%default-optimizations): Remove 'cond-expand'.
* guix/build/download.scm (tls-wrap): Remove 'cond-expand'.
* guix/build/syscalls.scm: Remove 'cond-expand' form around
'%set-automatic-finalization-enabled?!' and
'without-automatic-finalization'.
* guix/inferior.scm (port->inferior): Remove 'cond-expand'.
* guix/scripts/pack.scm (wrapped-package)[build]: Remove 'cond-expand'.
* guix/status.scm (build-event-output-port): Remove 'cond-expand'.
* guix/store.scm (open-inet-socket): Remove 'cond-expand'.
* guix/ui.scm (install-locale): Remove 'cond-expand'.
* tests/status.scm ("current-build-output-port, UTF-8 + garbage"):
Remove 'cond-expand'.
* tests/store.scm ("current-build-output-port, UTF-8 + garbage"):
Remove 'cond-expand'.
2019-01-09 14:47:53 +01:00
Ludovic Courtès a173f09811
ui: It's 2019 now!
* guix/ui.scm (show-version-and-exit): Change year to 2019.
2019-01-05 00:08:04 +01:00
Ricardo Wurmus 80eebee9f7
ui: Report profile hooks separately.
* guix/ui.scm (profile-hook-derivation?): New procedure.
(show-what-to-build): Distinguish among BUILD derivations that match
'profile-hook-derivation?'.  Report them separately.
* guix/status.scm (hook-message): New procedure.
(print-build-event): Display profile hooks with readable hook name.
* guix/profiles.scm (info-dir-file, ghc-package-cache-file,
ca-certificate-bundle, glib-schemas, gtk-icon-themes, gtk-im-modules,
xdg-desktop-database, xdg-mime-database, fonts-dir-file, manual-database):
Augment derivation with "type" and "hook" properties.
2018-12-19 23:46:38 +01:00
Timothy Sample 6616a35202
ui: Report file names in 'system-error' exceptions from 'execlp'.
Fixes <https://bugs.gnu.org/33755>.

* guix/ui.scm (apply-formals): New macro.
(execlp): New error-reporting wrapper.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-12-18 16:04:25 +01:00
Ludovic Courtès d4aa147eec
ui: 'show-what-to-build' reports grafts separately.
* guix/ui.scm (graft-derivation?): New procedure.
(show-what-to-build): Distinguish among BUILD derivations that match
'graft-derivation?'.  Report them separately.
2018-11-28 10:39:58 +01:00
Ludovic Courtès dc0f74e5fc
Add (guix status) and use it for pretty colored output.
* guix/progress.scm (progress-reporter/trace): New procedure.
(%progress-interval): New variable.
(progress-reporter/file): Use it.
* guix/scripts/build.scm (set-build-options-from-command-line): Pass
 #:print-extended-build-trace?.
(%default-options): Add 'print-extended-build-trace?'.
(guix-build): Parameterize CURRENT-TERMINAL-COLUMNS.  Use
'build-status-updater'.
* guix/scripts/environment.scm (%default-options): Add
'print-extended-build-trace?'.
(guix-environment): Wrap body in 'with-status-report'.
* guix/scripts/pack.scm (%default-options): Add 'print-build-trace?' and
'print-extended-build-trace?'.
(guix-pack): Wrap body in 'with-status-report'.
* guix/scripts/package.scm (%default-options, guix-package): Likewise.
* guix/scripts/system.scm (%default-options, guix-system): Likewise.
* guix/scripts/pull.scm (%default-options, guix-pull): Likewise.
* guix/scripts/substitute.scm (progress-report-port): Don't call STOP
when TOTAL is zero.
(process-substitution): Add #:print-build-trace? and honor it.
(guix-substitute)[print-build-trace?]: New variable.
Pass #:print-build-trace? to 'process-substitution'.
* guix/status.scm: New file.
* guix/store.scm (set-build-options): Add #:print-extended-build-trace?;
pass it into PAIRS.
(%protocol-version): Bump.
(protocol-version, nix-server-version): New procedures.
(current-store-protocol-version): New variable.
(with-store, build-things): Parameterize it.
* guix/ui.scm (build-output-port): Remove.
(colorize-string): Export.
* po/guix/POTFILES.in: Add guix/status.scm.
* tests/status.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
* nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x162.
* nix/libstore/build.cc (DerivationGoal::registerOutputs)
(SubstitutionGoal::finished): Print a "@ hash-mismatch" trace before
throwing.
2018-09-27 23:21:53 +02:00
Ricardo Wurmus f72e5f93b7
ui: Do not filter hash mismatch lines.
Reported by Pjotr Prins <pjotr.public12@thebird.nl>.

* guix/ui.scm (build-output-port): Add pattern for hash mismatch error; be
more careful with error messages in verbose mode.
2018-09-11 23:19:42 +02:00
Ricardo Wurmus 15cc7e6adf
ui: Add soft port for styling and filtering build output.
* guix/ui.scm (build-output-port): New procedure.
* guix/scripts/package.scm (%default-options): Print build trace.
(guix-package): Use build-output-port.
* guix/scripts/build.scm (guix-build): Use build-output-port.

Co-authored-by: Sahithi Yarlagadda <sahi@swecha.net>
2018-09-09 23:18:21 +02:00
Sahithi Yarlagadda 80ec1b73d2
ui: Add support for colorization.
* guix/ui.scm (ansi-color-tables): New variable.
(color, colorize-string): New procedures.

Signed-off-by: Ricardo Wurmus <rekado@elephly.net>
2018-09-09 22:26:54 +02:00
Ludovic Courtès dc013aff81
ui: Fix typo.
* guix/ui.scm (display-profile-content-diff): Fix typo in docstring.
2018-07-11 00:53:04 +02:00
Kyle Meyer 85c3fbf5de
ui: Add -V as short option for --version.
* guix/ui.scm (run-guix): Add -V as the short option for --version for
consistency with most commands.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-07-07 18:10:31 +02:00
Ludovic Courtès 90b144d22d
ui: Report file names in 'system-error' exceptions from 'delete-file'.
* guix/ui.scm (delete-file): New error-reporting wrapper.
2018-07-03 17:50:04 +02:00
Ludovic Courtès 8120b23e51
ui: Make 'check-available-space' public.
* guix/ui.scm (check-available-space): Add optional 'directory'
parameter, defaulting to (%store-prefix).  Honor it.  Make public.
2018-07-03 00:39:10 +02:00
Ludovic Courtès fd1395c498
ui: Increase relevance score for exact matches.
Previously "guix package -s python" would have 'python2-zope-interface' as
its first result (relevance: 10), followed by many other python-*
packages with the same score, while 'python' itself would come
later (relevance: 7).

This change makes 'python' the first result (relevance: 27).

Reported by Gábor Boskovits.

* guix/ui.scm (relevance)[score]: Use 'fold-matches' instead of
'match:count' to counter the number of maches.  Give more weight to
exact matches.
2018-06-29 22:56:33 +02:00
Ludovic Courtès 26db747a86
ui: Hint at the installation of locale packages and 'GUIX_LOCPATH'.
* guix/ui.scm (install-locale): Hide the "warning: failed to install
locale" on Guile 2.2.  Add a hint about 'glibc-utf8-locales' and
'GUIX_LOCPATH'.
2018-06-27 16:58:59 +02:00
Julien Lepiller af09bed7dc
guix: ui: Allow translation of dates.
* guix/ui.scm (display-generation): Allow translation of dates.
The format string will show dates as month day year, but some languages use a
different convention.
2018-06-14 21:53:12 +02:00
Ludovic Courtès 24cb66d18e
ui: Avoid #:select'ing bindings introduced in the latest (guix build utils).
This should allow 'guix pull' to complete even when invoked from a Guix
that predates commit 5d669883ec.

* guix/ui.scm: Use #:hide instead of #:select.  This is a followup to
5d669883ec.
2018-06-09 12:02:28 +02:00
Marius Bakke 12bd588346
Merge branch 'master' into core-updates 2018-05-06 15:56:24 +02:00
Ludovic Courtès 2d2f98efb3
guix build: Nicely report unbound variables with hints.
* guix/ui.scm (print-unbound-variable-error): Add "error:" to the
message.
(report-unbound-variable-error): New procedure, with code formerly in
'report-load-error'.
(report-load-error): Use it.
(call-with-unbound-variable-handling): New procedure.
(with-unbound-variable-handling): New macro.
* guix/scripts/build.scm (options->derivations): Wrap body in
'with-unbound-variable-handling'.
* tests/guix-build.sh (GUIX_PACKAGE_PATH): Add test.
2018-05-04 15:07:08 +02:00
Ludovic Courtès 7f2f6a2cb2
ui: Factorize 'last-frame-with-source'.
* guix/ui.scm (last-frame-with-source): New procedure.
(load*)[frame-with-source]: Remove.
Use 'last-frame-with-source'.
2018-05-04 12:13:53 +02:00
Mark H Weaver 3d5ad159b3
Merge branch 'master' into core-updates 2018-04-30 04:03:54 -04:00
Ludovic Courtès 6ddb59607b
guix system: Report wrong file system 'device' fields.
Previously, if you wrote (device "my-label") without (title 'label),
you'd get:

  guix system: error: stat: No such file or directory: "my-label"

Now you get a proper error and a hint.

Reported by Pierre-Antoine Rouby.

* guix/scripts/system.scm (check-file-system-availability)[literal]: New
variable.  Loop over LITERAL.
* gnu/system/file-systems.scm (%pseudo-file-system-types): New variable.
* guix/ui.scm (display-hint): Make public.
2018-04-27 18:45:02 +02:00
Mark H Weaver cbdfa50d9f
utils: invoke: Raise exceptions using SRFI-34 and SRFI-35.
* guix/build/utils.scm (&invoke-error): New condition type.
(invoke-error?, invoke-error-program, invoke-error-arguments)
(invoke-error-exit-status, invoke-error-term-signal)
(invoke-error-stop-signal): New exported procedures.
(invoke): Raise exceptions using SRFI-34 and SRFI-35.
* guix/ui.scm (call-with-error-handling): Add a guard clause
for &invoke-error conditions.
2018-03-16 20:02:47 -04:00
Ludovic Courtès 16de45557f
ui: 'display-hint' preserves Texinfo formatting.
The previous method would mess up with @example formatting, for
instance.

* guix/ui.scm (display-hint): Parameterize '%text-width' instead of
using 'fill-paragraph'.
2018-03-07 11:22:42 +01:00
Ludovic Courtès e1ba6d49ea
ui: Display fix hints in the case where we have location info.
* guix/ui.scm (call-with-error-handling): Display fix-hints in the
error + message case.
2018-03-07 11:22:42 +01:00
Ludovic Courtès 7949c140b1
ui: 'load*' no longer fails on Guile 2.2.3 upon EACCES or similar.
Previously, if ~/.cache was not write-accessible, 'guix' would exit with
code 1 without printing any message.  That was because the 'make-stack'
call would fail since the exception (a 'system-error) came from
'compile-file', which was called at a point where TAG wasn't installed
yet.  Secondly, to mimick auto-compilation behavior, we just swallow
'system-error raised by 'compile-file'.

Reported by Clément Lassieur.

* guix/ui.scm (load*): Move 'compile-file' call in the dynamic extent of
TAG.  Catch 'system-error around it and ignore it.
2018-03-06 10:50:39 +01:00
Ludovic Courtès f44c7aaccd
ui: Better workaround for lack of '%fresh-auto-compile' on 2.2.3.
Fixes <https://bugs.gnu.org/29226> for the most part.

* guix/ui.scm (load*): Add call to 'compile-file' on 2.2.3.
2018-03-05 10:54:45 +01:00
Ludovic Courtès 92423868bc
ui: Disable '%fresh-auto-compile' only for Guile 2.2.3.
Mitigates <https://bugs.gnu.org/29881>.
Reported by Diego Nicola Barbato <dnbarbato@posteo.de>.

* guix/ui.scm (load*): Unset '%fresh-auto-compile' only on Guile 2.2.3.
2018-01-15 23:29:33 +01:00
Ludovic Courtès 4a8d536ffe
ui: Display hints that come along with '&message' conditions.
* guix/ui.scm (call-with-error-handling): Add case for message and
fix-hint?.
2018-01-07 23:46:39 +01:00
Ludovic Courtès 92f36323c4
ui: It's 2018 now!
* guix/ui.scm (show-version-and-exit): Change year to 2018.
2018-01-01 18:22:28 +01:00
Ludovic Courtès 399993f804
ui: Non-zero exit for compound '&message' and '&error-location' conditions.
* guix/ui.scm (call-with-error-handling): When both 'message?' and
'error-location?' are true, add call to 'exit'.
2017-12-18 17:52:58 +01:00
Ludovic Courtès 3b80b81358
ui: Display hints to resolve profile collisions.
Fixes <https://bugs.gnu.org/29255>.
Reported by Ben Sturmfels <ben@sturm.com.au>.

* guix/ui.scm (display-collision-resolution-hint): New procedure.
(call-with-error-handling): Call it upon '&profile-collistion-error'.
2017-12-10 23:44:58 +01:00
Ludovic Courtès 3fb6464ba4
ui: Tweak conflicting profile entry error message.
* guix/ui.scm (call-with-error-handling): Use 'manifest-entry-output*'
when reporting conflicting profile entries.
2017-12-03 23:18:53 +01:00
Ludovic Courtès e2721a05e7
Do not set '%fresh-auto-compile'.
* guix/scripts/offload.scm (build-machines): Comment out
'(set! %fresh-auto-compile #t)' since with Guile 2.2.3 it could lead to
an actual rebuild of everything that gets loaded from there on.  See
<https://bugs.gnu.org/29226>.
* guix/ui.scm (load*): Likewise.
2017-12-01 18:47:34 +01:00
Ludovic Courtès e42f026eb5
ui: Present 'use-modules' hints with a question mark.
Suggested by myglc2 <myglc2@gmail.com>.

* guix/ui.scm (report-load-error): Write "Did you forget" rather than
"Try adding."
2017-11-30 18:14:56 +01:00
Ludovic Courtès 0d2ecf8b50
ui: Avoid "pkg:out" syntax when reporting collisions.
* guix/ui.scm (call-with-error-handling)[manifest-entry-output*]: New
procedure.  Use it when reporting collisions.
2017-11-28 10:18:40 +01:00
Ludovic Courtès b5bfa4773d
ui: 'known-variable-definition' protects against module cycles.
Fixes <https://bugs.gnu.org/29358>.
Reported by Marius Bakke <mbakke@fastmail.com>.

* guix/ui.scm (known-variable-definition): Add 'visited' set to guard
against cycles on 2.0.
2017-11-24 18:16:43 +01:00
Ludovic Courtès 304a53f67a
ui: Add source file name to the package search metrics.
* guix/ui.scm (%package-metrics): Include 'package-location'.  Increase
score of the other fields.
2017-11-16 08:45:15 +01:00
Ludovic Courtès dc856223f5
ui: Add an 'unbound-variable' exception printer.
* guix/ui.scm (print-unbound-variable-error): New variable.
Use it as the 'unbound-variable' printer.
2017-11-09 23:54:47 +01:00
Ludovic Courtès a2985bb101
ui: Provide hints for unbound-variable errors.
* guix/ui.scm (known-variable-definition): New procedure.
(report-load-error): Handle 'unbound-variable'.
2017-11-09 23:54:47 +01:00
Ludovic Courtès 935542fbde
ui: Add 'display-hint'.
* guix/ui.scm (known-variable-definition): New procedure.
(report-load-error): Use it.
2017-11-09 23:54:47 +01:00
Ludovic Courtès 23735137eb
ui: Define and honor '&error-location' and '&fix-hint' conditions.
* guix/utils.scm (&error-location, &fix-hint): New condition types.
* guix/ui.scm (report-load-error): Handle them.
(call-with-error-handling): Honor '&error-location'.
2017-11-08 22:31:58 +01:00
Ludovic Courtès 37eed374d9
ui: Introduce (guix i18n).
* guix/ui.scm (G_, N_, _P, %gettext-domain, %package-text-domain): Move
to...
* guix/i18n.scm: ... here.  New file.
2017-11-08 22:31:58 +01:00
Ludovic Courtès a6e22d8445
ui: Improve reporting of missing closing parentheses.
Suggested by Ricardo Wurmus.
Works around <https://bugs.gnu.org/28295>.

* guix/ui.scm (report-load-error): Add case for 'read-error'.
* tests/guix-system.sh: Test missing-closing-paren errors.
2017-10-10 23:12:03 +02:00
Ludovic Courtès 0649321d91
guix system: Add 'search' command.
* guix/scripts/system.scm (resolve-subcommand): New procedure.
(process-command): Handle 'search'.
(guix-system): Likewise.
(show-help): Augment.
* guix/scripts/system/search.scm: New file.
* po/guix/POTFILES.in: Add it.
* Makefile.am (MODULES): Add it.
* guix/ui.scm (%text-width): Export.
* doc/guix.texi (Invoking guix system): Document it.
(Service Types and Services): Mention 'guix system search'.
* tests/guix-system.sh: Test it.
2017-09-16 17:47:46 +02:00
Ludovic Courtès c7ae219e39
ui: Generalize relevance computation.
* guix/ui.scm (relevance, package-relevance): New procedures.
(%package-metrics): New variable.
* guix/scripts/package.scm (find-packages-by-description)[score]
[package-score]: Remove.  Use 'package-relevance' instead.
2017-09-16 17:47:45 +02:00
Ludovic Courtès f0e492f0a5
utils: Factorize XDG directory handling.
* guix/ui.scm (config-directory): Remove.
* guix/utils.scm (xdg-directory, config-directory): New procedures.
(cache-directory): Rewrite in terms of 'xdg-directory'.
* guix/scripts/substitute.scm (%narinfo-cache-directory): Pass #:ensure?
 #f to 'cache-directory'.
2017-07-28 18:09:43 +02:00
宋文武 dbde386ee3
ui: package->recutlis: Remove duplicated package names in dependencies.
* guix/ui.scm (package->recutils): Add call to 'delete-duplicates' in
'dependencies->recutils'.
2017-07-02 13:14:16 +08:00
Ludovic Courtès a654dc4bcf
profiles: Catch and report collisions in the profile.
* guix/profiles.scm (&profile-collision-error): New error condition.
(manifest-transitive-entries, manifest-entry-lookup, lower-manifest-entry)
(check-for-collisions): New procedures.
(profile-derivation): Add call to 'check-for-collisions'.
* guix/ui.scm (call-with-error-handling): Handle '&profile-collision-error'.
* tests/profiles.scm ("collision", "collision of propagated inputs")
("no collision"): New tests.
2017-06-21 11:05:53 +02:00
Ludovic Courtès f4453df9a5
store: Add an RPC counter.
* guix/store.scm (%rpc-calls): New variable.
(show-rpc-profile, record-operation): New procedures.
(operation): Add call to 'record-operation'.
* guix/ui.scm (run-guix-command): Wrap COMMAND-MAIN in 'dynamic-wind'.
Run EXIT-HOOK.
2017-06-16 17:08:22 +02:00
Ludovic Courtès cbee955901
ui: Remove the empty string from '%load-extensions'.
* guix/ui.scm (run-guix): Set %LOAD-EXTENSIONS.
2017-06-15 23:07:47 +02:00
Ludovic Courtès 4ee79f22f5
ui: 'package->recutils' takes #:extra-fields.
* guix/ui.scm (package->recutils): Add #:extra-fields and honor it.
2017-06-13 23:22:19 +02:00
Ludovic Courtès dcfc6f213b
ui: 'show-what-to-build' warns when we don't have enough disk space.
* guix/ui.scm (check-available-space): New procedure.
(show-what-to-build): Compute 'installed-size' and call
'check-available-space'.
2017-06-02 18:47:07 +02:00
Ludovic Courtès d9bad2f082
ui: 'show-what-to-build' displays how much will be downloaded.
* guix/ui.scm (show-what-to-build)[download-size]
[display-download-size?]: New variables.
Add cases for when DISPLAY-DOWNLOAD-SIZE? is true.
2017-06-02 18:47:06 +02:00
Ludovic Courtès 2dc98729af
derivations: 'derivation-prerequisites-to-build' returns <substitutable>.
* guix/derivations.scm (derivation-prerequisites-to-build): Rename
 #:substitutable? to #:substitutable-info.
[derivation-substitutable?]: Rename to...
[derivation-substitutable-info]: ... this.  Return a list of <substitutable>.
Second return value is now a list of <substitutable> instead of a list
of strings.
* guix/ui.scm (show-what-to-build)[substitutable?]: Rename to...
[substitutable-info]: ... this.
Adjust to new 'derivation-prerequisites-to-build' return value type.
* tests/derivations.scm ("derivation-prerequisites-to-build and
substitutes"): Adjust.
("derivation-prerequisites-to-build and substitutes, local build"):
Likewise.
2017-06-02 18:47:06 +02:00
Ludovic Courtès ce92d269fe
ui: Disable Guile deprecation warnings by default.
* guix/ui.scm (initialize-guix): Call (debug-disable 'warn-deprecated)
when "GUILE_WARN_DEPRECATED" is not set.
2017-05-16 14:31:37 +02:00
Ludovic Courtès e06ca952ed
scripts: Do not create the config directory.
This fixes runs of 'guix package' and 'guix system' tests in
environments where $HOME is read-only.

* guix/ui.scm (config-directory): Add #:ensure? parameter and honor it.
* guix/scripts.scm (warn-about-old-distro): Pass #:ensure? #f to
'config-directory'.
2017-05-13 00:03:46 +02:00
Ludovic Courtès 30d2397f73
ui: 'string->duration' correctly handles hours.
* guix/ui.scm (string->duration): Add missing '=>' for hours.
* tests/ui.scm ("duration, 2 hours"): New test.
2017-05-10 22:05:21 +02:00
Ludovic Courtès 69daee23af
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance.  See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.

* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'.  Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 16:16:17 +02:00
Ludovic Courtès f816dba680
ui: Gracefully report '&message' conditions.
* guix/ui.scm (report-load-error, warn-about-load-error)
(read/eval): Add special-case for SRFI-35 &message conditions.
2017-04-16 00:48:07 +02:00
Ludovic Courtès 3e43166ffc
gexp: 'lower-object' raises an exception when passed an invalid object.
* guix/gexp.scm (&gexp-error, &gexp-input-error): New error conditions.
(lower-object): Raise &gexp-input-error when 'lookup-compiler' returns #f.
* tests/gexp.scm ("lower-object & gexp-input-error?"): New test.
* guix/ui.scm (call-with-error-handling): Add case for 'gexp-input-error?'.
2017-04-04 00:10:00 +02:00
Alex Kost 689db38e34
ui: Support Texinfo markup in package synopses.
* guix/ui.scm (package-field-string): New procedure.
(package-description-string): Use it.
(package-synopsis-string): New procedure.
(package->recutils): Use it.
* guix/scripts/lint.scm (check-synopsis-style)[check-texinfo-markup]:
New procedure.  Use it in checks.
* tests/lint.scm: Test it.
* gnu/packages/perl.scm (perl-try-tiny)[synopsis]: Adjust for the
Texinfo markup.
2017-03-27 10:55:16 +03:00
Ludovic Courtès 1062063a65
ui: Don't use '%default-port-encoding' to set the encoding of string ports.
* guix/ui.scm (right-arrow): Call 'set-port-encoding!' to set PORT's
encoding; remove use of 'with-fluids'.  This is for compatibility with
Guile 2.2 where the encoding of string ports is not influenced by
%DEFAULT-PORT-ENCODING.
* tests/ui.scm ("show-manifest-transaction"): Likewise.
2017-03-08 23:42:53 +01:00
Ludovic Courtès 30906825cb
ui: Avoid '_' as a pattern variable in 'match'.
* guix/ui.scm (fill-paragraph): Don't use '_' as a pattern variable
since that is shadowed by the top-level '_' binding on Guile 2.2.
(show-manifest-transaction): Likewise.
2017-03-08 23:42:53 +01:00
Ludovic Courtès 6d30b1b2ca
ui: Wrap 'canonicalize-path' for better error reporting.
Reported by Christopher Baines.

* guix/ui.scm (canonicalize-path): New procedure.
2017-01-13 18:24:19 +01:00
Ludovic Courtès e7ff05438f
ui: Factorize error-reporting wrapper code.
* guix/ui.scm (augmented-system-error-handler): New procedure.
(error-reporting-wrapper): New macro.
(symlink, copy-file): Define using 'error-reporting-wrapper'.
2017-01-13 18:24:19 +01:00
Ludovic Courtès d925cdc35f
ui: Keep the word "Copyright" untranslated.
Suggested by John Darrington <john@darrington.wattle.id.au>.

* guix/ui.scm (show-version-and-exit): Make "Copyright (C) 2017"
untranslatable, except "(C)" itself, like Gnulib's version-etc does.
2017-01-02 23:14:36 +01:00
Ludovic Courtès 74d862e8a2
ui: It's 2017 now!
* guix/ui.scm (show-version-and-exit): Change year to 2017.
2017-01-01 23:38:52 +01:00
Roel Janssen 88bdbb2a0f
guix package: Display newline after generation diffs.
* guix/ui.scm (display-profile-content-diff): Display an extra newline.
2016-11-17 23:49:29 +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
Roel Janssen e95ae7c223
guix package: Display generation diffs.
* guix/ui.scm (display-profile-content-diff): New variable.
* guix/scripts/package.scm (process-query): Use display-profile-content-diff.

In collaboration with Benz Schenk.
2016-10-26 14:53:29 +02:00
Ludovic Courtès e465d9e190
ui: Do not shadow '_' where it's used as a literal syntax match.
Fixes compilation with Guile 2.1.
Reported by Mu Lei.

* guix/ui.scm (report-load-error)
(warn-about-load-error, read/eval-package-expression): Use 'rest'
instead of '_' as the pattern variable name.
* gnu/packages.scm (%find-package): Likewise.
* guix/scripts/build.scm (transform-package-inputs): Likewise.
* guix/scripts/hash.scm (guix-hash): Likewise.
* guix/scripts/import/gnu.scm (%options, guix-import-gnu): Likewise.
* guix/scripts/import/nix.scm (guix-import-nix): Likewise.
* guix/scripts/offload.scm (build-machines): Likewise.
* guix/scripts/refresh.scm (%options): Likewise.
* guix/scripts/substitute.scm (narinfo-signature->canonical-sexp):
Likewise.
2016-09-20 23:22:42 +09:00
Ludovic Courtès 14d5ca2e2e
ui: Initialize %FILE-PORT-NAME-CANONICALIZATION to #f.
This avoids loads of needless 'stat' calls due to the default 'relative
setting and the 'canonicalize-path' calls it leads to.  This was
especially visible when 'guix substitute' access files in
/var/guix/substitute/cache.

* guix/ui.scm (run-guix-command): Set %FILE-PORT-NAME-CANONICALIZATION
to #f.
2016-09-05 00:06:47 +02:00
Ludovic Courtès d77a0bd6f1
ui: Remove dependency on (gnu system file-systems).
* guix/ui.scm (specification->file-system-mapping): Move to...
* gnu/system/file-systems.scm (specification->file-system-mapping):
... here.
2016-08-04 19:38:33 +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
Mathieu Lirzin cf5f2ad30c
ui: Let users report translation bugs.
* guix/ui.scm (show-bug-report-information): Add a comment for
translators.
2016-05-24 12:58:40 +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 9703fef415 ui: Use 'terminal-columns'.
* guix/ui.scm (%text-width): Default to (terminal-columns).
2016-04-15 00:32:18 +02:00
Ludovic Courtès 069d43a765 ui: 'package->recutils' accurately honors the number of columns.
* guix/ui.scm (package->recutils)[width*]: New variable.  Use it instead
of WIDTH.
2016-04-15 00:32:18 +02:00