From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:45968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQNpN-0002Ik-Be for guix-patches@gnu.org; Mon, 13 May 2019 23:10:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQNpL-00042V-7L for guix-patches@gnu.org; Mon, 13 May 2019 23:10:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33279) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQNpL-00041P-0D for guix-patches@gnu.org; Mon, 13 May 2019 23:10:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hQNpK-0007Rb-KX for guix-patches@gnu.org; Mon, 13 May 2019 23:10:02 -0400 Subject: bug#35692: [PATCH] system: vm: Auto-detect if inputs should be registered. Resent-To: guix-patches@gnu.org Resent-Message-ID: From: Maxim Cournoyer References: <87d0kov6kx.fsf@gmail.com> <87a7frtl5i.fsf@gnu.org> Date: Mon, 13 May 2019 23:09:31 -0400 In-Reply-To: <87a7frtl5i.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 12 May 2019 23:31:21 +0200") Message-ID: <87sgth7mvo.fsf@gmail.com> 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35692-done@debbugs.gnu.org Hello! Ludovic Court=C3=A8s writes: [...] >>>>From 59d78c066727d5c3df22a6e269025ae7e058b45c Mon Sep 17 00:00:00 2001 >> From: Maxim Cournoyer >> Date: Tue, 16 Apr 2019 17:15:02 -0400 >> Subject: [PATCH] system: vm: Auto-detect if inputs should be registered. > ^ > I=E2=80=99d just write =E2=80=9Cvm:=E2=80=9D here. Done. >> The argument REGISTER-CLOSURE? of the SYSTEM-DOCKER-IMAGE procedure can = be >> removed and its value computed automatically, since the operating-system >> definition is available in its context. When the operating-system defin= ition >> does not contain the GUIX-SERVICE-TYPE, do not register the closure in t= he >> database of Guix, as it takes time and doesn't serve a purpose. >> >> * gnu/system/vm.scm (use-modules): Add (gnu services base). > > Nitpick: We don=E2=80=99t usually document =E2=80=98use-modules=E2=80=99 = changes here. OK. I've removed it. >> (system-docker-image): Remove the REGISTER-CLOSURES? argument, as well a= s its >> associate documentation in the docstring. >> [has-guix-service-type?] Add predicate and use it to compute the value o= f the >> REGISTER-CLOSURE? argument of the INITIALIZE procedure. > >> +(define (has-guix-service-type? os) >> + (find (lambda (service) >> + (eq? (service-kind service) guix-service-type)) >> + (operating-system-services os))) > > Please add a docstring and make sure there are not tabs. :-) > Otherwise LGTM, thank you! No, thanks to you for tirelessly reviewing many contributions while also producing a mind boggling amount of new code/features :-). I noticed that this change was breaking tests/guix-system.sh. The reason was that the HAS-GUIX-SERVICE predicate could return a service type as a truthy value, which was unwieldy when passed to environments which lack the service definition. The solution is to ensure that the predicate return booleans values, using (not (not ...)). I've also slightly improved the commit message and some docstrings, and pus= hed as commit d03de6be0aa2e2889314b5ed9a8867375363d79f. Thank you! Maxim