guix-commits
[Top][All Lists]
Advanced

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

02/05: graph: Factorize calls to 'fold-packages'.


From: guix-commits
Subject: 02/05: graph: Factorize calls to 'fold-packages'.
Date: Sat, 23 Mar 2019 13:15:45 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit a53ecfc897a5490744ecc1bc72cabc1d3f5c434f
Author: Ludovic Courtès <address@hidden>
Date:   Sat Mar 23 15:10:37 2019 +0100

    graph: Factorize calls to 'fold-packages'.
    
    * guix/scripts/graph.scm (all-packages): New procedure.
    (%reverse-package-node-type, %reverse-bag-node-type): Use 'all-packages'
    instead of 'fold-packages'.
---
 guix/scripts/graph.scm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm
index d0d353f..8fe81ad 100644
--- a/guix/scripts/graph.scm
+++ b/guix/scripts/graph.scm
@@ -111,11 +111,21 @@ name."
 ;;; Reverse package DAG.
 ;;;
 
+(define (all-packages)            ;XXX: duplicated from (guix scripts refresh)
+  "Return the list of all the distro's packages."
+  (fold-packages (lambda (package result)
+                   ;; Ignore deprecated packages.
+                   (if (package-superseded package)
+                       result
+                       (cons package result)))
+                 '()
+                 #:select? (const #t)))           ;include hidden packages
+
 (define %reverse-package-node-type
   ;; For this node type we first need to compute the list of packages and the
   ;; list of back-edges.  Since we want to do it only once, we use the
   ;; promises below.
-  (let* ((packages   (delay (fold-packages cons '())))
+  (let* ((packages   (delay (all-packages)))
          (back-edges (delay (run-with-store #f    ;store not actually needed
                               (node-back-edges %package-node-type
                                                (force packages))))))
@@ -223,7 +233,7 @@ GNU-BUILD-SYSTEM have zero dependencies."
 (define %reverse-bag-node-type
   ;; Type for the reverse traversal of package nodes via the "bag"
   ;; representation, which includes implicit inputs.
-  (let* ((packages   (delay (package-closure (fold-packages cons '()))))
+  (let* ((packages   (delay (package-closure (all-packages))))
          (back-edges (delay (run-with-store #f    ;store not actually needed
                               (node-back-edges %bag-node-type
                                                (force packages))))))



reply via email to

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