From patchwork Sun Jan 13 15:47:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 736 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 7344216A42; Sun, 13 Jan 2019 15:48:39 +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 autolearn=ham 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 28A41169F7 for ; Sun, 13 Jan 2019 15:48:39 +0000 (GMT) Received: from localhost ([127.0.0.1]:41742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gii06-0005JK-N0 for patchwork@mira.cbaines.net; Sun, 13 Jan 2019 10:48:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gihzY-0004wf-QC for guix-patches@gnu.org; Sun, 13 Jan 2019 10:48:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gihzY-0004nc-01 for guix-patches@gnu.org; Sun, 13 Jan 2019 10:48:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58738) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gihzX-0004nE-Ou for guix-patches@gnu.org; Sun, 13 Jan 2019 10:48:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gihzX-0008Nt-Do for guix-patches@gnu.org; Sun, 13 Jan 2019 10:48:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#34060] [PATCH 04/10] inferior: Add 'gexp->derivation-in-inferior'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 13 Jan 2019 15:48:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34060 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34060@debbugs.gnu.org Received: via spool by 34060-submit@debbugs.gnu.org id=B34060.154739447032145 (code B ref 34060); Sun, 13 Jan 2019 15:48:03 +0000 Received: (at 34060) by debbugs.gnu.org; 13 Jan 2019 15:47:50 +0000 Received: from localhost ([127.0.0.1]:58004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gihzI-0008MC-06 for submit@debbugs.gnu.org; Sun, 13 Jan 2019 10:47:48 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:49278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gihzD-0008LE-Ps for 34060@debbugs.gnu.org; Sun, 13 Jan 2019 10:47:44 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 3049A19C1; Sun, 13 Jan 2019 16:47:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c3WBrKZQPBuS; Sun, 13 Jan 2019 16:47:42 +0100 (CET) Received: from gnu.org (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 916EB1901; Sun, 13 Jan 2019 16:47:40 +0100 (CET) From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 13 Jan 2019 16:47:27 +0100 Message-Id: <20190113154733.29737-4-ludo@gnu.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190113154733.29737-1-ludo@gnu.org> References: <20190113154733.29737-1-ludo@gnu.org> 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 * guix/inferior.scm (gexp->derivation-in-inferior): New procedure. --- guix/inferior.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/guix/inferior.scm b/guix/inferior.scm index ba8d00866b..42b3545599 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -81,6 +81,8 @@ inferior-package->manifest-entry + gexp->derivation-in-inferior + %inferior-cache-directory inferior-for-channels)) @@ -484,6 +486,30 @@ PACKAGE must be live." ;; Compile PACKAGE for SYSTEM, optionally cross-building for TARGET. (inferior-package->derivation package system #:target target)) +(define* (gexp->derivation-in-inferior name exp guix + #:rest rest) + "Return a derivation that evaluates EXP with GUIX, an instance of Guix as +returned for example by 'channel-instances->derivation'. Other arguments are +passed as-is to 'gexp->derivation'." + (define trampoline + ;; This is a crude way to run EXP on GUIX. TODO: use 'raw-derivation' and + ;; make 'guix repl' the "builder"; this will require "opening up" the + ;; mechanisms behind 'gexp->derivation', and adding '-l' to 'guix repl'. + #~(begin + (use-modules (ice-9 popen)) + + (let ((pipe (open-pipe* OPEN_WRITE + #+(file-append guix "/bin/guix") + "repl"))) + ;; Unquote EXP right here so that its references to #$output + ;; propagate to the surrounding gexp. + (write '#$exp pipe) ;XXX: load path for EXP? + + (unless (zero? (close-pipe pipe)) + (error "inferior failed" #+guix))))) + + (apply gexp->derivation name trampoline rest)) + ;;; ;;; Manifest entries.