guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/7] gnu: Add replace-input procedure.


From: David Craven
Subject: [PATCH 3/7] gnu: Add replace-input procedure.
Date: Thu, 2 Feb 2017 00:35:27 +0100

* gnu/packages.scm (replace-input): New procedure.
---
 gnu/packages.scm | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/gnu/packages.scm b/gnu/packages.scm
index 0aa289d56..2535e10b1 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -53,7 +53,9 @@
             find-newest-available-packages
 
             specification->package
-            specification->package+output))
+            specification->package+output
+
+            replace-input))
 
 ;;; Commentary:
 ;;;
@@ -356,3 +358,26 @@ version; if SPEC does not specify an output, return 
OUTPUT."
            (leave (_ "package `~a' lacks output `~a'~%")
                   (package-full-name package)
                   sub-drv))))))
+
+
+;;;
+;;; Package utilities.
+;;;
+
+(define (replace-input pkg name replacement)
+  "Returns a package with all inputs of NAME replaced with REPLACEMENT.  Is
+usefull for resolving circular dependencies."
+  (define replace
+    (match-lambda
+     ((tag input)
+      (if (string=? tag name)
+          (list name replacement)
+          (list tag (replace-input input name replacement))))))
+  (package
+    (inherit pkg)
+    (inputs
+     (map replace (package-inputs pkg)))
+    (native-inputs
+     (map replace (package-native-inputs pkg)))
+    (propagated-inputs
+     (map replace (package-propagated-inputs pkg)))))
-- 
2.11.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]