Subject: [bug#43477] [PATCH 1/1] guix: graph: Add 'plain' backend.

From: zimoun <[email-masked]>
Date: Thu, 17 Sep 2020 21:40:32 +0200

* guix/graph.scm: (emit-plain-prologue, emit-plain-epilogue, emit-plain-node,
emit-plain-edge): New procedures.
(%plain-backend): New variable.
(%graph-backends): Update variable.
---
 guix/graph.scm | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/guix/graph.scm b/guix/graph.scm
index b695ca4306..4be864b29a 100644
--- a/guix/graph.scm
+++ b/guix/graph.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015, 2016, 2020 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2016 Ricardo Wurmus <[email-masked]>
+;;; Copyright © 2020 Simon Tournier <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -324,6 +325,28 @@ nodeArray.push(nodes[\"~a\"]);~%"
                  emit-cypher-prologue emit-cypher-epilogue
                  emit-cypher-node emit-cypher-edge))
 
+
+;;;
+;;; Plain export
+;;;
+
+(define (emit-plain-prologue name port)
+  (format port ""))
+
+(define (emit-plain-epilogue port)
+  (format port ""))
+
+(define (emit-plain-node id label port)
+  (format port "~a~%" label))
+
+(define (emit-plain-edge id1 id2 port)
+  (format port ""))
+
+(define %plain-backend
+  (graph-backend "plain"
+                 "Generate Plain queries."
+                 emit-plain-prologue emit-plain-epilogue
+                 emit-plain-node emit-plain-edge))
 
 
 ;;;
@@ -333,7 +356,8 @@ nodeArray.push(nodes[\"~a\"]);~%"
 (define %graph-backends
   (list %graphviz-backend
         %d3js-backend
-        %cypher-backend))
+        %cypher-backend
+        %plain-backend))
 
 (define* (export-graph sinks port
                        #:key
-- 
2.28.0