spack graph: rework to use Jinja templates and builders (#34637)
`spack graph` has been reworked to use: - Jinja templates - builder objects to construct the template context when DOT graphs are requested. This allowed to add a new colored output for DOT graphs that highlights both the dependency types and the nodes that are needed at runtime for a given spec.
This commit is contained in:

committed by
GitHub

parent
d100ac8923
commit
3d961b9a1f
@@ -1140,7 +1140,7 @@ _spack_gpg_publish() {
|
||||
_spack_graph() {
|
||||
if $list_options
|
||||
then
|
||||
SPACK_COMPREPLY="-h --help -a --ascii -d --dot -s --static -i --installed --deptype"
|
||||
SPACK_COMPREPLY="-h --help -a --ascii -d --dot -s --static -c --color -i --installed --deptype"
|
||||
else
|
||||
_all_packages
|
||||
fi
|
||||
|
33
share/spack/templates/misc/graph.dot
Normal file
33
share/spack/templates/misc/graph.dot
Normal file
@@ -0,0 +1,33 @@
|
||||
digraph G {
|
||||
labelloc = "b"
|
||||
rankdir = "TB"
|
||||
ranksep = "1"
|
||||
edge[
|
||||
penwidth=2
|
||||
]
|
||||
node[
|
||||
fontname=Monaco,
|
||||
penwidth=4,
|
||||
fontsize=24,
|
||||
margin=.4,
|
||||
shape=box,
|
||||
fillcolor=lightblue,
|
||||
style="rounded,filled"
|
||||
]
|
||||
|
||||
{% for node, node_options in nodes %}
|
||||
{% if node_options %}
|
||||
"{{ node }}" {{ node_options }}
|
||||
{% else %}
|
||||
"{{ node }}"
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for edge_parent, edge_child, edge_options in edges %}
|
||||
{% if edge_options %}
|
||||
"{{ edge_parent }}" -> "{{ edge_child }}" {{ edge_options }}
|
||||
{% else %}
|
||||
"{{ edge_parent }}" -> "{{ edge_child }}"
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
}
|
Reference in New Issue
Block a user