Revision 0c128c20
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
scripts/dbupgrade2_tool.pl | ||
---|---|---|
152 | 152 |
|
153 | 153 |
print("GRAPHVIZ POSTCRIPT\n\n"); |
154 | 154 |
print("Output will be written to '${file_name}'\n"); |
155 |
|
|
156 |
calc_rev_depends(); |
|
157 |
|
|
155 | 158 |
$dot = "|dot -Tps "; |
156 |
open(OUT, "${dot}> \"${file_name}\""); |
|
159 |
open OUT, "${dot}> \"${file_name}\"" || die; |
|
160 |
|
|
157 | 161 |
print(OUT |
158 | 162 |
"digraph db_dependencies {\n" . |
159 |
"node [shape=box];\n"); |
|
163 |
"node [shape=box style=filled fillcolor=white];\n");
|
|
160 | 164 |
my %ranks; |
161 | 165 |
foreach my $c (values(%{$controls})) { |
162 |
$ranks{$c->{"depth"}} = [] unless ($ranks{$c->{"depth"}}); |
|
163 |
push(@{$ranks{$c->{"depth"}}}, $c->{"tag"}); |
|
166 |
$ranks{$c->{"depth"}} ||= []; |
|
167 |
|
|
168 |
my ($pre, $post) = ('node [fillcolor=lightgray] ', 'node [fillcolor=white] ') if !@{ $c->{"rev_depends"} }; |
|
169 |
|
|
170 |
push @{ $ranks{$c->{"depth"}} }, qq|${pre}"$c->{tag}"; ${post}|; |
|
164 | 171 |
} |
165 | 172 |
foreach (sort(keys(%ranks))) { |
166 |
print(OUT "{ rank = same; " . |
|
167 |
join("", map({ '"' . $_ . '"; ' } @{$ranks{$_}})) . |
|
168 |
" }\n"); |
|
173 |
print OUT "{ rank = same; ", join("", @{ $ranks{$_} }), " }\n"; |
|
169 | 174 |
} |
170 | 175 |
foreach my $c (values(%{$controls})) { |
171 | 176 |
print(OUT "$c->{tag};\n"); |
Auch abrufbar als: Unified diff
Beim Graphviz-Baum diejenigen Knoten hellgrau einfärben, von denen kein weiterer Knoten abhängt.