Commit Graph

24 Commits

Author SHA1 Message Date
Ludovic Courtès 316fc2acbb
channels: Record 'guix' channel metadata in (guix config).
Partially fixes <https://bugs.gnu.org/45896>.

* guix/config.scm.in (%channel-metadata): New variable.
* guix/describe.scm (channel-metadata): Use it.
(current-channels): New procedure.
(current-profile-entries): Clarify docstring.
* guix/self.scm (compiled-guix): Add #:channel-metadata and pass it to
'make-config.scm'.
(make-config.scm): Add #:channel-metadata and define '%channel-metadata'
in the generated file.
(guix-derivation): Add #:channel-metadata and pass it to 'compiled-guix'.
* guix/channels.scm (build-from-source): Replace 'name', 'source', and
'commit' parameters with 'instance'.  Pass #:channel-metadata to BUILD.
(build-channel-instance): Adjust accordingly.
* build-aux/build-self.scm (build-program): Add #:channel-metadata
and pass it to 'guix-derivation'.
(build): Add #:channel-metadata and pass it to 'build-program'.
* guix/scripts/describe.scm (display-profile-info): Add optional
'channels' parameter.  Pass it to 'display-profile-content'.
(display-profile-content): Add optional 'channels' parameter and honor
it.  Iterate on CHANNELS rather than on the manifest entries of
PROFILE.
(guix-describe): When PROFILE is #f, call 'current-channels' and pass it
to 'display-profile-info', unless it returns the empty list.
2021-02-04 09:23:39 +01:00
Ludovic Courtès 60d72f5364
channels: Add 'channel->code'.
* guix/channels.scm (channel->code): New procedure, taken from...
* guix/scripts/describe.scm (channel->sexp): ... here.
Adjust callers accordingly.
2021-02-01 17:32:35 +01:00
Ludovic Courtès 1b88b7bad2
guix describe: Use 'manifest-entry-channel'.
* guix/channels.scm (manifest-entry-channel): Export.
* guix/scripts/describe.scm (display-profile-content): Use it.
2021-02-01 17:32:35 +01:00
Ludovic Courtès 3794ce93be
scripts: Use 'define-command' and have 'guix help' use that.
This changes 'guix help' to print a short synopsis for each command and
to group commands by category.

