inferior: Add 'inferior-package-search-paths' & co.

* 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.
This commit is contained in:
Ludovic Courtès 2018-09-17 10:04:15 +02:00
parent 6030396aec
commit eee8b303f6
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 35 additions and 0 deletions

View File

@ -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

View File

@ -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")