guix-commits
[Top][All Lists]
Advanced

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

01/03: packages: 'fold-bag-dependencies' honors nativeness in recursive


From: Ludovic Courtès
Subject: 01/03: packages: 'fold-bag-dependencies' honors nativeness in recursive calls.
Date: Tue, 5 Dec 2017 10:46:07 -0500 (EST)

civodul pushed a commit to branch version-0.14.0
in repository guix.

commit ff0e0041f358c0e4d0ab890f183b8a0c31727bea
Author: Ludovic Courtès <address@hidden>
Date:   Tue Dec 5 15:13:38 2017 +0100

    packages: 'fold-bag-dependencies' honors nativeness in recursive calls.
    
    Previously recursive calls to 'loop' would always consider all the bag
    inputs rather than those corresponding to NATIVE?.
    
    * guix/packages.scm (fold-bag-dependencies)[bag-direct-inputs*]: New
    procedure.  Use it both in the 'match' expression and in its body.
---
 guix/packages.scm | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/guix/packages.scm b/guix/packages.scm
index d68af15..c6d3b81 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -996,14 +996,18 @@ and return it."
   "Fold PROC over the packages BAG depends on.  Each package is visited only
 once, in depth-first order.  If NATIVE? is true, restrict to native
 dependencies; otherwise, restrict to target dependencies."
+  (define bag-direct-inputs*
+    (if native?
+        (lambda (bag)
+          (append (bag-build-inputs bag)
+                  (bag-target-inputs bag)
+                  (if (bag-target bag)
+                      '()
+                      (bag-host-inputs bag))))
+        bag-host-inputs))
+
   (define nodes
-    (match (if native?
-               (append (bag-build-inputs bag)
-                       (bag-target-inputs bag)
-                       (if (bag-target bag)
-                           '()
-                           (bag-host-inputs bag)))
-               (bag-host-inputs bag))
+    (match (bag-direct-inputs* bag)
       (((labels things _ ...) ...)
        things)))
 
@@ -1016,7 +1020,7 @@ dependencies; otherwise, restrict to target dependencies."
       (((? package? head) . tail)
        (if (set-contains? visited head)
            (loop tail result visited)
-           (let ((inputs (bag-direct-inputs (package->bag head))))
+           (let ((inputs (bag-direct-inputs* (package->bag head))))
              (loop (match inputs
                      (((labels things _ ...) ...)
                       (append things tail)))



reply via email to

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