me
/
guix
Archived
1
0
Fork 0

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'.
master
Ludovic Courtès 2019-03-23 15:10:37 +01:00
parent 2b81eac01e
commit a53ecfc897
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 12 additions and 2 deletions

View File

@ -111,11 +111,21 @@ name."
;;; Reverse package DAG. ;;; 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 (define %reverse-package-node-type
;; For this node type we first need to compute the list of packages and the ;; 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 ;; list of back-edges. Since we want to do it only once, we use the
;; promises below. ;; promises below.
(let* ((packages (delay (fold-packages cons '()))) (let* ((packages (delay (all-packages)))
(back-edges (delay (run-with-store #f ;store not actually needed (back-edges (delay (run-with-store #f ;store not actually needed
(node-back-edges %package-node-type (node-back-edges %package-node-type
(force packages)))))) (force packages))))))
@ -223,7 +233,7 @@ GNU-BUILD-SYSTEM have zero dependencies."
(define %reverse-bag-node-type (define %reverse-bag-node-type
;; Type for the reverse traversal of package nodes via the "bag" ;; Type for the reverse traversal of package nodes via the "bag"
;; representation, which includes implicit inputs. ;; 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 (back-edges (delay (run-with-store #f ;store not actually needed
(node-back-edges %bag-node-type (node-back-edges %bag-node-type
(force packages)))))) (force packages))))))