Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2381f1e3

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID 2381f1e308db61970b8ab3bb760bd3854cdcbb18
  • Vorgänger 6a9bd14f
  • Nachfolger 07948c34

Graphviz-Erstellung auf Standard "png" umgestellt; Option für Auswahl des Formats hinzugefügt.

Unterschiede anzeigen:

scripts/dbupgrade2_tool.pl
32 32
#######
33 33

  
34 34
my ($opt_list, $opt_tree, $opt_rtree, $opt_nodeps, $opt_graphviz, $opt_help);
35
my ($opt_user, $opt_apply, $opt_applied);
35
my ($opt_user, $opt_apply, $opt_applied, $opt_format);
36 36

  
37 37
our (%myconfig, $form, $user, $auth);
38 38

  
39 39
sub show_help {
40
  my $help_text = <<'END_HELP'
40
  my $help_text = <<"END_HELP"
41 41
dbupgrade2_tool.pl [options]
42 42

  
43 43
  A validation and information tool for the database upgrade scripts
44
  in 'sql/Pg-upgrade2'.
44
  in \'sql/Pg-upgrade2\'.
45 45

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

  
51 51
  Actions:
......
55 55
    --graphviz[=file]    Create a Postscript document showing a tree of
56 56
                         all database upgrades and their dependencies.
57 57
                         If no file name is given then the output is
58
                         written to 'db_dependencies.ps'.
58
                         written to \'db_dependencies.png\'.
59
    --format=...         Format for the graphviz output. Defaults to
60
                         \'png\'. All values that the command \'dot\' accepts
61
                         for it\'s option \'-T\' are acceptable.
59 62
    --nodeps             List all database upgrades that no other upgrade
60 63
                         depends on
61
    --apply=tag          Applies the database upgrades 'tag' and all
62
                         upgrades it depends on. If '--apply' is used
63
                         then the option '--user' must be used as well.
64
    --apply=tag          Applies the database upgrades \'tag\' and all
65
                         upgrades it depends on. If \'--apply\' is used
66
                         then the option \'--user\' must be used as well.
64 67
    --applied            List the applied database upgrades for the
65
                         database that the user given with '--user' uses.
68
                         database that the user given with \'--user\' uses.
66 69
    --help               Show this help and exit.
67 70

  
68 71
  Options:
69 72
    --user=name          The name of the user configuration to use for
70 73
                         database connectivity.
71 74
END_HELP
72
    ;
73

  
74
  # Syntax-Highlighting-Fix f?r Emacs: '
75
;
75 76

  
76 77
  print $help_text;
77 78

  
......
154 155
}
155 156

  
156 157
sub dump_graphviz {
157
  my $file_name = shift || "db_dependencies.ps";
158
  my %params    = @_;
159

  
160
  my $format    = $params{format}    || "png";
161
  my $file_name = $params{file_name} || "db_dependencies.${format}";
158 162

  
159
  print "GRAPHVIZ POSTCRIPT\n\n";
163
  print "GRAPHVIZ OUTPUT -- format: ${format}\n\n";
160 164
  print "Output will be written to '${file_name}'\n";
161 165

  
162 166
  calc_rev_depends();
163 167

  
164
  $dot = "|dot -Tps ";
168
  $dot = "|dot -T${format} ";
165 169
  open OUT, "${dot}> \"${file_name}\"" || die;
166 170

  
167 171
  print OUT
......
350 354
           "rtree"      => \$opt_rtree,
351 355
           "nodeps"     => \$opt_nodeps,
352 356
           "graphviz:s" => \$opt_graphviz,
357
           "format:s"   => \$opt_format,
353 358
           "user=s"     => \$opt_user,
354 359
           "apply=s"    => \$opt_apply,
355 360
           "applied"    => \$opt_applied,
......
360 365

  
361 366
$controls = parse_dbupdate_controls($form, "Pg");
362 367

  
363
dump_list()                  if ($opt_list);
364
dump_tree()                  if ($opt_tree);
365
dump_tree_reverse()          if ($opt_rtree);
366
dump_graphviz($opt_graphviz) if (defined $opt_graphviz);
367
dump_nodeps()                if ($opt_nodeps);
368
dump_list()                                 if ($opt_list);
369
dump_tree()                                 if ($opt_tree);
370
dump_tree_reverse()                         if ($opt_rtree);
371
dump_graphviz('file_name' => $opt_graphviz,
372
              'format'    => $opt_format)   if (defined $opt_graphviz);
373
dump_nodeps()                               if ($opt_nodeps);
368 374

  
369 375
if ($opt_user) {
370 376
  $auth = SL::Auth->new();

Auch abrufbar als: Unified diff