From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:33437) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikXVP-0000eZ-D7 for guix-patches@gnu.org; Thu, 26 Dec 2019 13:05:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ikXVO-0006Jf-5y for guix-patches@gnu.org; Thu, 26 Dec 2019 13:05:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:50247) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ikXVO-0006JZ-2P for guix-patches@gnu.org; Thu, 26 Dec 2019 13:05:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ikXVN-0007oK-Tf for guix-patches@gnu.org; Thu, 26 Dec 2019 13:05:01 -0500 Subject: [bug#38612] Pass system and target arguments to gexp->file. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87a77ug6vv.fsf@gmail.com> <8736dl8wxq.fsf@gmail.com> <87d0cipt6z.fsf@gnu.org> <87r20t7r0j.fsf@gmail.com> <87imm468rr.fsf@gmail.com> Date: Thu, 26 Dec 2019 19:04:30 +0100 In-Reply-To: <87imm468rr.fsf@gmail.com> (Mathieu Othacehe's message of "Wed, 25 Dec 2019 10:42:48 +0100") Message-ID: <87d0cbhsk1.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: Mathieu Othacehe Cc: 38612@debbugs.gnu.org Hello, Mathieu Othacehe skribis: > From a05baf4f4328ce2ca6da6860f6e596cd7559a08a Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe > Date: Tue, 24 Dec 2019 18:24:37 +0100 > Subject: [PATCH 1/2] system: operating-system-boot-parameters-file: Fix > cross-compilation. > > * gnu/system.scm (operating-system-boot-parameters-file): Add system and > target arguments and pass them to gexp->file call, > (operating-system-directory-base-entries): pass current system and target= to > operating-system-boot-parameters-file procedure. > --- > gnu/system.scm | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/gnu/system.scm b/gnu/system.scm > index abdbb081e6..e7af7e7b47 100644 > --- a/gnu/system.scm > +++ b/gnu/system.scm > @@ -470,7 +470,10 @@ value of the SYSTEM-SERVICE-TYPE service." > (let ((locale (operating-system-locale-directory os))) > (mlet %store-monad ((kernel -> (operating-system-kernel os)) > (initrd -> (operating-system-initrd-file os)) > - (params (operating-system-boot-parameters-fil= e os))) > + (params (operating-system-boot-parameters-file > + os > + #:system (%current-system) > + #:target (%current-target-system)))) In general, in monadic code, we should refer to (current-system) and (current-target-system), not to the SRFI-39 parameters. > -(define* (operating-system-boot-parameters-file os > - #:key system-kernel-argu= ments?) > +(define* (operating-system-boot-parameters-file > + os > + #:key > + system-kernel-arguments? > + system > + target) > "Return a file that describes the boot parameters of OS. The primary= use of > this file is the reconstruction of GRUB menu entries for old configurati= ons. >=20=20 > @@ -1085,7 +1092,9 @@ being stored into the \"parameters\" file)." > (device > #$(device->sexp (boot-parameters-store-device para= ms))) > (mount-point #$(boot-parameters-store-mount-point p= arams)))) > - #:set-load-path? #f))) > + #:set-load-path? #f > + #:system system > + #:target target))) By default, =E2=80=98gexp->file=E2=80=99 now uses the current system and ta= rget, so this change shouldn=E2=80=99t be necessary if you just want to use those. Am I missing something? The general guideline is that it would be good if only primitives (monadic procedures in (guix gexp) as well as gexp compilers) would have an explicit #:system and #:target parameter. > From 0ce67afc4f33074e20824751c22ba01cf6a3e184 Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe > Date: Wed, 25 Dec 2019 09:49:53 +0100 > Subject: [PATCH 2/2] services: Fix cross-compilation. > > * gnu/services.scm (system-derivation): Pass current system and target at= bind > time to lower-object, > (compute-boot-script): also pass current system and target at bind time to > gexp->file. [...] > (define (system-derivation mentries mextensions) > "Return as a monadic value the derivation of the 'system' directory > containing the given entries." > - (mlet %store-monad ((entries mentries) > + (mlet %store-monad ((system (current-system)) > + (target (current-target-system)) > + (entries mentries) > (extensions (sequence %store-monad mextensions))) Please alight the RHS of =E2=80=98mlet=E2=80=99 bindings. :-) > (lower-object > (file-union "system" > - (append entries (concatenate extensions)))))) > + (append entries (concatenate extensions))) > + system > + #:target target))) I guess this is needed here because =E2=80=98lower-object=E2=80=99 has #:ta= rget default to #f. > + (mlet %store-monad ((system (current-system)) > + (target (current-target-system))) > + (gexp->file "boot" > + ;; Clean up and activate the system, then spawn shepherd. > + #~(begin #$@(reverse gexps)) > + #:system system > + #:target target))) This one is unnecessary now that =E2=80=98gexp->file=E2=80=99 honors the cu= rrent system and target, right? Thanks, Ludo=E2=80=99.