From 15d309bff5aa0990aebc30303fcb4d8598b0a7b6 Mon Sep 17 00:00:00 2001 From: Leigh B Stoller Date: Fri, 3 Aug 2012 17:03:23 -0600 Subject: [PATCH] Add -c (check syntax) option. --- db/dbupdate.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/db/dbupdate.in b/db/dbupdate.in index abd9b449b..812782e18 100644 --- a/db/dbupdate.in +++ b/db/dbupdate.in @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # # 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. # use strict; @@ -13,14 +13,15 @@ use Getopt::Std; # sub usage() { - print STDERR "Usage: dbupdate [-v] [-s] [-f] []\n"; + print STDERR "Usage: dbupdate [-v] [-c] [-s] [-f] []\n"; exit(-1); } -my $optlist = "dsfvp:q"; +my $optlist = "dsfvp:qc"; my $debug = 0; my $force = 0; my $single = 0; my $verify = 0; +my $check = 0; my $quiet = 0; my $path; my $dbname; @@ -86,6 +87,9 @@ if (defined($options{"q"})) { if (defined($options{"v"})) { $verify = 1; } +if (defined($options{"c"})) { + $check = 1; +} if (defined($options{"p"})) { $path = $options{"p"}; chdir($path) or @@ -207,7 +211,8 @@ foreach my $file (@files) { 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. undef &DoUpdate; @@ -218,6 +223,9 @@ foreach my $file (@files) { Fatal(" could not parse $file: $@") if $@; Fatal(" could not do $file: $!") if $!; } + next + if ($check); + # Then we run it. if (DoUpdate($dbnumber, $dbname, $revision) != 0) { Fatal(" returned non-zero; aborting.\n"); -- GitLab