Commit Graph

18 Commits

Author SHA1 Message Date
Ludovic Courtès ab13e2be69
time-machine: Make target commit check cheaper.
Commit 79ec651a28 introduced a check to
error out when attempting to use ‘time-machine’ to travel to a commit
before ‘v1.0.0’.

This commit fixes a performance issue with the strategy used in
79ec651a28 (the repository was opened,
updated, and traversed a second time by ‘validate-guix-channel’) as well
as a user interface issue (“Updating channel” messages would be printed
too late).

This patch reimplements the check in terms of the existing #:validate-pull
mechanism, which is designed to avoid extra repository operations.

Fixes <https://issues.guix.gnu.org/65788>.

* guix/inferior.scm (cached-channel-instance): Change default value
of #:validate-channels.  Remove call to VALIDATE-CHANNELS; pass it
as #:validate-pull to ‘latest-channel-instances’.
* guix/scripts/time-machine.scm (%reference-channels): New variable.
(validate-guix-channel): New procedure, written as a simplification of…
(guix-time-machine)[validate-guix-channel]: … this.  Remove.
Pass #:reference-channels to ‘cached-channel-instance’.

Reported-by: Simon Tournier <zimon.toutoune@gmail.com>
Change-Id: I9b0ec61fba7354fe08b04a91f4bd32b72a35460c
2023-11-05 23:23:23 +01:00
Simon Tournier a293b1cfa7
scripts: time-machine: Handle EPIPE errors when displaying help.
* guix/scripts/time-machine.scm (%options): Handle EPIPE errors when
displaying help.
2023-10-17 14:52:05 +02:00
Maxim Cournoyer c3d48d024b
time-machine: Also validate the reference from a channels file.
* guix/scripts/time-machine.scm (guix-time-machine)
<validate-guix-channel>: Update doc.  Fall-back to use the Guix channel
reference when REF is #f.

Reported-by: Simon Tournier <zimon.toutoune@gmail.com>
Co-authored-by: Simon Tournier <zimon.toutoune@gmail.com>
2023-09-05 19:52:20 -04:00
Ludovic Courtès 9c8098424b
pull, time-machine: Add '-q' to ignore channel files.
This also fixes <https://issues.guix.gnu.org/63726>.

* guix/scripts/pull.scm (show-help, %options): Add '-q'.
(channel-list): Honor it.
* guix/scripts/time-machine.scm (show-help, %options): Add '-q'.
* doc/guix.texi (Invoking guix pull, Invoking guix time-machine):
Document it.

Reported-by: Simon Tournier <zimon.toutoune@gmail.com>
2023-08-17 17:33:53 +02:00
Maxim Cournoyer 79ec651a28
scripts: time-machine: Error when attempting to visit too old commits.
* doc/guix.texi (Invoking guix time-machine): Document limitation.
* guix/inferior.scm (cached-channel-instance): New VALIDATE-CHANNELS
argument.  Use it to validate channels when there are no cache hit.
* guix/scripts/time-machine.scm
(%options): Tag the given reference with 'tag-or-commit instead of 'commit.
(%oldest-possible-commit): New variable.
(guix-time-machine) <validate-guix-channel>: New nested procedure.  Pass it to
the 'cached-channel-instance' call.
* tests/guix-time-machine.sh: New test.
* Makefile.am (SH_TESTS): Register it.

Suggested-by: Simon Tournier <zimon.toutoune@gmail.com>
Reviewed-by: Ludovic Courtès <ludo@gnu.org>
Reviewed-by: Simon Tournier <zimon.toutoune@gmail.com>
2023-08-16 21:34:13 -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 7bd5f72918
inferior: 'cached-channel-instance' no longer calls 'show-what-to-build'.
This allows the user of 'cached-channel-instance' to install the build
handler of its choice.  In particular, it allows "guix time-machine" to
install a build notifier with the right options instead of using the
defaults that 'cached-channel-instance' would pass to
'show-what-to-build*'.

