summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/inferior.scm156
1 files changed, 72 insertions, 84 deletions
diff --git a/guix/inferior.scm b/guix/inferior.scm
index 17125d982a..da6983d9a6 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -44,7 +44,6 @@
#:use-module (guix store)
#:use-module (guix derivations)
#:use-module (guix base32)
- #:use-module ((guix memoization) #:select (mlambdaq))
#:use-module (gcrypt hash)
#:autoload (guix cache) (maybe-remove-expired-cache-entries
file-expiration-time)
@@ -385,74 +384,72 @@ record."
loc)))
package-location))))
-(define (inferior-package-input-field field)
+(define (inferior-package-input-field package field)
"Return the input field FIELD (e.g., 'native-inputs') of PACKAGE, an
inferior package."
- (mlambdaq (package)
- (define field*
- `(compose (lambda (inputs)
- (map (match-lambda
- ;; XXX: Origins are not handled.
- ((label (? package? package) rest ...)
- (let ((id (object-address package)))
- (hashv-set! %package-table id package)
- `(,label (package ,id
- ,(package-name package)
- ,(package-version package))
- ,@rest)))
- (x
- x))
- inputs))
- ,field))
-
- (define inputs
- (inferior-package-field package field*))
-
- (define inferior
- (inferior-package-inferior package))
-
- (map (match-lambda
- ((label ('package id name version) . rest)
- ;; XXX: eq?-ness of inferior packages is not preserved here.
- `(,label ,(inferior-package inferior name version id)
- ,@rest))
- (x x))
- inputs)))
+ (define field*
+ `(compose (lambda (inputs)
+ (map (match-lambda
+ ;; XXX: Origins are not handled.
+ ((label (? package? package) rest ...)
+ (let ((id (object-address package)))
+ (hashv-set! %package-table id package)
+ `(,label (package ,id
+ ,(package-name package)
+ ,(package-version package))
+ ,@rest)))
+ (x
+ x))
+ inputs))
+ ,field))
+
+ (define inputs
+ (inferior-package-field package field*))
+
+ (define inferior
+ (inferior-package-inferior package))
+
+ (map (match-lambda
+ ((label ('package id name version) . rest)
+ ;; XXX: eq?-ness of inferior packages is not preserved here.
+ `(,label ,(inferior-package inferior name version id)
+ ,@rest))
+ (x x))
+ inputs))
(define inferior-package-inputs
- (inferior-package-input-field 'package-inputs))
+ (cut inferior-package-input-field <> 'package-inputs))
(define inferior-package-native-inputs
- (inferior-package-input-field 'package-native-inputs))
+ (cut inferior-package-input-field <> 'package-native-inputs))
(define inferior-package-propagated-inputs
- (inferior-package-input-field 'package-propagated-inputs))
+ (cut inferior-package-input-field <> 'package-propagated-inputs))
(define inferior-package-transitive-propagated-inputs
- (inferior-package-input-field 'package-transitive-propagated-inputs))
+ (cut inferior-package-input-field <> 'package-transitive-propagated-inputs))
-(define (%inferior-package-search-paths field)
+(define (%inferior-package-search-paths package field)
"Return the list of search path specifications of PACKAGE, an inferior
package."
- (mlambdaq (package)
- (define paths
- (inferior-package-field package
- `(compose (lambda (paths)
- (map (@ (guix search-paths)
- search-path-specification->sexp)
- paths))
- ,field)))
+ (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)))
+ (map sexp->search-path-specification paths))
(define inferior-package-native-search-paths
- (%inferior-package-search-paths 'package-native-search-paths))
+ (cut %inferior-package-search-paths <> 'package-native-search-paths))
(define inferior-package-search-paths
- (%inferior-package-search-paths 'package-search-paths))
+ (cut %inferior-package-search-paths <> 'package-search-paths))
(define inferior-package-transitive-native-search-paths
- (%inferior-package-search-paths 'package-transitive-native-search-paths))
+ (cut %inferior-package-search-paths <> 'package-transitive-native-search-paths))
(define (inferior-package-provenance package)
"Return a \"provenance sexp\" for PACKAGE, an inferior package. The result
@@ -642,40 +639,31 @@ failing when GUIX is too old and lacks the 'guix repl' command."
;;; Manifest entries.
;;;
-(define inferior-package->manifest-entry
- (let ((results vlist-null))
- (lambda* (package #:optional (output "out")
- #:key (parent (delay #f))
- (properties '()))
- "Return a manifest entry for the OUTPUT of package PACKAGE."
- (define key package)
- (or (and=> (vhash-assoc key results)
- (lambda (result)
- ;(pk 'mem package)
- (cdr result)))
- (begin
- ;(pk 'compute 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))))
- (set! results (vhash-cons key entry results))
- entry))))))
+(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))
;;;