From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2End-0007Be-2L for guix-patches@gnu.org; Tue, 18 Sep 2018 08:08:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2EnZ-00067k-K0 for guix-patches@gnu.org; Tue, 18 Sep 2018 08:08:12 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:39487) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g2EnU-00062K-7d for guix-patches@gnu.org; Tue, 18 Sep 2018 08:08:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g2EnT-0007tQ-W9 for guix-patches@gnu.org; Tue, 18 Sep 2018 08:08:04 -0400 Subject: [bug#32759] [PATCH 4/8] inferior: Add 'inferior-package-search-paths' & co. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Tue, 18 Sep 2018 14:06:36 +0200 Message-Id: <20180918120640.27863-4-ludo@gnu.org> In-Reply-To: <20180918120640.27863-1-ludo@gnu.org> References: <20180918120640.27863-1-ludo@gnu.org> 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: 32759@debbugs.gnu.org * guix/inferior.scm (%inferior-package-search-paths) (inferior-package-native-search-paths) (inferior-package-search-paths) (inferior-package-transitive-native-search-paths): New procedures. * tests/inferior.scm ("inferior-package-search-paths"): New test. --- guix/inferior.scm | 26 ++++++++++++++++++++++++++ tests/inferior.scm | 9 +++++++++ 2 files changed, 35 insertions(+) diff --git a/guix/inferior.scm b/guix/inferior.scm index ca819c6ef..3fa493009 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -32,6 +32,7 @@ #:use-module ((guix derivations) #:select (read-derivation-from-file)) #:use-module (guix gexp) + #:use-module (guix search-paths) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match) @@ -58,6 +59,9 @@ inferior-package-native-inputs inferior-package-propagated-inputs inferior-package-transitive-propagated-inputs + inferior-package-native-search-paths + inferior-package-transitive-native-search-paths + inferior-package-search-paths inferior-package-derivation)) ;;; Commentary: @@ -322,6 +326,28 @@ inferior package." (define inferior-package-transitive-propagated-inputs (cut inferior-package-input-field <> 'package-transitive-propagated-inputs)) +(define (%inferior-package-search-paths package field) + "Return the list of search path specificiations of PACKAGE, an inferior +package." + (define paths + (inferior-package-field package + `(compose (lambda (paths) + (map (@ (guix search-paths) + search-path-specification->sexp) + paths)) + ,field))) + + (map sexp->search-path-specification paths)) + +(define inferior-package-native-search-paths + (cut %inferior-package-search-paths <> 'package-native-search-paths)) + +(define inferior-package-search-paths + (cut %inferior-package-search-paths <> 'package-search-paths)) + +(define inferior-package-transitive-native-search-paths + (cut %inferior-package-search-paths <> 'package-transitive-native-search-paths)) + (define (proxy client backend) ;adapted from (guix ssh) "Proxy communication between CLIENT and BACKEND until CLIENT closes the connection, at which point CLIENT is closed (both CLIENT and BACKEND must be diff --git a/tests/inferior.scm b/tests/inferior.scm index 03170a19c..99d736bd4 100644 --- a/tests/inferior.scm +++ b/tests/inferior.scm @@ -140,6 +140,15 @@ (close-inferior inferior) result)) +(test-equal "inferior-package-search-paths" + (package-native-search-paths guile-2.2) + (let* ((inferior (open-inferior %top-builddir + #:command "scripts/guix")) + (guile (first (lookup-inferior-packages inferior "guile"))) + (result (inferior-package-native-search-paths guile))) + (close-inferior inferior) + result)) + (test-equal "inferior-package-derivation" (map derivation-file-name (list (package-derivation %store %bootstrap-guile "x86_64-linux") -- 2.18.0