* guix/inferior.scm (cached-channel-instance): Remove call to
'show-what-to-build*'.
(inferior-for-channels): Wrap body in 'with-build-handler'.
* guix/scripts/time-machine.scm (guix-time-machine): Use
'with-build-handler'.
2021-08-09 18:14:37 +02:00
zimoun f1c4df15c3
time-machine: Fail when unrecognized option.
* guix/scripts/time-machine (parse-args): Fail when unrecognized option.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-03-11 23:19:53 +01:00
Mathieu Othacehe 8898eaec57
Revert "inferior: Break cached-channel-instance into two procedures."
This reverts commit 7d63b77551 because it raises
some concerns, see:
https://lists.gnu.org/archive/html/guix-devel/2021-03/msg00124.html.
2021-03-10 13:08:32 +01:00
Mathieu Othacehe 7d63b77551
inferior: Break cached-channel-instance into two procedures.
Break cached-channel-instance into two different procedures:
channels->cached-profile and instances->cached-profile operating respectively
on channels and channels instances.

* guix/inferior.scm (cached-channel-instance): Rename it into ...
(cached-profile): ... this new procedure.
(channels->cached-profile, instances->cached-profile): New procedures.
* guix/scripts/time-machine.scm (guix-time-machine): Adapt accordingly.
2021-03-10 08:49:48 +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 69db2993b5
git: Add 'with-git-error-handling'.
* guix/scripts/pull.scm (report-git-error, with-git-error-handling):
Move to...
* guix/git.scm: ... here.
* guix/scripts/time-machine.scm: Adjust accordingly.
2020-07-11 11:51:56 +02:00
Ludovic Courtès 838ac881ec
time-machine: Add '--disable-authentication'.
* guix/inferior.scm (cached-channel-instance): Add #:authenticate? and
pass it to 'latest-channel-instances'.
* guix/scripts/time-machine.scm (show-help, %options): Add
'--disable-authentication'.
(%default-options): Add 'authenticate-channels?'.
(guix-time-machine): Honor it.
2020-06-16 16:10:47 +02:00
Ludovic Courtès 7f44ab48f9
Use 'offload?' instead of 'build-hook?' internally.
* guix/scripts/archive.scm (%default-options): Replace 'build-hook?'
with 'offload?'.
* guix/scripts/build.scm (set-build-options-from-command-line): Pass
 #:offload? instead of #:use-build-hook?.
(%standard-build-options): Use the 'offload? key instead of 'build-hook?.
(%default-options): Replace 'build-hook?' with 'offload?'.
* guix/scripts/copy.scm (%default-options): Likewise.
* guix/scripts/deploy.scm (%default-options): Likewise.
* 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.
* guix/scripts/time-machine.scm (%default-options): Likewise.
* guix/store.scm (set-build-options): Have #:use-build-hook? default
to *unspecified*.  Add #:offload?.  Add call to 'warn-about-deprecation'
when #:use-build-hook? is specified.
2019-11-26 00:16:36 +01:00
Ludovic Courtès 87e7faa2ae
time-machine: Honor the standard build options.
* guix/scripts/time-machine.scm (show-help): Call 'show-build-options-help'.
(%options): Add %STANDARD-BUILD-OPTIONS.
(%default-options): New variable.
(parse-args): Pass (list %default-options) to 'parse-command-line' and
remove #:build-options? parameter.
(guix-time-machine): Call 'set-build-options-from-command-line' and wrap
'cached-channel-instance' call in 'with-status-verbosity'.
* doc/guix.texi (Invoking guix time-machine): Mention common build options.
2019-11-15 23:29:06 +01:00
Ludovic Courtès d17e012da7
time-machine: Handle 'git-error' exceptions.
* guix/scripts/pull.scm (with-git-error-handling): Export.
* guix/scripts/time-machine.scm (guix-time-machine): Wrap body in
'with-git-error-handling'.
2019-11-15 23:29:06 +01:00
Konrad Hinsen 1d5485690b
inferior: 'cached-channel-instance' takes an open store connection.
* guix/inferior.scm (cached-channel-instance): Take an explicit 'store'
argument.
(inferior-for-channels): Wrap call to 'cached-channel-instance' in
'with-store'.
* guix/time-machine.scm (guix-time-machine): Wrap call to
'cached-channel-instance' in 'with-store'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-11-15 23:28:17 +01:00
Konrad Hinsen f675f8dec7
Add 'guix time-machine'.
* guix/scripts/time-machine.scm: New file.
* Makefile.am: (MODULES): Add it.
* guix/scripts/pull.scm (channel-list): Export.
* guix/inferior.scm (cached-channel-instance): New procedure.
(inferior-for-channels): Use it.
* doc/guix.texi (Invoking guix time-machine): New section.
(Channels): Cross-reference it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-11-15 23:28:17 +01:00