From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:43018) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmM52-0001Qg-0C for guix-patches@gnu.org; Sat, 13 Jul 2019 13:45:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmM50-0000Oa-H8 for guix-patches@gnu.org; Sat, 13 Jul 2019 13:45:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34503) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hmM50-0000Nq-Dm for guix-patches@gnu.org; Sat, 13 Jul 2019 13:45:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hmM50-0005v9-At for guix-patches@gnu.org; Sat, 13 Jul 2019 13:45:02 -0400 Subject: [bug#36555] [PATCH 1/2] guix system: Add 'reconfigure' module. Resent-Message-ID: From: zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) References: <87imsci9sj.fsf@sdf.lonestar.org> <87ef30i9fl.fsf@sdf.lonestar.org> <87y3129qsn.fsf@gnu.org> Date: Sat, 13 Jul 2019 13:44:13 -0400 In-Reply-To: <87y3129qsn.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 13 Jul 2019 12:23:20 +0200") Message-ID: <87sgr9bziq.fsf@sdf.lonestar.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 36555@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Ludovic! Ludovic Court=C3=A8s writes: > These would look nicer if =E2=80=98switch-system-program=E2=80=99 and > =E2=80=98upgrade-services-program=E2=80=99 returns a becau= se you could > just write: > > (machine-remote-eval #~(primitive-load #$(switch-system-program =E2=80= =A6)) > machine) > > (I realize the order of arguments is reversed; to stick to what =E2=80=98= eval=E2=80=99 > does, I=E2=80=99d tend to put the =E2=80=98machine=E2=80=99 argument seco= nd=E2=80=94but that=E2=80=99s a > separate issue. :-)) I'm using 'gexp->script', so they should be returning a 'program-file'. I've just neglected the conveniences I'm afforded with ungexp, it seems. #~(primitive-load #$(switch-system-program =E2=80=A6)) is, indeed, quite a = bit cleaner :) > Can we remove =E2=80=98with-output-to-string=E2=80=99? I=E2=80=99d rather= see what=E2=80=99s going on. > :-) > > If that=E2=80=99s too verbose, we can use =E2=80=98invoke/quiet=E2=80=99. I'm not too concerned with verbosity; rather, in the case for 'guix deploy', the script's output mixes with the REPL output and that causes 'remote-eval' to fail with a match error. I think it would be better to continue using 'with-output-to-string', but to preseve its return value so we can show it to the user from 'guix deploy' or 'guix system reconfigure'. Users of 'guix deploy' would also be able to see the script's output this way. > It seems that this sort-of inlines parts of =E2=80=98shepherd-service-upg= rade=E2=80=99 > but without traversing the service dependency graph to determine the > compilete set of obsolete services, no? I feel that we should be > reusing =E2=80=98shepherd-service-upgrade=E2=80=99 or similar bits. (I re= alize this is > already in =E2=80=98master=E2=80=99 for =E2=80=98guix deploy=E2=80=99, bu= t since this is going to be > shared with =E2=80=98guix system=E2=80=99, we=E2=80=99d rather be extra c= autious.) Does 'live-service-requirement' not encompass the full service dependency graph? Regardless, I'll look into reusing 'shepherd-service-upgrade' as it's well-testsed. > Also, I think we should remove =E2=80=98false-if-exception=E2=80=99 around > =E2=80=98unload-service=E2=80=99. Agreed. When you have time to look at it, I've raised a few questions about this in v2 of this series. > I=E2=80=99d rather not swallow stdout and not use =E2=80=98error=E2=80=99= . Or at least, code > that runs =E2=80=98install-bootloader-program=E2=80=99 should be able to = produce a > meaningful (and i18n=E2=80=99d) error message. So the caller could do > something like: > > (define result > (machine-eval #~(=E2=80=A6 > (guard (c ((message-condition? c) > (cons 'error (condition-message c)))) > (invoke/quiet #$(install-bootloader-program =E2=80= =A6)) > '(success))) > machine)) > > (match result > (('error message) > (leave (G_ "failed to install bootloader:~%~a~%") message)) > (('success) > #t)) > > Does that make sense? Yes, and thank you for providing that snippet :) > That=E2=80=99s quite some boilerplate to the challenge will be to factori= ze > it. > > Ultimately, the code in (guix scripts system reconfigure) should be > parameterized by an evaluation procedure that would be either > =E2=80=98machine-eval=E2=80=99 or some hypothetical =E2=80=98local-eval= =E2=80=99 procedure to evaluate > things locally. Noted. That should be a relatively small change, so I'll see about tackling that in my next revision for this series. Regards, Jakob --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl0qGG4ACgkQ9Qb9Fp2P 2Vo/IA/+P4XQkXT6NwI8EX2XDj61ucNFUUElG3dDavbHN2PcNxX5JnD5JPZvvb1O GyQEiRb9KOoiM4HgT+4FA+Pb6+YedlenZuQn5Hxd/msGabrw7L8E/yaodgPvPZUU 0S0W7m04xg9SBSvVbIWiF9JviRK8PzigOHGvud7Hexm/AcxcyZFjtn1OHnt4ovZp abcI2ZD/76FSN3yTWaL/Kl+vz7dR4cbQPzjEXPWRCV2VOYDJ3F1iaGAr1FK9odZZ IvKoixUEqJOw995ksgzIQhfJ5/dsf92zIr57T9rw0pjubPNuNtFnG1PGCLYBd0y0 AKWMwkILc1whrCFiWoOe5wqjZxlXsr5l8Y46SNBsvWrsGPtqLlOIZWm7ZMEP48kd qegWv9LevlfF7vueqWzXykfgGfgwn5xjuZhkyyvpyGPbBTWxwetstGznlodY8T/s akqk/v4Zg1gwYA76PG94ZEb3haFaAVMve9gDaJCi6W8KD0KAyDPRJIHMjYUJ4aZd yBIs4qTWh4B2Qg0cH1H33v8M0uAYgx30FabG0qhz5SOxVJpJouWHBEPZlpLMbL3X Z2YHHWaTWeFj+Tm0ZUP/6hofJP0mG1W7N/JD5sPGI1qC6ulsGqeNonqEGfvvCkXQ /9hOeH2WXDP3nXjlFqVgtlPZlKMZ7cBJE5VCJd6Gg74VMZ5xDCI= =m3I+ -----END PGP SIGNATURE----- --=-=-=--