Commit 15d309bf authored by Leigh B Stoller's avatar Leigh B Stoller

Add -c (check syntax) option.

parent 2485339b
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2009-2010 University of Utah and the Flux Group. # Copyright (c) 2009-2012 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
use strict; use strict;
...@@ -13,14 +13,15 @@ use Getopt::Std; ...@@ -13,14 +13,15 @@ use Getopt::Std;
# #
sub usage() sub usage()
{ {
print STDERR "Usage: dbupdate [-v] [-s] [-f] <dbname> [<version>]\n"; print STDERR "Usage: dbupdate [-v] [-c] [-s] [-f] <dbname> [<version>]\n";
exit(-1); exit(-1);
} }
my $optlist = "dsfvp:q"; my $optlist = "dsfvp:qc";
my $debug = 0; my $debug = 0;
my $force = 0; my $force = 0;
my $single = 0; my $single = 0;
my $verify = 0; my $verify = 0;
my $check = 0;
my $quiet = 0; my $quiet = 0;
my $path; my $path;
my $dbname; my $dbname;
...@@ -86,6 +87,9 @@ if (defined($options{"q"})) { ...@@ -86,6 +87,9 @@ if (defined($options{"q"})) {
if (defined($options{"v"})) { if (defined($options{"v"})) {
$verify = 1; $verify = 1;
} }
if (defined($options{"c"})) {
$check = 1;
}
if (defined($options{"p"})) { if (defined($options{"p"})) {
$path = $options{"p"}; $path = $options{"p"};
chdir($path) or chdir($path) or
...@@ -207,7 +211,8 @@ foreach my $file (@files) { ...@@ -207,7 +211,8 @@ foreach my $file (@files) {
next; next;
} }
print "Processing update $fullpath\n"; print "" .
($check ? "Syntax checking" : "Processing") . " update $fullpath\n";
# Undefine this to make sure we get a new version each file. # Undefine this to make sure we get a new version each file.
undef &DoUpdate; undef &DoUpdate;
...@@ -218,6 +223,9 @@ foreach my $file (@files) { ...@@ -218,6 +223,9 @@ foreach my $file (@files) {
Fatal(" could not parse $file: $@") if $@; Fatal(" could not parse $file: $@") if $@;
Fatal(" could not do $file: $!") if $!; Fatal(" could not do $file: $!") if $!;
} }
next
if ($check);
# Then we run it. # Then we run it.
if (DoUpdate($dbnumber, $dbname, $revision) != 0) { if (DoUpdate($dbnumber, $dbname, $revision) != 0) {
Fatal(" returned non-zero; aborting.\n"); Fatal(" returned non-zero; aborting.\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment