Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 92fc1394

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID 92fc1394dae925962c06e0250d9f1901e89b96d1
  • Vorgänger b49779f0
  • Nachfolger 0c128c20

Hilfetexte ausgeweitet. Der Option --graphviz einen optionalen Parameter hinzugefügt, sodass der Dateinamen vom Benutzer gewählt werden kann.

Unterschiede anzeigen:

scripts/dbupgrade2_tool.pl
35 35
our (%myconfig, $form, $user);
36 36

  
37 37
sub show_help {
38
  print("dbupgrade2_tool.pl [--list] [--tree] [--rtree] [--graphviz]\n" .
39
        "                   [--nodepds] [--user=name --apply=tag] [--help]\n");
38
  my $help_text = <<'END_HELP'
39
dbupgrade2_tool.pl [options]
40

  
41
  A validation and information tool for the database upgrade scripts
42
  in 'sql/Pg-upgrade2'.
43

  
44
  At startup dbupgrade2_tool.pl will always check the consistency
45
  of all database upgrade scripts (e.g. circular references, invalid
46
  formats, missing meta information). You can but don't have to specifiy
47
  additional actions.
48

  
49
  Actions:
50
    --list               Lists all database upgrade tags
51
    --tree               Lists all database upgrades in tree form
52
    --rtree              Lists all database upgrades in reverse tree form
53
    --graphviz[=file]    Create a Postscript document showing a tree of
54
                         all database upgrades and their dependencies.
55
                         If no file name is given then the output is
56
                         written to 'db_dependencies.ps'.
57
    --apply=tag          Applies the database upgrades 'tag' and all
58
                         upgrades it depends on. If '--apply' is used
59
                         then the option '--user' must be used as well.
60
    --help               Show this help and exit.
61

  
62
  Options:
63
    --user=name          The name of the user configuration to use for
64
                         database connectivity.
65
END_HELP
66
    ;
67

  
68
  print $help_text;
69
  exit 0;
40 70
}
41 71

  
42 72
sub error {
......
118 148
}
119 149

  
120 150
sub dump_graphviz {
151
  my $file_name = shift || "db_dependencies.ps";
152

  
121 153
  print("GRAPHVIZ POSTCRIPT\n\n");
122
  print("Output will be written to db_dependencies.ps\n");
154
  print("Output will be written to '${file_name}'\n");
123 155
  $dot = "|dot -Tps ";
124
  open(OUT, "${dot}> db_dependencies.ps");
156
  open(OUT, "${dot}> \"${file_name}\"");
125 157
  print(OUT
126 158
        "digraph db_dependencies {\n" .
127 159
        "node [shape=box];\n");
......
248 280
           "tree" => \$opt_tree,
249 281
           "rtree" => \$opt_rtree,
250 282
           "nodeps" => \$opt_nodeps,
251
           "graphviz" => \$opt_graphviz,
283
           "graphviz:s" => \$opt_graphviz,
252 284
           "user=s" => \$opt_user,
253 285
           "apply=s" => \$opt_apply,
254 286
           "help" => \$opt_help,
......
256 288

  
257 289
if ($opt_help) {
258 290
  show_help();
259
  exit(0);
260 291
}
261 292

  
262 293
$controls = parse_dbupdate_controls($form, "Pg");
......
273 304
  dump_tree_reverse();
274 305
}
275 306

  
276
if ($opt_graphviz) {
277
  dump_graphviz();
307
if (defined $opt_graphviz) {
308
  dump_graphviz($opt_graphviz);
278 309
}
279 310

  
280 311
if ($opt_nodeps) {

Auch abrufbar als: Unified diff