GNU bug report logs - #29926
[PATCH 1/5] gexp: Add 'eval-gexp'.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: 宋文武 <iyzsong@HIDDEN>; Keywords: patch; merged with #29925, #29929, #29930; dated Mon, 1 Jan 2018 10:34:05 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Merged 29925 29926 29929 29930. Request was from ludo@HIDDEN (Ludovic Courtès) to control <at> debbugs.gnu.org. Full text available.
Merged 29925 29926 29929. Request was from ludo@HIDDEN (Ludovic Courtès) to control <at> debbugs.gnu.org. Full text available.
Merged 29925 29926. Request was from ludo@HIDDEN (Ludovic Courtès) to control <at> debbugs.gnu.org. Full text available.
Merged 29926. Request was from ludo@HIDDEN (Ludovic Courtès) to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Jan 2018 10:33:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 01 05:33:59 2018
Received: from localhost ([127.0.0.1]:59249 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eVxPr-0000tD-CG
	for submit <at> debbugs.gnu.org; Mon, 01 Jan 2018 05:33:59 -0500
Received: from eggs.gnu.org ([208.118.235.92]:57808)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <iyzsong@HIDDEN>) id 1eVxPp-0000sY-SL
 for submit <at> debbugs.gnu.org; Mon, 01 Jan 2018 05:33:58 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <iyzsong@HIDDEN>) id 1eVxPj-0004Po-OK
 for submit <at> debbugs.gnu.org; Mon, 01 Jan 2018 05:33:52 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:51890)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <iyzsong@HIDDEN>)
 id 1eVxPj-0004PX-L9
 for submit <at> debbugs.gnu.org; Mon, 01 Jan 2018 05:33:51 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48732)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <iyzsong@HIDDEN>) id 1eVxPi-0006LF-HQ
 for guix-patches@HIDDEN; Mon, 01 Jan 2018 05:33:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <iyzsong@HIDDEN>) id 1eVxPf-0004Mp-Be
 for guix-patches@HIDDEN; Mon, 01 Jan 2018 05:33:50 -0500
Received: from rezeros.cc ([45.76.207.221]:56206)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <iyzsong@HIDDEN>)
 id 1eVxPe-0004LU-TQ
 for guix-patches@HIDDEN; Mon, 01 Jan 2018 05:33:47 -0500
Received: from localhost (36.24.33.173 [36.24.33.173])
 by rezeros.cc (OpenSMTPD) with ESMTPSA id fed5bae3
 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); 
 Mon, 1 Jan 2018 10:33:16 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 7b00fe59;
 Mon, 1 Jan 2018 10:33:37 +0000 (UTC)
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 1/5] gexp: Add 'eval-gexp'.
Date: Mon,  1 Jan 2018 18:33:32 +0800
Message-Id: <20180101103336.8613-2-iyzsong@HIDDEN>
X-Mailer: git-send-email 2.14.1
In-Reply-To: <20180101103336.8613-1-iyzsong@HIDDEN>
References: <20180101103336.8613-1-iyzsong@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

* guix/gexp.scm (eval-gexp): New procedure.
---
 guix/gexp.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/guix/gexp.scm b/guix/gexp.scm
index f005c4d29..9709c5ecb 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -76,6 +76,7 @@
             gexp->derivation
             gexp->file
             gexp->script
+            eval-gexp
             text-file*
             mixed-text-file
             file-union
@@ -1167,6 +1168,21 @@ and '%load-compiled-path' to honor EXP's imported modules."
                          #:local-build? #t
                          #:substitutable? #f)))))
 
+(define* (eval-gexp exp #:optional (name "computed-value"))
+  "Return as a monadic value the EXP (a gexp) evaluate to.  This is
+implemented by building a store file NAME that contains the textual
+representation of EXP's value, and then @code{read} from it."
+  (mlet* %store-monad
+      ((drv (gexp->derivation
+             name
+             (gexp (with-output-to-file (ungexp output)
+                     (lambda ()
+                       (write (eval (quote (ungexp exp)) (current-module))))))
+             #:local-build? #t
+             #:substitutable? #f))
+       (_   (built-derivations (list drv))))
+    (return (call-with-input-file (derivation->output-path drv) read))))
+
 (define* (text-file* name #:rest text)
   "Return as a monadic value a derivation that builds a text file containing
 all of TEXT.  TEXT may list, in addition to strings, objects of any type that
-- 
2.13.3





Acknowledgement sent to 宋文武 <iyzsong@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#29926; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 7 Mar 2018 14:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.