Commit Graph

49 Commits

Author SHA1 Message Date
Maxim Cournoyer 3bc9082523
status: Guard against a numerical overflow condition.
Fixes <https://issues.guix.gnu.org/62766>.

* guix/status.scm (update-build): Use 0 as progress when an exception occurs
while computing it.
2023-04-10 22:18:29 -04:00
Ludovic Courtès ae587c2ef0
guix: Strip #:use-module lists.
This was obtained by setting up this environment:

  guix shell -D guix --with-input=guile@3.0.9=guile-next \
    --with-commit=guile-next=e2ed33ef0445c867fe56c247054aa67e834861f2
    -- make -j5

then adding 'unused-module' to (@@ (guix build compiler) %warnings),
building, and checking all the "unused module" warnings and removing
those that were definitely unused.
2023-03-13 15:08:33 +01:00
Ludovic Courtès 43c36c5c9f
ui: 'display-hint' quotes extra arguments for Texinfo.
Fixes <https://issues.guix.gnu.org/61201>.

Previously, common practice was to splice arbitrary strings (user names,
file names, etc.) into Texinfo snippets passed to 'display-hint'.  This
is unsafe in the general case because at signs and braces need to be
escaped to produced valid Texinfo.  This commit addresses that.

* guix/ui.scm (texinfo-quote): New procedure.
(display-hint): When ARGUMENTS is non-empty, pass it to 'texinfo-quote'
and call 'format'.
(report-unbound-variable-error, check-module-matches-file)
(display-collision-resolution-hint, run-guix-command): Remove explicit
'format' call; pass 'format' arguments as extra arguments to 'display-hint'.
* gnu/services/monitoring.scm (zabbix-front-end-config): Likewise.
* guix/scripts.scm (warn-about-disk-space): Likewise.
* guix/scripts/build.scm (%standard-cross-build-options)
(%standard-native-build-options): Likewise.
* guix/scripts/describe.scm (display-checkout-info): Likewise.
* guix/scripts/environment.scm (suggest-command-name): Likewise.
* guix/scripts/home.scm (process-command): Likewise.
* guix/scripts/home/edit.scm (service-type-not-found): Likewise.
* guix/scripts/import.scm (guix-import): Likewise.
* guix/scripts/package.scm (display-search-path-hint): Likewise.
* guix/scripts/pull.scm (build-and-install): Likewise.
* guix/scripts/shell.scm (auto-detect-manifest): Likewise.
* guix/scripts/system.scm (check-file-system-availability): Likewise.
(guix-system): Likewise.
* guix/scripts/system/edit.scm (service-type-not-found): Likewise.
* guix/status.scm (print-build-event): Likewise.
2023-02-27 23:40:43 +01:00
Ludovic Courtès 3ab8559436
status: Print a hint when a 'package-cache' hook fails to build.
* guix/channels.scm (package-cache-file): Add 'channels' to the #:properties
list.
* guix/status.scm (print-build-event): Upon failure, display a hint when
the derivation is a 'package-cache' hook.
2023-02-11 00:09:40 +01:00
Ludovic Courtès f99f00fc81
status: Relay "updating substitutes" messages.
Until now, those messages would be accumulated and displayed all at
once, when a '\n' was finally emitted by 'guix substitute'.  In the
meantime, clients would remain silent.

* guix/status.scm (bytevector-index): Change 'number' parameter to
'numbers' and adjust accordingly.
(build-event-output-port): Pass both #\newline and #\return to
'bytevector-index'.
* tests/status.scm ("build-output-port, daemon messages with LF"): New
test.
2022-06-26 23:19:14 +02:00
Ludovic Courtès 5d4d8d83e4
status: Do not pass a non-literal format string to 'format'.
* guix/status.scm (print-build-event): Use 'display' instead of 'format'
for hooks.
2022-02-16 16:49:27 +01:00
Ludovic Courtès 086813f63c
status: Use bold more sparsely at -v1.
Until now, at -v1, all the "apply N grafts" messages (for instance)
would be displayed in bold.  This would typically result in several
subsequent lines all bold, although none of them is particularly
interesting.  This improves on that by avoiding bold at -v1 for these
messages.