* guix/scripts.scm (synopsis, category): New variables.
(define-command-categories, define-command): New macros.
(%command-categories): New variable.
* guix/ui.scm (<command>): New record type.
(source-file-command): New procedure.
(command-files): Return absolute file names.
(commands): Return a list of <command> records.
(show-guix-help)[display-commands, category-predicate]: New procedures.
Display commands grouped in three categories.
* guix/scripts/archive.scm (guix-archive): Use 'define-command'.
* guix/scripts/authenticate.scm (guix-authenticate): Likewise.
* guix/scripts/build.scm (guix-build): Likewise.
* guix/scripts/challenge.scm (guix-challenge): Likewise.
* guix/scripts/container.scm (guix-container): Likewise.
* guix/scripts/copy.scm (guix-copy): Likewise.
* guix/scripts/deploy.scm (guix-deploy): Likewise.
* guix/scripts/describe.scm (guix-describe): Likewise.
* guix/scripts/download.scm (guix-download): Likewise.
* guix/scripts/edit.scm (guix-edit): Likewise.
* guix/scripts/environment.scm (guix-environment): Likewise.
* guix/scripts/gc.scm (guix-gc): Likewise.
* guix/scripts/git.scm (guix-git): Likewise.
* guix/scripts/graph.scm (guix-graph): Likewise.
* guix/scripts/hash.scm (guix-hash): Likewise.
* guix/scripts/import.scm (guix-import): Likewise.
* guix/scripts/install.scm (guix-install): Likewise.
* guix/scripts/lint.scm (guix-lint): Likewise.
* guix/scripts/offload.scm (guix-offload): Likewise.
* guix/scripts/pack.scm (guix-pack): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/perform-download.scm (guix-perform-download): Likewise.
* guix/scripts/processes.scm (guix-processes): Likewise.
* guix/scripts/publish.scm (guix-publish): Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
* guix/scripts/refresh.scm (guix-refresh): Likewise.
* guix/scripts/remove.scm (guix-remove): Likewise.
* guix/scripts/repl.scm (guix-repl): Likewise.
* guix/scripts/search.scm (guix-search): Likewise.
* guix/scripts/show.scm (guix-show): Likewise.
* guix/scripts/size.scm (guix-size): Likewise.
* guix/scripts/substitute.scm (guix-substitute): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* guix/scripts/time-machine.scm (guix-time-machine): Likewise.
* guix/scripts/upgrade.scm (guix-upgrade): Likewise.
* guix/scripts/weather.scm (guix-weather): Likewise.
2020-09-10 12:27:24 +02:00
Ludovic Courtès 6d39f0cb77
guix describe: Display channel introductions and add 'channels-sans-intro'.
* guix/scripts/describe.scm (%available-formats): Add "channels-sans-intro".
(channel->sexp): Add #:include-introduction?.  Emit CHANNEL's intro if
INCLUDE-INTRODUCTION? is true and CHANNEL has an introduction.
(channel->json): Include CHANNEL's introduction, if any.
(channel->recutils): Likewise.
(display-profile-info): Add 'channels-sans-intro' case.
* doc/guix.texi (Invoking guix describe): Add introduction in example.
Add 'channels-sans-intro' case.
2020-07-01 23:34:51 +02:00
Ludovic Courtès 25b267afed
Add more (ice-9 format) imports.
* guix/scripts/describe.scm: Add missing (ice-9 format).
* guix/scripts/system.scm: Likewise.
2020-06-26 16:19:53 +02:00
Ekaitz Zarraga 9a27d84b7a
guix describe: Add '--list-formats'
* guix/scripts/describe.scm (%available-formats): New variable.
(list-formats): New procedure.
(%options, show-help): Add --list-formats
* doc/guix.texi: Add --list-formats

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-18 15:08:58 +02:00
Ludovic Courtès c2f9ea2b50
Revert "ui: Only display link in capable terminals."
This reverts commit d7545a6b53.

The commit led to a test failure in 'tests/guix-package-net.sh'.  It
also led to disagreements discussed here:

  https://lists.gnu.org/archive/html/guix-devel/2020-02/msg00353.html

Reverting until these are addressed.
2020-02-28 00:03:34 +01:00
zimoun d7545a6b53
ui: Only display link in capable terminals.
* guix/ui.scm (display-generation): Display generation path on new line.
* guix/scripts/describe.scm (channel-commit-hyperlink): Add TRANSFORMER argument.
(display-profile-content): Use TRANSFORMER argument to display URL explicitly
when terminal does not support hyperlinks.
2020-02-24 11:01:52 +01:00
Ludovic Courtès 1d88470e10
describe: Remove dependency on (guix scripts pull).
Until now, 'guix describe' would perform ~3K stat calls and ~1K openat
calls because it was pulling (guix scripts pull), which in turn pulls in
many (gnu packages …) modules.

* guix/scripts/pull.scm (display-profile-content, %vcs-web-views)
(channel-commit-hyperlink): Move to...
* guix/scripts/describe.scm: ... here.  Remove import of (guix scripts
pull).
2020-02-11 12:33:35 +01:00
Ludovic Courtès a7c714d398
channels: Add 'profile-channels'.
* guix/channels.scm (profile-channels): New procedure.
* guix/scripts/describe.scm (display-profile-info)[channels]: Define in
terms of 'profile-channels'.
2019-08-16 23:00:26 +02:00
Ludovic Courtès 0663302618
describe: Provide a hint when origin detection fails.
* guix/scripts/describe.scm (display-checkout-info): Add call to
'display-hint' in the error case.
2019-04-28 22:57:06 +02:00
Ludovic Courtès b6fd086a61
describe: Warn about 'GUIX_PACKAGE_PATH' in json and recutils format.
Fixes <https://bugs.gnu.org/34884>.
Reported by Pierre Neidhardt <mail@ambrevar.xyz>.

