From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:52360) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hjsuZ-00023K-Va for guix-patches@gnu.org; Sat, 06 Jul 2019 18:12:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hjsuY-0006OG-Sh for guix-patches@gnu.org; Sat, 06 Jul 2019 18:12:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47134) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hjsuY-0006O3-OT for guix-patches@gnu.org; Sat, 06 Jul 2019 18:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hjsuY-00069m-Ij for guix-patches@gnu.org; Sat, 06 Jul 2019 18:12:02 -0400 Subject: [bug#36404] [PATCH 1/3] guix system: Add 'reconfigure' module. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87o92ianbj.fsf@sdf.lonestar.org> <87o92glap5.fsf@dustycloud.org> <878sthoqzi.fsf@gnu.org> <87r2799tzd.fsf@sdf.lonestar.org> <87d0isrsmk.fsf@sdf.lonestar.org> <878std3fw0.fsf@sdf.lonestar.org> <87wogwoqrg.fsf@gnu.org> <87bly8f3kq.fsf_-_@sdf.lonestar.org> <877e8wf3iz.fsf_-_@sdf.lonestar.org> Date: Sun, 07 Jul 2019 00:11:49 +0200 In-Reply-To: <877e8wf3iz.fsf_-_@sdf.lonestar.org> (Jakob L. Kreuze's message of "Fri, 05 Jul 2019 19:46:44 -0400") Message-ID: <877e8ug6e2.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: "Jakob L. Kreuze" Cc: 36404@debbugs.gnu.org zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) skribis: > * guix/scripts/system/reconfigure.scm: New file. > * Makefile.am (MODULES): Add it. > * guix/scripts/system.scm (bootloader-installer-script): Export variable. > +;;; Copyright =C2=A9 2019 Jakob L. Kreuze Could you preserve the copyright lines of (guix scripts system) that apply to these portions of code, roughly? I think all the procedures in (guix scripts system reconfigure) could return a rather than a gexp. Actually a would even be cleaner than a , as it could better handle transitions like you=E2=80=99re on a Guile 2.2 system reconfiguring towards= a Guile 3 system. Consequently you could rename =E2=80=98switch-to-system=E2=80=99 to =E2=80=98switch-system-program=E2=80=99, and so on. > +(define (switch-to-system system-derivation activation-script) I think it could simply take an record and derive the relevant bits from that. > + (switch-symlinks generation system) > + (switch-symlinks %system-profile generation) > + ;; The implementation of 'guix system reconfigure' saves the > + ;; load path and environment here. This is unnecessary here > + ;; because each invocation of 'remote-eval' runs in a distin= ct > + ;; Guile REPL. > + (setenv "GUIX_NEW_SYSTEM" system) This comment may become irrelevant. > + ;; The activation script may write to stdout, which confuses > + ;; 'remote-eval' when it attempts to read a result from the > + ;; remote REPL. We work around this by forcing the output to= a > + ;; string. > + (with-output-to-string > + (lambda () > + (primitive-load #$activation-script)))))))) Same here? For =E2=80=98guix system reconfigure=E2=80=99, we=E2=80=99d rat= her not lose messages written to stdout by ACTIVATION-SCRIPT. > + (unless (false-if-exception > + (begin > + ;; The implementation of 'guix system reconfigure' > + ;; saves the load path here. This is unnecessary = here > + ;; because each invocation of 'remote-eval' runs = in a > + ;; distinct Guile REPL. > + (install-boot-config #$bootcfg #$bootcfg-file #$t= arget) > + ;; The installation script may write to stdout, w= hich > + ;; confuses 'remote-eval' when it attempts to rea= d a > + ;; result from the remote REPL. We work around th= is > + ;; by forcing the output to a string. > + (with-output-to-string > + (lambda () > + (primitive-load #$installer-script))))) Same as above. Ludo=E2=80=99.