summaryrefslogtreecommitdiff
path: root/guix/scripts/graph.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-10-14 15:11:04 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-14 21:39:05 +0200
commita64cd7b65fc9ecf63035bd39e41f8cac5b8dc716 (patch)
treecb4615f6b1802622f99e61137e270cc785cd49c4 /guix/scripts/graph.scm
parent00184239c34694ba3005bccde498ae5962c06758 (diff)
downloadgnu-guix-a64cd7b65fc9ecf63035bd39e41f8cac5b8dc716.tar
gnu-guix-a64cd7b65fc9ecf63035bd39e41f8cac5b8dc716.tar.gz
graph: 'export-graph' takes a #:reverse-edges? parameter.
* guix/scripts/graph.scm (export-graph): Add #:reverse-edges? parameter and honor it.
Diffstat (limited to 'guix/scripts/graph.scm')
-rw-r--r--guix/scripts/graph.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm
index 725ae42030..734a47719a 100644
--- a/guix/scripts/graph.scm
+++ b/guix/scripts/graph.scm
@@ -322,10 +322,12 @@ substitutes."
(define* (export-graph sinks port
#:key
+ reverse-edges?
(node-type %package-node-type)
(backend %graphviz-backend))
"Write to PORT the representation of the DAG with the given SINKS, using the
-given BACKEND. Use NODE-TYPE to traverse the DAG."
+given BACKEND. Use NODE-TYPE to traverse the DAG. When REVERSE-EDGES? is
+true, draw reverse arrows."
(match backend
(($ <graph-backend> emit-prologue emit-epilogue emit-node emit-edge)
(emit-prologue (node-type-name node-type) port)
@@ -349,7 +351,9 @@ given BACKEND. Use NODE-TYPE to traverse the DAG."
dependencies)))
(emit-node id (node-label head) port)
(for-each (lambda (dependency dependency-id)
- (emit-edge id dependency-id port))
+ (if reverse-edges?
+ (emit-edge dependency-id id port)
+ (emit-edge id dependency-id port)))
dependencies ids)
(loop (append dependencies tail)
(set-insert id visited)))))))))))))