diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2022-12-27 15:25:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-27 15:25:53 +0100 |
commit | 3d961b9a1f129b1d1be98b4e50d6dafd7888097a (patch) | |
tree | f9bd1c83800216dcc8a60e451998fc5acbd2da97 /share | |
parent | d100ac892352e3b63b1fe028207c72fc9a852724 (diff) | |
download | spack-3d961b9a1f129b1d1be98b4e50d6dafd7888097a.tar.gz spack-3d961b9a1f129b1d1be98b4e50d6dafd7888097a.tar.bz2 spack-3d961b9a1f129b1d1be98b4e50d6dafd7888097a.tar.xz spack-3d961b9a1f129b1d1be98b4e50d6dafd7888097a.zip |
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.
Diffstat (limited to 'share')
-rwxr-xr-x | share/spack/spack-completion.bash | 2 | ||||
-rw-r--r-- | share/spack/templates/misc/graph.dot | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 028ec16bee..83fb689028 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -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 diff --git a/share/spack/templates/misc/graph.dot b/share/spack/templates/misc/graph.dot new file mode 100644 index 0000000000..488aa6be1b --- /dev/null +++ b/share/spack/templates/misc/graph.dot @@ -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 %} + +}
\ No newline at end of file |