aboutsummaryrefslogtreecommitdiff
path: root/guix/packages.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/packages.scm')
-rw-r--r--guix/packages.scm16
1 files changed, 12 insertions, 4 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index f191327718..8515bb7c6f 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -855,19 +855,27 @@ when CUT? returns true for a given package."
#:optional (rewrite-name identity))
"Return a procedure that, when passed a package, replaces its direct and
indirect dependencies (but not its implicit inputs) according to REPLACEMENTS.
-REPLACEMENTS is a list of package pairs; the first element of each pair is the
-package to replace, and the second one is the replacement.
+REPLACEMENTS is a list of package pairs or a promise thereof; the first
+element of each pair is the package to replace, and the second one is the
+replacement.
Optionally, REWRITE-NAME is a one-argument procedure that takes the name of a
package and returns its new name after rewrite."
(define (rewrite p)
- (match (assq-ref replacements p)
+ (match (assq-ref (if (promise? replacements)
+ (force replacements)
+ replacements)
+ p)
(#f (package
(inherit p)
(name (rewrite-name (package-name p)))))
(new new)))
- (package-mapping rewrite (cut assq <> replacements)))
+ (package-mapping rewrite
+ (lambda (package)
+ (assq package (if (promise? replacements)
+ (force replacements)
+ replacements)))))
(define-syntax-rule (package/inherit p overrides ...)
"Like (package (inherit P) OVERRIDES ...), except that the same