* guix/status.scm (print-build-event)[emph]: New variable.
Use it for the "View build log", "expected hash", and "offloading build"
messages.
[info]: Default to 'identity' when PRINT-URLS? and PRINT-LOG? are both
false.
2022-02-16 16:49:27 +01:00
Ludovic Courtès 3bed628b3e
status: Do not print .drv file names for grafts.
With this change, "guix build vim-full" prints:

  applying 15 grafts for vim-full-8.2.4306 ...

instead of showing /gnu/store/…-vim-full-8.2.4306.drv.

* guix/status.scm (print-build-event): In the 'graft' case, print just
the "package name" part of DRV.
2022-02-16 16:49:26 +01:00
Ricardo Wurmus 805af862c6
guix: Restore profile hook for TeX Live font maps.
Long ago we had a profile hook, called “texlive-configuration”, which would
operate on the texlive-* packages that have actually been installed in the
profile, build a union directory, and then install a texmf.cnf file that
declared the prefix of the TeX Live tree to be the union directory.  It then
generated font maps based on the fonts that had actually been installed.

This approach had multiple disadvantages, the worst of which was that you
could only really have one TeX Live tree.  Commit
04a0b1e09a addressed this, where texmf.cnf was
modified *once* and for all in texlive-bin to reference the GUIX_TEXMF
variable to determine the root of the tree.  This made much of
“texlive-configuration” obsolete, because we didn’t need to have any union
directories at all, because we had no need for a customized per-profile
variant of texmf.cnf.

Unfortunately, with the loss of the profile hook we would no longer build font
maps.  This patch resurrects the profile hook: we’re again generating font
maps (such as pdftex.map) based on the contents of the profile.

* gnu/packages/tex.scm (texlive-default-updmap.cfg): New variable.
* guix/profiles.scm (texlive-configuration): Rename this...
(texlive-font-maps): ...to this; update to run updmap-sys on the contents of
the profile to generate only font maps.
(%default-profile-hooks): Add texlive-font-maps.
* guix/status.scm (hook-message): Rename unused texlive-configuration to
texlive-font-maps.
2022-02-07 21:37:04 +01:00
Maxim Cournoyer 20e3dd052d
profiles: Add a gdk-pixbuf-loaders-cache-file hook.
This paves the way toward properly fixing https://issues.guix.gnu.org/50957.

* guix/profiles.scm (gdk-pixbuf-loaders-cache-file): Add procedure...
(%default-profile-hooks): ... and register it as a profile hook.
* guix/status.scm (hook-message): Register it here too.
2021-11-11 12:18:19 -05:00
Ludovic Courtès b1e48b5b4e
status: Add missing newline after substitution completion message.
* guix/status.scm (print-build-event): Add newline after "substitution
of ~a complete" message.
2021-07-04 23:00:36 +02:00
Ludovic Courtès a47f40b30d
status: Avoid abbreviation in messages.
This is a followup to 68228d80dd.

* guix/status.scm (hook-message): Spell out "sub-directories".
2021-05-05 00:57:35 +02:00
Leo Prikler 68228d80dd
profiles: Add hook for Emacs subdirs.
* guix/profiles.scm (emacs-subdirs): New variable.
(%default-profile-hooks): Add it here.
* guix/status.scm (hook-message): Add a message for emacs-subdirs.
2021-05-01 15:56:36 +02:00
Ludovic Courtès 64afc72962
status: Separate downloads upon '--verbosity=2'.
This is a followup to 1fa4aff1fb,
reintroducing the newline previously emitted by 'guix substitute' upon
download completion.

With this change, with '--verbosity=2', each download occupies three
lines again, like so:

