diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-09-18 09:56:34 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-09-21 17:04:37 +0200 |
commit | 2e6d64e122ad2745154a38122785895d1b66c2ff (patch) | |
tree | 3382cc262500b4bf939d3a8339a0f172e6f62af1 /guix | |
parent | eee8b303f6d82c1400fd8fd3b097406358ed7875 (diff) |
inferior: Add 'inferior-package->manifest-entry'.
* guix/inferior.scm (inferior-package->manifest-entry): New procedure.
* tests/inferior.scm (manifest-entry->list): New procedure.
("inferior-package->manifest-entry"): New test.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/inferior.scm | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/guix/inferior.scm b/guix/inferior.scm index 3fa4930095..c86fdd3ec1 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -33,6 +33,7 @@ #:select (read-derivation-from-file)) #:use-module (guix gexp) #:use-module (guix search-paths) + #:use-module (guix profiles) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match) @@ -45,12 +46,12 @@ inferior-eval inferior-object? + inferior-packages + lookup-inferior-packages + inferior-package? inferior-package-name inferior-package-version - - inferior-packages - lookup-inferior-packages inferior-package-synopsis inferior-package-description inferior-package-home-page @@ -62,7 +63,9 @@ inferior-package-native-search-paths inferior-package-transitive-native-search-paths inferior-package-search-paths - inferior-package-derivation)) + inferior-package-derivation + + inferior-package->manifest-entry)) ;;; Commentary: ;;; @@ -441,3 +444,34 @@ PACKAGE must be live." target) ;; Compile PACKAGE for SYSTEM, optionally cross-building for TARGET. (inferior-package->derivation package system #:target target)) + + +;;; +;;; Manifest entries. +;;; + +(define* (inferior-package->manifest-entry package + #:optional (output "out") + #:key (parent (delay #f)) + (properties '())) + "Return a manifest entry for the OUTPUT of package PACKAGE." + ;; For each dependency, keep a promise pointing to its "parent" entry. + (letrec* ((deps (map (match-lambda + ((label package) + (inferior-package->manifest-entry package + #:parent (delay entry))) + ((label package output) + (inferior-package->manifest-entry package output + #:parent (delay entry)))) + (inferior-package-propagated-inputs package))) + (entry (manifest-entry + (name (inferior-package-name package)) + (version (inferior-package-version package)) + (output output) + (item package) + (dependencies (delete-duplicates deps)) + (search-paths + (inferior-package-transitive-native-search-paths package)) + (parent parent) + (properties properties)))) + entry)) |