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 @@ (define-module (guix graph) %graphviz-backend graph-backend? graph-backend + graph-backend-name + graph-backend-description export-graph)) @@ -140,12 +142,14 @@ (define (node-reachable-count nodes node-edges) ;;; (define-record-type - (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 @@ (define (emit-edge id1 id2 port) 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 @@ (define* (export-graph sinks port given BACKEND. Use NODE-TYPE to traverse the DAG. When REVERSE-EDGES? is true, draw reverse arrows." (match backend - (($ emit-prologue emit-epilogue emit-node emit-edge) + (($ _ _ emit-prologue emit-epilogue emit-node emit-edge) (emit-prologue (node-type-name node-type) port) (match node-type diff --git a/tests/graph.scm b/tests/graph.scm index f2e441cee6..bc4d62fe50 100644 --- a/tests/graph.scm +++ b/tests/graph.scm @@ -57,7 +57,8 @@ (define (record-edge source target port) (define (return) (values (reverse nodes) (reverse edges))) - (values (graph-backend (const #t) (const #t) + (values (graph-backend "test" "This is the test backend." + (const #t) (const #t) record-node record-edge) return)))