summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2016-10-20 08:47:03 +0200
committerRicardo Wurmus <rekado@elephly.net>2016-12-14 21:43:06 +0100
commit51377437a1e37c9d5f2e137528e9c278b252d781 (patch)
tree91c2e1b1e0935f53b8ec16d468f47eade1f74823 /guix
parent089f385a21806c00785fb0817e6ea590a5dd1412 (diff)
downloadgnu-guix-51377437a1e37c9d5f2e137528e9c278b252d781.tar
gnu-guix-51377437a1e37c9d5f2e137528e9c278b252d781.tar.gz
graph: Backend must have name and description.
* guix/graph.scm (<graph-backend>): Add fields "name" and "description". (%graphviz-backend): Provide values for name and description. (export-graph): Ignore name and description when matching backends. (graph-backend-name, graph-backend-description): New procedures. * tests/graph.scm (make-recording-backend): Initialize name and description fields of test graph-backend.
Diffstat (limited to 'guix')
-rw-r--r--guix/graph.scm20
1 files changed, 13 insertions, 7 deletions
diff --git a/guix/graph.scm b/guix/graph.scm
index 735d340c2c..5cf98f0d54 100644
--- a/guix/graph.scm
+++ b/guix/graph.scm
@@ -44,6 +44,8 @@
%graphviz-backend
graph-backend?
graph-backend
+ graph-backend-name
+ graph-backend-description
export-graph))
@@ -140,12 +142,14 @@ typically returned by 'node-edges' or 'node-back-edges'."
;;;
(define-record-type <graph-backend>
- (graph-backend prologue epilogue node edge)
+ (graph-backend name description prologue epilogue node edge)
graph-backend?
- (prologue graph-backend-prologue)
- (epilogue graph-backend-epilogue)
- (node graph-backend-node)
- (edge graph-backend-edge))
+ (name graph-backend-name)
+ (description graph-backend-description)
+ (prologue graph-backend-prologue)
+ (epilogue graph-backend-epilogue)
+ (node graph-backend-node)
+ (edge graph-backend-edge))
(define %colors
;; See colortbl.h in Graphviz.
@@ -170,7 +174,9 @@ typically returned by 'node-edges' or 'node-back-edges'."
id1 id2 (pop-color id1)))
(define %graphviz-backend
- (graph-backend emit-prologue emit-epilogue
+ (graph-backend "graphviz"
+ "Generate graph in DOT format for use with Graphviz."
+ emit-prologue emit-epilogue
emit-node emit-edge))
(define* (export-graph sinks port
@@ -181,7 +187,7 @@ typically returned by 'node-edges' or 'node-back-edges'."
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)
+ (($ <graph-backend> _ _ emit-prologue emit-epilogue emit-node emit-edge)
(emit-prologue (node-type-name node-type) port)
(match node-type