* guix/scripts/describe.scm (display-package-search-path): Add catch-all
case for FMT.
2019-03-18 10:51:05 +01:00
Ludovic Courtès ed9c8eb4e5
describe: In 'channels' format, quote the channel name.
Fixes a regression introduced in
commit 8548f99549.

* guix/scripts/describe.scm (channel->sexp): Quote the channel name.
2018-12-07 15:14:12 +01:00
Oleg Pykhalov 01262f1ece
describe: Delete 'directory' argument from 'display-checkout-info'.
This commit follows 1255400faa.

* guix/scripts/describe.scm (display-checkout-info): Delete 'directory'
argument.
2018-11-27 20:09:03 +03:00
Oleg Pykhalov 85e9c4b919
describe: Add recutils format.
* guix/scripts/describe.scm (channel->recutils): New procedure.
(display-checkout-info, display-profile-info): Use this.
(%options): Add 'recutils' option.
* doc/guix.texi (Invoking guix describe): Document this.
2018-11-22 21:17:55 +03:00
Oleg Pykhalov 81a40ee0cb
describe: Add json format.
* guix/scripts/describe.scm (channel->json): New procedure.
(display-checkout-info, display-profile-info): Use this.
(%options): Add 'json' option.
* doc/guix.texi (Invoking guix describe): Document this.
2018-11-22 21:17:54 +03:00
Oleg Pykhalov 8548f99549
describe: Use a procedure to format output.
* guix/scripts/describe.scm (channel->sexp): New procedure.
(display-checkout-info, display-profile-info): Use this.
2018-11-22 21:17:38 +03:00
Oleg Pykhalov 1255400faa
describe: Add profile option.
* guix/scripts/describe.scm (%options): Add profile option.
(show-help): Document this.
(display-checkout-info): Check for profile argument.
* doc/guix.texi (Invoking guix describe): Document this.
2018-11-21 14:41:13 +03:00
Oleg Pykhalov 3dd28aa37c
describe: Fix 'format' option.
Fix ‘guix describe’ ignores ‘--format=FORMAT’ option.

* guix/scripts/describe.scm (%options): Fix 'format' option.
2018-11-21 14:41:13 +03:00
Ludovic Courtès e0caff9ed0
describe: Canonicalize the profile.
Fixes a regression introduced in
795d430d90 whereby 'guix describe' would
no longer display the generation number of ~/.config/guix/current.

* guix/scripts/describe.scm (guix-describe): Call 'canonicalize-profile'.
2018-10-14 23:48:49 +02:00
Ludovic Courtès 912adda316
describe: Work correctly on generation-less profiles.
Previously a command like:

  $(readlink -f ~/.config/guix/current)/bin/guix describe

would succeed without printing anything.

* guix/scripts/describe.scm (display-profile-info): Don't call
'generation-file-name' when NUMBER is zero.
* guix/scripts/pull.scm (display-profile-content): Likewise.
2018-09-18 23:23:44 +02:00
Ludovic Courtès da34a19f3a
guix describe: Display information about the current generation.
* guix/scripts/describe.scm (display-profile-info)[number]: Use the
current generation number instead of the last generation number.
2018-09-07 14:19:42 +02:00
Ludovic Courtès bd7470185b
Add 'guix describe'.
* guix/scripts/describe.scm: New file.
* Makefile.am (MODULES): Add it.
(SH_TESTS): Add tests/guix-describe.sh.
* po/guix/POTFILES.in: Add it.
* guix/scripts/pull.scm (display-profile-content): Export.
* guix/describe.scm (current-profile, current-profile-entries): Export.
* tests/guix-describe.sh: New file.
* doc/guix.texi (Features): Mention 'guix pull' and provenance tracking.
(Invoking guix pull): Link to 'guix describe'.
(Channels): Likewise.
(Invoking guix describe): New node.
2018-09-07 11:40:22 +02:00