packages: Remove 'define-memoized/v' and use 'mlambdaq' instead.
* guix/packages.scm (define-memoized/v): Remove. (package-transitive-supported-systems): Use 'mlambdaq' instead of 'define-memoized/v'. (package-input-rewriting)[replace]: Likewise.
This commit is contained in:
parent
55b2d92145
commit
c9134e82fe
|
@ -28,6 +28,7 @@
|
||||||
#:use-module (guix base32)
|
#:use-module (guix base32)
|
||||||
#:use-module (guix grafts)
|
#:use-module (guix grafts)
|
||||||
#:use-module (guix derivations)
|
#:use-module (guix derivations)
|
||||||
|
#:use-module (guix memoization)
|
||||||
#:use-module (guix build-system)
|
#:use-module (guix build-system)
|
||||||
#:use-module (guix search-paths)
|
#:use-module (guix search-paths)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
|
@ -697,27 +698,8 @@ in INPUTS and their transitive propagated inputs."
|
||||||
`(assoc-ref ,alist ,(label input)))
|
`(assoc-ref ,alist ,(label input)))
|
||||||
(transitive-inputs inputs)))
|
(transitive-inputs inputs)))
|
||||||
|
|
||||||
(define-syntax define-memoized/v
|
(define package-transitive-supported-systems
|
||||||
(lambda (form)
|
(mlambdaq (package)
|
||||||
"Define a memoized single-valued unary procedure with docstring.
|
|
||||||
The procedure argument is compared to cached keys using `eqv?'."
|
|
||||||
(syntax-case form ()
|
|
||||||
((_ (proc arg) docstring body body* ...)
|
|
||||||
(string? (syntax->datum #'docstring))
|
|
||||||
#'(define proc
|
|
||||||
(let ((cache (make-hash-table)))
|
|
||||||
(define (proc arg)
|
|
||||||
docstring
|
|
||||||
(match (hashv-get-handle cache arg)
|
|
||||||
((_ . value)
|
|
||||||
value)
|
|
||||||
(_
|
|
||||||
(let ((result (let () body body* ...)))
|
|
||||||
(hashv-set! cache arg result)
|
|
||||||
result))))
|
|
||||||
proc))))))
|
|
||||||
|
|
||||||
(define-memoized/v (package-transitive-supported-systems package)
|
|
||||||
"Return the intersection of the systems supported by PACKAGE and those
|
"Return the intersection of the systems supported by PACKAGE and those
|
||||||
supported by its dependencies."
|
supported by its dependencies."
|
||||||
(fold (lambda (input systems)
|
(fold (lambda (input systems)
|
||||||
|
@ -728,7 +710,7 @@ supported by its dependencies."
|
||||||
(_
|
(_
|
||||||
systems)))
|
systems)))
|
||||||
(package-supported-systems package)
|
(package-supported-systems package)
|
||||||
(bag-direct-inputs (package->bag package))))
|
(bag-direct-inputs (package->bag package)))))
|
||||||
|
|
||||||
(define* (supported-package? package #:optional (system (%current-system)))
|
(define* (supported-package? package #:optional (system (%current-system)))
|
||||||
"Return true if PACKAGE is supported on SYSTEM--i.e., if PACKAGE and all its
|
"Return true if PACKAGE is supported on SYSTEM--i.e., if PACKAGE and all its
|
||||||
|
@ -775,14 +757,15 @@ package and returns its new name after rewrite."
|
||||||
(_
|
(_
|
||||||
input)))
|
input)))
|
||||||
|
|
||||||
(define-memoized/v (replace p)
|
(define replace
|
||||||
"Return a variant of P with its inputs rewritten."
|
(mlambdaq (p)
|
||||||
|
;; Return a variant of P with its inputs rewritten.
|
||||||
(package
|
(package
|
||||||
(inherit p)
|
(inherit p)
|
||||||
(name (rewrite-name (package-name p)))
|
(name (rewrite-name (package-name p)))
|
||||||
(inputs (map rewrite (package-inputs p)))
|
(inputs (map rewrite (package-inputs p)))
|
||||||
(native-inputs (map rewrite (package-native-inputs p)))
|
(native-inputs (map rewrite (package-native-inputs p)))
|
||||||
(propagated-inputs (map rewrite (package-propagated-inputs p)))))
|
(propagated-inputs (map rewrite (package-propagated-inputs p))))))
|
||||||
|
|
||||||
replace)
|
replace)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue