unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Konrad Hinsen <konrad.hinsen@fastmail.net>
Cc: 37978@debbugs.gnu.org
Subject: [bug#37978] [PATCH] guix: new command "guix time-machine"
Date: Wed, 06 Nov 2019 14:53:40 +0100	[thread overview]
Message-ID: <87y2wt3ycb.fsf@gnu.org> (raw)
In-Reply-To: <m1bltzd4z7.fsf@ordinateur-de-catherine--konrad.home> (Konrad Hinsen's message of "Fri, 25 Oct 2019 17:42:21 +0200")

Hello Konrad!

Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:

> * guix/scripts/time-machine.scm: New file.
> * guix/scripts/pull.scm: Export function channel-list.
> * guix/inferior.scm: New function cached-guix-filetree-for-channels.
> * doc/guix.texi: Document "git time-machine"

Awesome.  :-)

Please also add time-machine.scm to Makefile.am.  In the commit log,
you’ll get bonus points if you mention the modified entities in
parentheses (see ‘git log’ for examples.)  :-)

> @@ -247,6 +247,7 @@ Utilities
>  * Invoking guix container::     Process isolation.
>  * Invoking guix weather::       Assessing substitute availability.
>  * Invoking guix processes::     Listing client processes.
> +* Invoking guix time-machine::  Running an older version of Guix.

How about moving this section a bit higher, because it’s more widely
useful than ‘guix processes’ for instance?  Actually, it could go under
“Package Management” right before “Inferiors”, WDYT?

>  The @command{guix describe --format=channels} command can even generate this
> -list of channels directly (@pxref{Invoking guix describe}).
> +list of channels directly (@pxref{Invoking guix describe}). The resulting
> +file can be used with the -C options of @command{guix pull}
> +(@pxref{Invoking guix pull}) or @command{guix time-machine}
> +(@pxref{Invoking guix time-machine}).

Nitpick: Please write two spaces after an end-of-sentence period.

> +The general syntax is:
> +
> +@example
> +guix time-machine @var{channels} -- @var{command} @var {arg}@dots{}
> +@end example

I think it should be “guix time-machine @var{options}@dots{} -- …”,
right?

IIUC, if you run:

  guix time-machine -- build hello

you build “hello” with the latest master, right?

Perhaps it would be good to add an example like this one actually, WDYT?

> +where @var{command} and @var{arg}@dots{} are passed unmodified to the
> +@command{guix} command in its old version.  The @var{channels} that define
> +this version can be specified using the following options:

Perhaps add “like for @command{guix pull}”.

> -(define* (inferior-for-channels channels
> -                                #:key
> -                                (cache-directory (%inferior-cache-directory))
> -                                (ttl (* 3600 24 30)))
> -  "Return an inferior for CHANNELS, a list of channels.  Use the cache at
> -CACHE-DIRECTORY, where entries can be reclaimed after TTL seconds.  This
> -procedure opens a new connection to the build daemon.
> -
> -This is a convenience procedure that people may use in manifests passed to
> -'guix package -m', for instance."
> +(define* (cached-guix-filetree-for-channels channels
> +                                            #:key
> +                                            (cache-directory (%inferior-cache-directory))
> +                                            (ttl (* 3600 24 30)))
> +  "Return a directory containing a guix filetree defined by CHANNELS, a list of channels.
> +The directory is a subdirectory of CACHE-DIRECTORY, where entries can be reclaimed after TTL seconds.
> +This procedure opens a new connection to the build daemon."

How about (1) calling it ‘cached-channel-instance’ (or similar), and (2)
not opening a connection to the daemon?

Regarding (2), it means that procedure would be a monadic procedure and
it’s up to the user to do with-store + run-with-store or whatever.  The
general convention is to not open new connections on behalf of the user
(‘inferior-for-channels’ is one of the only exceptions to the rule
because it’s a convenience function for use in manifests.)

Perhaps this change should be a separate patch.

> +(define (guix-time-machine . args)
> +  (with-error-handling
> +    (let* ((opts         (parse-args args))
> +           (channels     (channel-list opts))
> +           (command-line (assoc-ref opts 'exec))
> +           (directory    (cached-guix-filetree-for-channels channels))
> +           (executable   (string-append directory "/bin/guix")))
> +      (apply system* (cons executable command-line)))))

I think this should be:

  (apply execl executable command-line)

so that we don’t create an extra process and actually get the exit code
for that sub-process.

Thanks,
Ludo’.

  parent reply	other threads:[~2019-11-06 13:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 15:42 [bug#37978] [PATCH] guix: new command "guix time-machine" Konrad Hinsen
2019-10-25 15:42 ` [bug#37978] [PATCH 1/3] " Konrad Hinsen
2019-11-06 13:53 ` Ludovic Courtès [this message]
2019-11-06 14:27   ` [bug#37978] [PATCH] " Tobias Geerinckx-Rice via Guix-patches via
2019-11-07 13:11     ` Konrad Hinsen
2019-11-06 14:30   ` Ludovic Courtès
2019-11-07 19:40     ` Konrad Hinsen
2019-11-07 21:10       ` Ludovic Courtès
2019-11-08  7:14   ` Konrad Hinsen
2019-11-08 14:13     ` [bug#37978] [PATCH 1/2] " Konrad Hinsen
2019-11-10 12:00       ` Ludovic Courtès
2019-11-12 15:52         ` Konrad Hinsen
2019-11-08 14:15     ` [bug#37978] [PATCH 2/2] news: Add entry for " Konrad Hinsen
2019-11-08 20:43       ` pelzflorian (Florian Pelz)
2019-11-10 12:02         ` Ludovic Courtès
2019-11-08 14:16     ` [bug#37978] [PATCH] guix: new command " Konrad Hinsen
2019-11-15 22:35       ` bug#37978: " Ludovic Courtès
2019-11-16  9:06         ` [bug#37978] " Konrad Hinsen
2019-11-08 20:09     ` Ludovic Courtès
2019-11-08 10:16 ` [bug#37978] [PATCH 3/3] news: Add entry for " Konrad Hinsen
2019-11-08 14:15 ` [bug#37978] [PATCH 2/2] " Konrad Hinsen
2019-11-12 15:39 ` [bug#37978] [PATCH 2/3] guix: don't connect to daemon in cached-channel-instance Konrad Hinsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2wt3ycb.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=37978@debbugs.gnu.org \
    --cc=konrad.hinsen@fastmail.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).