From 0c128c2091433a4190619cd9c514d4caba2a0491 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 27 Apr 2007 09:37:20 +0000 Subject: [PATCH] =?utf8?q?Beim=20Graphviz-Baum=20diejenigen=20Knoten=20hel?= =?utf8?q?lgrau=20einf=C3=A4rben,=20von=20denen=20kein=20weiterer=20Knoten?= =?utf8?q?=20abh=C3=A4ngt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- scripts/dbupgrade2_tool.pl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/dbupgrade2_tool.pl b/scripts/dbupgrade2_tool.pl index 31b997c3c..0e1194dc8 100755 --- a/scripts/dbupgrade2_tool.pl +++ b/scripts/dbupgrade2_tool.pl @@ -152,20 +152,25 @@ sub dump_graphviz { print("GRAPHVIZ POSTCRIPT\n\n"); print("Output will be written to '${file_name}'\n"); + + calc_rev_depends(); + $dot = "|dot -Tps "; - open(OUT, "${dot}> \"${file_name}\""); + open OUT, "${dot}> \"${file_name}\"" || die; + print(OUT "digraph db_dependencies {\n" . - "node [shape=box];\n"); + "node [shape=box style=filled fillcolor=white];\n"); my %ranks; foreach my $c (values(%{$controls})) { - $ranks{$c->{"depth"}} = [] unless ($ranks{$c->{"depth"}}); - push(@{$ranks{$c->{"depth"}}}, $c->{"tag"}); + $ranks{$c->{"depth"}} ||= []; + + my ($pre, $post) = ('node [fillcolor=lightgray] ', 'node [fillcolor=white] ') if !@{ $c->{"rev_depends"} }; + + push @{ $ranks{$c->{"depth"}} }, qq|${pre}"$c->{tag}"; ${post}|; } foreach (sort(keys(%ranks))) { - print(OUT "{ rank = same; " . - join("", map({ '"' . $_ . '"; ' } @{$ranks{$_}})) . - " }\n"); + print OUT "{ rank = same; ", join("", @{ $ranks{$_} }), " }\n"; } foreach my $c (values(%{$controls})) { print(OUT "$c->{tag};\n"); -- 2.20.1