summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--guix/packages.scm20
1 files changed, 12 insertions, 8 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index d68af1569f..c6d3b811f2 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)))