aboutsummaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-01-04 16:16:17 +0100
committerLudovic Courtès <ludo@gnu.org>2017-01-04 16:18:53 +0100
commitb96a0640a3ca128c0b9bf9acaef7b3b7a8bb1455 (patch)
treef228c2536475873ced944d315406ab869694a26e /guix/scripts
parenta614ce389f473d7b2792176a1022ccb28bc8f587 (diff)
downloadgnu-guix-b96a0640a3ca128c0b9bf9acaef7b3b7a8bb1455.tar
gnu-guix-b96a0640a3ca128c0b9bf9acaef7b3b7a8bb1455.tar.gz
graph: Add '%reverse-package-node-type'.
* guix/scripts/graph.scm (%reverse-package-node-type): New variable. (%node-types): Add it. * tests/graph.scm ("reverse package DAG"): New test. * doc/guix.texi (Invoking guix refresh): Add cross-reference to "Invoking guix graph". (Invoking guix graph): Document 'reverse-package'.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/graph.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm
index d96df5fbaf..79ce503a2e 100644
--- a/guix/scripts/graph.scm
+++ b/guix/scripts/graph.scm
@@ -37,6 +37,7 @@
#:use-module (srfi srfi-37)
#:use-module (ice-9 match)
#:export (%package-node-type
+ %reverse-package-node-type
%bag-node-type
%bag-with-origins-node-type
%bag-emerged-node-type
@@ -103,6 +104,25 @@ name."
;;;
+;;; Reverse package DAG.
+;;;
+
+(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 '())))
+ (back-edges (delay (run-with-store #f ;store not actually needed
+ (node-back-edges %package-node-type
+ (force packages))))))
+ (node-type
+ (inherit %package-node-type)
+ (name "reverse-package")
+ (description "the reverse DAG of packages")
+ (edges (lift1 (force back-edges) %store-monad)))))
+
+
+;;;
;;; Package DAG using bags.
;;;
@@ -323,6 +343,7 @@ substitutes."
(define %node-types
;; List of all the node types.
(list %package-node-type
+ %reverse-package-node-type
%bag-node-type
%bag-with-origins-node-type
%bag-emerged-node-type