From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:48999) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ijkup-000529-46 for guix-patches@gnu.org; Tue, 24 Dec 2019 09:12:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ijkun-0008I0-VD for guix-patches@gnu.org; Tue, 24 Dec 2019 09:12:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46055) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ijkun-0008Hu-RU for guix-patches@gnu.org; Tue, 24 Dec 2019 09:12:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ijkun-0005dr-MO for guix-patches@gnu.org; Tue, 24 Dec 2019 09:12:01 -0500 Subject: [bug#38612] Pass system and target arguments to gexp->file. Resent-Message-ID: References: <87a77ug6vv.fsf@gmail.com> <8736dl8wxq.fsf@gmail.com> <87d0cipt6z.fsf@gnu.org> From: Mathieu Othacehe In-reply-to: <87d0cipt6z.fsf@gnu.org> Date: Tue, 24 Dec 2019 15:11:08 +0100 Message-ID: <87r20t7r0j.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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: 38612@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, > trick ensures that we get the system that current at the time of the > monadic bind, whereas your change get the system and target that are > current at the time of the call. > > It=E2=80=99s a terrible pitfall, I know=E2=80=A6 Ok, then, I used the same trick to read %current-target-system at bind time. With this trick, target is set to the value passed to the guix system command (it is #f otherwise). WDYT? Mathieu --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-profiles-Fix-profile-derivation-cross-compilation.patch Content-Transfer-Encoding: quoted-printable >From c8b0e65d9b264bd484c7c6571c2ce3d68173b057 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Tue, 24 Dec 2019 15:04:57 +0100 Subject: [PATCH] profiles: Fix profile-derivation cross-compilation. * guix/store.scm (current-target-system): New exported monadic procedure. * guix/profiles.scm (profile-derivation): Set target at bind time using the above procedure. --- guix/profiles.scm | 4 ++++ guix/store.scm | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/guix/profiles.scm b/guix/profiles.scm index 987bab4e7f..d20f06e7b3 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -9,6 +9,7 @@ ;;; Copyright =C2=A9 2017 Huang Ying ;;; Copyright =C2=A9 2017 Maxim Cournoyer ;;; Copyright =C2=A9 2019 Kyle Meyer +;;; Copyright =C2=A9 2019 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -1459,6 +1460,9 @@ are cross-built for TARGET." (mlet* %store-monad ((system (if system (return system) (current-system))) + (target (if target + (return target) + (current-target-system))) (ok? (if allow-collisions? (return #t) (check-for-collisions manifest system diff --git a/guix/store.scm b/guix/store.scm index cf25d347fc..f99fa581a8 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovi= c Court=C3=A8s ;;; Copyright =C2=A9 2018 Jan Nieuwenhuizen +;;; Copyright =C2=A9 2019 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -159,6 +160,7 @@ %guile-for-build current-system set-current-system + current-target-system text-file interned-file interned-file-tree @@ -1816,6 +1818,11 @@ the store." (lambda (state) (values (%current-system system) state))) =20 +(define-inlinable (current-target-system) + ;; Consult the %CURRENT-TARGET-SYSTEM fluid at bind time. + (lambda (state) + (values (%current-target-system) state))) + (define %guile-for-build ;; The derivation of the Guile to be used within the build environment, ;; when using 'gexp->derivation' and co. --=20 2.24.1 --=-=-=--