From patchwork Tue Dec 24 14:11:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 19432 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3B4DD17984; Tue, 24 Dec 2019 14:12:09 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id D895917982 for ; Tue, 24 Dec 2019 14:12:08 +0000 (GMT) Received: from localhost ([::1]:39426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ijkuu-00054h-EW for patchwork@mira.cbaines.net; Tue, 24 Dec 2019 09:12:08 -0500 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 X-Loop: help-debbugs@gnu.org Subject: [bug#38612] Pass system and target arguments to gexp->file. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 24 Dec 2019 14:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38612 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Ludovic =?utf-8?q?Court=C3=A8s?= Cc: 38612@debbugs.gnu.org Received: via spool by 38612-submit@debbugs.gnu.org id=B38612.157719668321625 (code B ref 38612); Tue, 24 Dec 2019 14:12:01 +0000 Received: (at 38612) by debbugs.gnu.org; 24 Dec 2019 14:11:23 +0000 Received: from localhost ([127.0.0.1]:52027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ijkuB-0005ci-Dq for submit@debbugs.gnu.org; Tue, 24 Dec 2019 09:11:23 -0500 Received: from mail-wr1-f45.google.com ([209.85.221.45]:43871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ijku9-0005cS-1y for 38612@debbugs.gnu.org; Tue, 24 Dec 2019 09:11:22 -0500 Received: by mail-wr1-f45.google.com with SMTP id d16so19906689wre.10 for <38612@debbugs.gnu.org>; Tue, 24 Dec 2019 06:11:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=USzQ/t+4sro1ZsP/siaQu0Gk3JDSrXPHRe2sR4TykYM=; b=fTclHS/UmLQE3KQi+y7cSrZu0v1YfmZ62//z9AJuFSsnx8KuuaHgDfs4sPOhAVSu91 T9uuT1hOB/bU/ApEx7M/YlCG9stXJMAsoWImzbbGkaRjE0WvIzfbCi87UFGqPJjmJtlh oWO4SLf6FlvuJ92suaFjbP+xD9WDl7eZnt/kfNrikwwpganDkhmg4LpB7FZ8U/MN2+Ol 20mVFQ0Dw7HnBJlnQK9FRTxQYfHGn4ENlfmePmR18IkmOu19CBFZrDYzufg25fMgflV5 sznqI5cbAKSmdrH1uJmxqLfGGqN7FXYvrAQG6WsgE6mVR/ubJOOah6r7yUOIo13yHgTA McFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=USzQ/t+4sro1ZsP/siaQu0Gk3JDSrXPHRe2sR4TykYM=; b=rHxaoHWgZ329gokIYK2R3NDLvPbSEkT55E47zrKIo944NnpIup71i3F86tRBt/1B+4 UGZ7C30HysPsDIJcInYiGVRcfoV6vEKm8wU6d2M18shQ+c46IXGKuGS+jRQyobqSOr1V pcDkQLiviDgV3n3HOS9s8XuHbaK/SxqZOzsR/7I9mGWMeaRUNUtR22g5+weN744xqVOg s0APFgJPrvboULoh1f/w88zukJfej/T2mhTz1spmENEkAl9RHwNdV7xzHNWxudnwI/E+ VGOQ5tiyocvbx7FV5E+895RwwLWy3kz4fUzG0DuMxGW0yDHLgHi4aLu90+n/UZqhNQuD jigg== X-Gm-Message-State: APjAAAXw1ufS19CHa0LzkTJBDhJ2uz+gyIhR9UpljAVxhZs42LaXf3CJ xFso9BOba19Ml5zgZGcMOHtcEplc X-Google-Smtp-Source: APXvYqxYH5NgPVIwUdDU/pFaWC5kxp26mO3kN92vkXmi5GElbUOe1eY3bY4PAnRkc4hDH5ObRiqB0A== X-Received: by 2002:adf:d184:: with SMTP id v4mr35494347wrc.76.1577196675070; Tue, 24 Dec 2019 06:11:15 -0800 (PST) Received: from cervin ([2a01:cb18:832e:5f00:a14b:cea0:a27:c884]) by smtp.gmail.com with ESMTPSA id y6sm23922324wrl.17.2019.12.24.06.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2019 06:11:14 -0800 (PST) References: <87a77ug6vv.fsf@gmail.com> <8736dl8wxq.fsf@gmail.com> <87d0cipt6z.fsf@gnu.org> User-agent: mu4e 1.2.0; emacs 26.3 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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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’s a terrible pitfall, I know… 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 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 © 2017 Huang Ying ;;; Copyright © 2017 Maxim Cournoyer ;;; Copyright © 2019 Kyle Meyer +;;; Copyright © 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 © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2018 Jan Nieuwenhuizen +;;; Copyright © 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))) +(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. -- 2.24.1