--8<---------------cut here---------------start------------->8---
downloading from https://ci.guix.gnu.org/nar/lzip/…-jsoncpp-1.9.2 ...
 jsoncpp-1.9.2  93KiB                4.2MiB/s 00:00 [##################] 100.0%

--8<---------------cut here---------------end--------------->8---

This makes the output more readable.

* guix/status.scm (print-build-event): When PRINT-URLS? is true, print
a blank line after the download.
2021-04-23 00:32:30 +02:00
Ludovic Courtès e45ef9a648
status: Don't display download URLs for '--verbosity=1'.
With this change, each substitute occupies a single line of
output (instead of two) when using '-v1', the default for 'guix package'
& co.

* guix/status.scm (print-build-event): Add #:print-urls? and honor it.
(print-build-event/quiet): Pass #:print-urls? #f.
(print-build-event/quiet-with-urls): New procedure.
(logger-for-level): Add case for LEVEL 2.
* doc/guix.texi (Common Build Options): Adjust '--verbosity'
documentation.
2021-03-31 15:57:46 +02:00
Ludovic Courtès f7008ca713
download: Autoload (guix build download).
* guix/download.scm: Autoload (guix build download).
(url-fetch): Rename to...
(url-fetch*): ... this, locally, to allow for #:autoload.
* guix/status.scm: Autoload (guix build download).
2021-03-19 13:23:27 +01:00
Ludovic Courtès d613c1771a
status: Do not emit ANSI escapes when stderr is not a tty.
Fixes <https://bugs.gnu.org/44985>.
Reported by Simon Josefsson <simon@josefsson.org>.

* guix/progress.scm (display-download-progress): Add #:tty? and honor it.
* guix/status.scm (print-build-event): Pass #:tty? to
'display-download-progress'.
2020-12-18 16:13:39 +01:00
Ludovic Courtès 04594054d6
status: Remove extra space before ellipsis.
Extra space was introduced in 8fa4ac5be4.

* guix/status.scm (print-build-event): Remove extra space before
ellipsis.
2020-04-19 13:27:06 +02:00
TomZ 8fa4ac5be4
status: Allow double-click select of URLs.
Various places while downloading or compiling guix prints
the source URL. This change makes the URL easier to use by
placing a space between the URL and the trailing dots.

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
2020-04-17 17:03:05 +02:00
Marius Bakke 1c86577d62
Revert "Allow double-click select of URL in status"
As discussed on #guix, this should wait until 1.1.0 is branched off to avoid
having to update translations.

This reverts commit 9f1b787120.
2020-04-07 22:09:14 +02:00
TomZ 9f1b787120
Allow double-click select of URL in status
Various places while downloading or compiling guix prints
the source URL. This change makes the URL easier to use by
placing a space between the URL and the trailing dots.

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
2020-04-07 21:56:30 +02:00
Ludovic Courtès 260eae7893
status: Display synthetic information about profiles being built.
* guix/status.scm (print-build-event): Add 'profile case.
* guix/scripts/package.scm (build-and-use-profile): Remove now redundant
message.
2020-03-26 13:07:19 +01: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 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 5ea206a8a9
status: Erase the current line upon new builds or downloads.
* guix/status.scm (print-build-event): Add 'erase-current-line*' call
upon 'build-started, 'substituter-started, 'download-started.
2019-02-11 23:23:27 +01:00
Ludovic Courtès 024d5275c5
status: Do not systematically erase the previous line.
After a successful download, we'd erase the download-progress line, and
the end result would be two empty lines following the "downloading …"
line.

Reported by Ricardo Wurmus <rekado@elephly.net> at
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33470#27>.

* guix/status.scm (print-build-event)[erase-current-line*]: Set to a
no-op when PRINT-LOG? is true.
Move calls to 'erase-current-line*' to the 'build-succeeded' and
'build-failed' events.
2019-02-07 15:46:45 +01:00
Ludovic Courtès 596fb4baf0
status: Display the current build phase.
* guix/status.scm (spin!): Add 'phase' parameter and honor it.  Callers
updated.
(print-build-event)[report-progress]: Likewise.
2019-02-05 12:03:25 +01:00
Ludovic Courtès ba514b601b
status: Keep track of the current build phase.
* guix/status.scm (<build>)[phase]: New field.
(%phase-start-rx): New variable.
(update-build): Add clause to match %PHASE-START-RX and adjust the
'phase' field accordingly.
* tests/status.scm ("compute-status, build phase"): Add test
2019-02-05 12:03:25 +01:00
Ludovic Courtès c7465dcb96
status: Use 'define-immutable-record-type' and its functional setters.
* guix/status.scm (<build>): Define using
'define-immutable-record-type', and add 'set-build-completion' binding.
(update-build)[set-completion]: Remove.
Use 'set-build-completion' instead.
2019-02-05 12:03:25 +01:00
Ludovic Courtès 7473bce207
status: Erase the progress bar or spinner.
Previously the progress bar wouldn't be erased by the time the next
"building foo" line would be printed.

* guix/status.scm (print-build-event)[erase-current-line*]: New
procedure.
Call it instead of (display "\r").
2019-02-04 16:20:01 +01:00
Ludovic Courtès 3854c6429c
status: Print a progress bar for on-going builds when possible.
* guix/status.scm (print-build-event)[report-build-progress]: New
procedure.
[print-log-line]: Add ID parameter.  Call 'report-build-progress' when
appropriate.
Adjust callers.
2019-01-29 12:09:52 +01:00
Ludovic Courtès 73a8681a16
status: Keep track of build completion as reported by build tools.
* guix/status.scm (<build>)[completion]: New field.
(build): Add #:completion parameter.
(%percentage-line-rx, %fraction-line-rx): New variables.
(update-build): New procedure.
(compute-status): Add 'build-log' case.
* tests/status.scm ("compute-status, build completion"): New test.
2019-01-29 12:09:52 +01:00
Ludovic Courtès 976ef2d978
status: Record more information about builds.
* guix/status.scm (<build>): New record type.
(build, matching-build): New procedures.
(compute-status): Adjust to manipulate <build> records instead of
derivation file names in 'build-status-builds-completed' and
'build-status-building'.
(build-event-output-port)[process-line]: Use 'string-split' to preserve
spaces.
* tests/status.scm ("compute-status, builds + substitutes")
("compute-status, missing events"): Adjust to expect <build> records.
Produce complete "build-started" events.
("compute-status, multiplexed build output"): Likewise, and remove
"bar.drv" from 'builds-completed'.
2019-01-29 12:09:52 +01:00
Ludovic Courtès b9da4b931d
status: Distinguish 'package-cache' profile hook.
* guix/status.scm (hook-message): Handle 'package-cache'.
2019-01-15 20:24:09 +01:00
Ricardo Wurmus 743497b565
guix: Add profile hook to build TeX live configuration.
* guix/profiles.scm (texlive-configuration): New procedure.
(%default-profile-hooks): Add it.
* guix/status.scm (hook-message): Handle "texlive-configuration" hook type.
2019-01-15 13:05:22 +01:00
Ludovic Courtès 0c1bc5ecbe
status: Spin only on TTYs.
* guix/status.scm (isatty?*): New procedure.
(spin!): Do nothing when port matches ISATTY?*.
(color-output?): Use ISATTY?*.
2019-01-15 12:05:25 +01:00
Ludovic Courtès 7804c45b9c
status: Add 'with-status-verbosity'.
* guix/status.scm (logger-for-level, call-with-status-verbosity): New
procedures.
(with-status-verbosity): New macro.
* guix/scripts/environment.scm (guix-environment): Use
'with-status-verbosity' instead of 'with-status-report'.
* guix/scripts/pack.scm (guix-pack): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* build-aux/run-system-tests.scm (run-system-tests): Likewise.
2019-01-11 12:14:38 +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
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
Ludovic Courtès af1f1c38fb
status: Report grafting derivations specially.
* guix/status.scm (print-build-event): In 'build-started' event handler,
check the properties of DRV and handle 'graft' derivations specially.
2018-11-28 10:39:58 +01:00
Ludovic Courtès 694e638e78
status: Display 'build-remote' events.
* guix/status.scm (print-build-event): Add clause for 'build-remote'.
2018-11-23 15:42:00 +01:00
Eric Bavier 278f86a43f
ui: Fix port-buffering with guile@2.0.
* guix/status.scm (build-event-output-port)[guile@2.0]: Do not call 'setvbuf'
on custom binary port.
* tests/status.scm (current-build-output-port, UTF-8 + garbage)[guile@2.0]:
Use "?" in place of REPLACEMENT CHARACTER.
2018-10-16 17:12:09 -05:00
Ludovic Courtès f9a8fce10f
status: Build upon multiplexed build output.
This allows for more accurate status tracking and parsing of extended
build traces.

* guix/status.scm (multiplexed-output-supported?): New procedure.
(print-build-event): Don't print \r when PRINT-LOG? is true.
Adjust 'build-log' handling for when 'multiplexed-output-supported?'
returns true.
(bytevector-index, split-lines): New procedures.
(build-event-output-port)[%build-output-pid, %build-output]
[%build-output-left]: New variables.
[process-line]: Handle "@ build-output" traces.
[process-build-output]: New procedure.
[write!]: Add case for when %BUILD-OUTPUT-PID is true.  Use
'bytevector-index' rather than 'string-index'.
(compute-status): Add #:derivation-path->output-path.  Use it.
* tests/status.scm ("compute-status, multiplexed build output"):
New test.
("build-output-port, UTF-8")
("current-build-output-port, UTF-8 + garbage"): Adjust to new
'build-log' output.
* guix/scripts/build.scm (set-build-options-from-command-line):
Pass #:multiplexed-build-output?.
(%default-options): Add 'multiplexed-build-output?'.
* guix/scripts/environment.scm (%default-options): Likewise.
* guix/scripts/pack.scm (%default-options): Likewise.
* guix/scripts/package.scm (%default-options): Likewise.
* guix/scripts/pull.scm (%default-options): Likewise.
* guix/scripts/system.scm (%default-options): Likewise.
2018-10-15 23:06:55 +02:00
Ludovic Courtès 38a2f5eafb
status: Avoid "sucessfully built" messages when in quiet mode.
* guix/status.scm (print-build-event): Print "successfully built"
messages only when PRINT-LOG? is true, like we do for
'substituter-started' events.
2018-10-14 23:48:49 +02:00
Ludovic Courtès fe17037b38
status: Gracefully handle invalid UTF-8 in build logs.
* guix/status.scm (maybe-utf8->string): New procedure.
(build-event-output-port): Use it in lieu of 'utf8->string'.
* tests/status.scm ("build-output-port, UTF-8")
("current-build-output-port, UTF-8 + garbage"): New tests.
2018-10-09 18:54:12 +02:00
Ludovic Courtès f9051e3870
status: Always print the daemon's "waiting for locks" messages.
Reported by Ricardo Wurmus <rekado@elephly.net>.

* guix/status.scm (print-build-event) <build-log>: Let "waiting for
locks" messages through.
2018-09-30 22:20:13 +02:00
Ludovic Courtès 1dc876a39f
status: Tweak colorization.
* guix/status.scm (colorize-log-line): Add "\<" before "FAIL" (to
distinguish from "XFAIL".
Use MAGENTA instead of ORANGE, which doesn't exist.
2018-09-28 23:34:09 +02:00
Ludovic Courtès fb94d82bc2
status: Be more defensive when looking for a log file.
* guix/store.scm (derivation-log-file): New procedure.o
(log-file): Use it.
* guix/status.scm (print-build-event): Use 'derivation-log-file' instead
of 'log-file'.  Check wheter the return value is #f.
2018-09-28 23:28:03 +02: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