guix-commits
[Top][All Lists]
Advanced

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

02/02: guix build: Rewrite '--with-input' in terms of 'package-input-rew


From: Ludovic Courtès
Subject: 02/02: guix build: Rewrite '--with-input' in terms of 'package-input-rewriting'.
Date: Thu, 1 Sep 2016 21:09:05 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit 4e49163f76946503121493fafd6c0fe7b5bde030
Author: Ludovic Courtès <address@hidden>
Date:   Thu Sep 1 22:39:41 2016 +0200

    guix build: Rewrite '--with-input' in terms of 'package-input-rewriting'.
    
    * guix/scripts/build.scm (transform-package-inputs): Rewrite in terms of
    'package-input-rewriting'.
---
 guix/scripts/build.scm |   30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 9a113b4..86b95b4 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -193,33 +193,17 @@ of \"guile\"."
     (map (lambda (spec)
            (match (string-tokenize spec not-equal)
              ((old new)
-              (cons old (specification->package new)))
+              (cons (specification->package old)
+                    (specification->package new)))
              (_
               (leave (_ "invalid replacement specification: ~s~%") spec))))
          replacement-specs))
 
-  (define (rewrite input)
-    (match input
-      ((label (? package? package) outputs ...)
-       (match (assoc-ref replacements (package-name package))
-         (#f  (cons* label (replace package) outputs))
-         (new (cons* label new outputs))))
-      (_
-       input)))
-
-  (define replace
-    (memoize                                      ;XXX: use eq?
-     (lambda (p)
-       (package
-         (inherit p)
-         (inputs (map rewrite (package-inputs p)))
-         (native-inputs (map rewrite (package-native-inputs p)))
-         (propagated-inputs (map rewrite (package-propagated-inputs p)))))))
-
-  (lambda (store obj)
-    (if (package? obj)
-        (replace obj)
-        obj)))
+  (let ((rewrite (package-input-rewriting replacements)))
+    (lambda (store obj)
+      (if (package? obj)
+          (rewrite obj)
+          obj))))
 
 (define %transformations
   ;; Transformations that can be applied to things to build.  The car is the



reply via email to

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