From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:50964) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSLl5-0001vZ-IK for guix-patches@gnu.org; Wed, 06 Nov 2019 08:54:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iSLl4-0000pQ-7n for guix-patches@gnu.org; Wed, 06 Nov 2019 08:54:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59014) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iSLl4-0000pC-4J for guix-patches@gnu.org; Wed, 06 Nov 2019 08:54:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iSLl4-0004ZA-05 for guix-patches@gnu.org; Wed, 06 Nov 2019 08:54:02 -0500 Subject: [bug#37978] [PATCH] guix: new command "guix time-machine" Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: Date: Wed, 06 Nov 2019 14:53:40 +0100 In-Reply-To: (Konrad Hinsen's message of "Fri, 25 Oct 2019 17:42:21 +0200") Message-ID: <87y2wt3ycb.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Konrad Hinsen Cc: 37978@debbugs.gnu.org Hello Konrad! Konrad Hinsen 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=E2=80=99ll get bonus points if you mention the modified entities in parentheses (see =E2=80=98git log=E2=80=99 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=E2=80=99s more widely useful than =E2=80=98guix processes=E2=80=99 for instance? Actually, it co= uld go under =E2=80=9CPackage Management=E2=80=9D right before =E2=80=9CInferiors=E2=80= =9D, WDYT? > The @command{guix describe --format=3Dchannels} command can even generat= e 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 =E2=80=9Cguix time-machine @var{options}@dots{} -- =E2= =80=A6=E2=80=9D, right? IIUC, if you run: guix time-machine -- build hello you build =E2=80=9Chello=E2=80=9D 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 defi= ne > +this version can be specified using the following options: Perhaps add =E2=80=9Clike for @command{guix pull}=E2=80=9D. > -(define* (inferior-for-channels channels > - #:key > - (cache-directory (%inferior-cache-direct= ory)) > - (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 =E2=80=98cached-channel-instance=E2=80=99 (or simi= lar), and (2) not opening a connection to the daemon? Regarding (2), it means that procedure would be a monadic procedure and it=E2=80=99s 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 (=E2=80=98inferior-for-channels=E2=80=99 is one of the only exceptions to t= he rule because it=E2=80=99s 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=E2=80=99t create an extra process and actually get the exit = code for that sub-process. Thanks, Ludo=E2=80=99.