Revert "graph: Provide access to the package record in the emit functions."
This reverts commit 5d7e854365
, which
broke 'tests/graph.scm' and broke node types not related to <package>
objects, such as '%reference-node-type'.
This commit is contained in:
parent
649c438c23
commit
5e60bef980
|
@ -1,7 +1,6 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
|
||||||
;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
|
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -23,7 +22,6 @@
|
||||||
#:use-module (guix monads)
|
#:use-module (guix monads)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (guix sets)
|
#:use-module (guix sets)
|
||||||
#:use-module (guix packages)
|
|
||||||
#:use-module (rnrs io ports)
|
#:use-module (rnrs io ports)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-9)
|
#:use-module (srfi srfi-9)
|
||||||
|
@ -172,9 +170,9 @@ typically returned by 'node-edges' or 'node-back-edges'."
|
||||||
name))
|
name))
|
||||||
(define (emit-epilogue port)
|
(define (emit-epilogue port)
|
||||||
(display "\n}\n" port))
|
(display "\n}\n" port))
|
||||||
(define (emit-node id node port)
|
(define (emit-node id label port)
|
||||||
(format port " \"~a\" [label = \"~a\", shape = box, fontname = Helvetica];~%"
|
(format port " \"~a\" [label = \"~a\", shape = box, fontname = Helvetica];~%"
|
||||||
id (package-full-name node)))
|
id label))
|
||||||
(define (emit-edge id1 id2 port)
|
(define (emit-edge id1 id2 port)
|
||||||
(format port " \"~a\" -> \"~a\" [color = ~a];~%"
|
(format port " \"~a\" -> \"~a\" [color = ~a];~%"
|
||||||
id1 id2 (pop-color id1)))
|
id1 id2 (pop-color id1)))
|
||||||
|
@ -215,11 +213,11 @@ var nodes = {},
|
||||||
(format port "</script><script type=\"text/javascript\" src=\"~a\"></script></body></html>"
|
(format port "</script><script type=\"text/javascript\" src=\"~a\"></script></body></html>"
|
||||||
(search-path %load-path "graph.js")))
|
(search-path %load-path "graph.js")))
|
||||||
|
|
||||||
(define (emit-d3js-node id node port)
|
(define (emit-d3js-node id label port)
|
||||||
(format port "\
|
(format port "\
|
||||||
nodes[\"~a\"] = {\"id\": \"~a\", \"label\": \"~a\", \"index\": nodeArray.length};
|
nodes[\"~a\"] = {\"id\": \"~a\", \"label\": \"~a\", \"index\": nodeArray.length};
|
||||||
nodeArray.push(nodes[\"~a\"]);~%"
|
nodeArray.push(nodes[\"~a\"]);~%"
|
||||||
id id (package-full-name node) id))
|
id id label id))
|
||||||
|
|
||||||
(define (emit-d3js-edge id1 id2 port)
|
(define (emit-d3js-edge id1 id2 port)
|
||||||
(format port "links.push({\"source\": \"~a\", \"target\": \"~a\"});~%"
|
(format port "links.push({\"source\": \"~a\", \"target\": \"~a\"});~%"
|
||||||
|
@ -243,9 +241,9 @@ nodeArray.push(nodes[\"~a\"]);~%"
|
||||||
(define (emit-cypher-epilogue port)
|
(define (emit-cypher-epilogue port)
|
||||||
(format port ""))
|
(format port ""))
|
||||||
|
|
||||||
(define (emit-cypher-node id node port)
|
(define (emit-cypher-node id label port)
|
||||||
(format port "MERGE (p:Package { id: ~s }) SET p.name = ~s;~%"
|
(format port "MERGE (p:Package { id: ~s }) SET p.name = ~s;~%"
|
||||||
id (package-name node)))
|
id label ))
|
||||||
|
|
||||||
(define (emit-cypher-edge id1 id2 port)
|
(define (emit-cypher-edge id1 id2 port)
|
||||||
(format port "MERGE (a:Package { id: ~s });~%" id1)
|
(format port "MERGE (a:Package { id: ~s });~%" id1)
|
||||||
|
@ -298,7 +296,7 @@ true, draw reverse arrows."
|
||||||
(ids (mapm %store-monad
|
(ids (mapm %store-monad
|
||||||
node-identifier
|
node-identifier
|
||||||
dependencies)))
|
dependencies)))
|
||||||
(emit-node id head port)
|
(emit-node id (node-label head) port)
|
||||||
(for-each (lambda (dependency dependency-id)
|
(for-each (lambda (dependency dependency-id)
|
||||||
(if reverse-edges?
|
(if reverse-edges?
|
||||||
(emit-edge dependency-id id port)
|
(emit-edge dependency-id id port)
|
||||||
|
|
Loading…
Reference in New Issue