Parameters are grouped into Options, Directories, Repository and Environment.\r
\r
Attributes a parameter can have:\r
+ abbr: A one character abbreviation.\r
def: defined or not. A value of 'A' for 'always' means the \r
option can't be negated on the command line. \r
value: string value, if the option can have a value. If the option\r
options: space-delimited list, the 1st element is the default.\r
Synonyms for a valid option are concatenated with '|'. \r
env: an environment variable will be set to value or deleted, \r
- depending on def. \r
+ depending on def. If set and no value is given, '1' is used. \r
-->\r
<!-- Options: -->\r
<clean def="0" />\r
- <debug def="0" />\r
- <help def="0" />\r
- <logfile def="1" value="bkw.pl.log" />\r
+ <config def="1" abbr="f" value="bkwconfig.xml" />\r
+ <debug def="0" abbr="d" />\r
+ <help def="0" abbr="h|?" />\r
+ <logfile def="1" abbr="l" value="bkw.pl.log" />\r
<make def="1" />\r
+ <nolog def="0" />\r
<package def="1" />\r
- <repository def="1" value="skip" options="skip checkout|co update|up" />\r
+ <repository def="A" abbr="r" value="skip" options="skip checkout|co export|ex update|up" />\r
<sign def="0" />\r
- <verbose def="0" />\r
+ <verbose def="0" abbr="v" />\r
<vverbose def="0" />\r
\r
<!-- Directory settings: -->\r
<!-- Sources will be checked out of repositories into <src>. The structure\r
of the repositories will cause pismere/athena to be created under <src>. -->\r
- <src def="A" value="C:\KfW" /> <!-- Must be absolute path. -->\r
- <out def="A" value="C:\KfW\public" /> <!-- Must be absolute path. -->\r
+ <src def="A" abbr="s" value="C:\KfW" /> <!-- Must be absolute path. -->\r
+ <out def="A" abbr="o" value="C:\KfW\public" /> <!-- Must be absolute path. -->\r
\r
<!-- Repository settings: -->\r
- <cvstag def="0" value="" />\r
- <svntag def="0" value="" />\r
- <svnbranch def="0" value="" />\r
+ <cvstag def="0" abbr="c" value="" />\r
+ <svntag def="0" abbr="t" value="" />\r
+ <svnbranch def="0" abbr="b" value="" />\r
+ <username def="0" abbr="u" value="" /> <!-- Needed for svn/plink. Override from command line -->\r
<CVSROOT def="A" value=":kserver:cvs.mit.edu:/cvs/pismere" />\r
- <SVNURL def="A" value="svn.mit.edu" /> <!-- NB: No protocol or slashes!! -->\r
- <username def="0" value="" /> <!-- Needed for svn/plink. Override from command line -->\r
+ <SVNURL def="A" value="svn.mit.edu" /> <!-- NB: No protocol or slashes!! -->\r
\r
<!-- Environment variables: -->\r
<KH_RELEASE def="1" env="1" value="OFFICIAL" options="OFFICIAL PRERELEASE PRIVATE" />\r
</Prunes>\r
<Requires>\r
<Switch dummy="foo" />\r
- <Switch name="REPOSITORY" value="CHECKOUT"/>\r
- <ErrorMsg text="Can't build source zip unless /REPOSITORY CHECKOUT is specified." />\r
+ <Switch name="REPOSITORY" value="CHECKOUT|EXPORT"/>\r
+ <ErrorMsg text="Can't build source zip unless /REPOSITORY CHECKOUT or /REPOSITORY EXPORT is specified." />\r
</Requires>\r
</Zip>\r
</Zips>\r
<ReleaseTag value="%release%" /> <!-- Pick a string that won't appear in a path. -->\r
</Config>\r
<Files>\r
- <Include path="corebinaryfiles.xml" /> <!-- Includeed file is relative to location of bkw.pl. -->\r
+ <Include path="corebinaryfiles.xml" /> <!-- Included file is relative to location of bkw.pl. -->\r
</Files> \r
</CopyList>\r
</Zip>\r
Options:\r
/help /? usage information (what you now see).\r
/config /f path Path to config file. Default is bkwconfig.xml.\r
- /srcdir /r dir Source directory to use. Should contain \r
+ /srcdir /s dir Source directory to use. Should contain \r
pismere/athena. If cvstag or svntag is null, \r
the directory should be prepopulated.\r
/outdir /o dir Directory to be created where build results will go\r
/repository checkout | co \\ What repository action to take.\r
- update | up ) Options are to checkout, update or \r
- skip / take no action [skip].\r
+ /r update | up \\ Options are to checkout, update, export\r
+ export | ex \\ or skip (take no action).\r
+ skip \r
/username /u name username used to access svn if checking out.\r
/cvstag /c tag use -r <tag> in cvs command\r
/svnbranch /b tag use /branches/<tag> instead of /trunk.\r
- /svntag /s tag use /tags/<tag> instead of /trunk.\r
+ /svntag /t tag use /tags/<tag> instead of /trunk.\r
/debug /d Do debug make instead of release make.\r
/[no]make Control the make step.\r
/clean Build clean target.\r
'ignore_case', 'pass_through',\r
'prefix_pattern=(--|-|\+|\/)',\r
);\r
- GetOptions($OPT,\r
- 'help|h|?',\r
- 'cvstag|c:s',\r
- 'svntag|s:s',\r
- 'svnbranch|b:s',\r
- 'src|r:s',\r
- 'out|o:s',\r
- 'debug|d',\r
- 'nodebug',\r
- 'config|f=s',\r
- 'logfile|l:s',\r
- 'nolog',\r
- 'repository:s',\r
- 'username|u:s',\r
- 'verbose|v',\r
- 'vverbose',\r
- 'make!',\r
- 'clean',\r
- 'package!',\r
- 'sign!',\r
- );\r
+\r
+ local @goargs = ('config|f=s');\r
+ if (!GetOptions($OPT, @goargs)) {\r
+ Usage();\r
+ exit(0);\r
+ }\r
+\r
+ if (! exists $OPT->{config}) {$OPT->{config} = "bkwconfig.xml";}\r
+ my $configfile = $OPT->{config};\r
+ print "Info -- Reading configuration from $configfile.\n";\r
+ my $xml = new XML::Simple();\r
+ $config = $xml->XMLin($configfile); ## Read in configuration file.\r
+\r
+ # Set up convenience variables:\r
+ local $odr = $config->{Config}; ## Options, directories, repository, environment.\r
+\r
+ # Build argument description from Config section of the XML,\r
+ # to parse the rest of the arguments:\r
+ local @xmlargs;\r
+ while (($sw, $val) = each %$odr) {\r
+ local $arg = $sw;\r
+ if (exists $val->{abbr}) {$arg .= "|$val->{abbr}";}\r
+ if (exists $val->{value}) { ## Can't do both negations and string values.\r
+ $arg .= ":s";\r
+ }\r
+ else { \r
+ if (! ($val->{def} =~ /A/)) {$arg .= "!";}\r
+ }\r
+ push @xmlargs, $arg;\r
+ }\r
+\r
+ if (!GetOptions($OPT, @xmlargs)) {$OPT->{help} = 1;}\r
\r
if ( $OPT->{help} ) {\r
usage();\r
\r
##++ Validate required conditions:\r
\r
- local $argvsize = @ARGV;\r
- if ($argvsize > 0) {\r
- print "Error -- invalid argument: $ARGV[0]\n";\r
- usage();\r
- die;\r
- }\r
- \r
- if (! exists $OPT->{config}) {$OPT->{config} = "bkwconfig.xml";}\r
-\r
# List of programs which must be in PATH:\r
my @required_list = ('sed', 'awk', 'which', 'cat', 'rm', 'cvs', 'svn', 'doxygen', \r
'hhc', 'candle', 'light', 'makensis', 'nmake', 'plink', 'filever');\r
\r
##++ Assemble configuration from config file and command line:\r
\r
- my $configfile = $OPT->{config};\r
my $bOutputCleaned = 0;\r
\r
- print "Info -- Reading configuration from $configfile.\n";\r
-\r
- # Get configuration file:\r
- my $xml = new XML::Simple();\r
- $config = $xml->XMLin($configfile);\r
- # Set up convenience variables:\r
- local $odr = $config->{Config}; ## Options, directories, repository, environment.\r
-\r
#while ($v = each %$OPT) {print "$v: $OPT->{$v}\n";}\r
\r
# Scan the configuration for switch definitions:\r
die "Fatal -- Can't specify both /SVNTAG and /SVNBRANCH.";\r
}\r
\r
+ # /logfile and /nolog interact:\r
+ if ($odr->{nolog}->{def}) {$odr->{logfile}->{def} = 0;}\r
+\r
##-- Assemble configuration from config file and command line.\r
\r
local $rverb = $odr->{repository}->{value};\r
- if ( ($rverb =~ /checkout/) && $clean) {\r
- print "Warning -- Because sources afe being checked out, make clean will not be run.\n";\r
+ if ( (($rverb =~ /checkout/) || ($rverb =~ /export/)) && $clean) {\r
+ print "Warning -- Because sources are being checked out, make clean will not be run.\n";\r
$clean = $odr->{clean}->{def} = 0;\r
}\r
\r
}\r
}\r
\r
- if ( ($rverb =~ /checkout/) && (-d $wd) ){\r
+ print "Executing $cmdline\n";\r
+ local $argvsize = @ARGV;\r
+ if ($argvsize > 0) {\r
+ print "\nArguments for NMAKE: ";\r
+ map {print " $_ "} @ARGV;\r
+ print "\n";\r
+ }\r
+ \r
+ # (------------------------------------------------)\r
+ if ( (-d $wd) && ( ($rverb =~ /export/) || ($rverb =~ /checkout/) ) ) {\r
print "\n\nHEADS UP!!\n\n";\r
- print "/REPOSITORY CHECKOUT will cause everything under $wd to be deleted.\n";\r
+ print "/REPOSITORY ".uc($rverb)." will cause everything under $wd to be deleted.\n";\r
print "If this is not what you intended, here's your chance to bail out!\n\n\n";\r
print "Are you sure you want to remove everything under $wd? ";\r
my $char = getc;\r
$l->no_die_handler; ## Needed so XML::Simple won't throw exceptions.\r
}\r
\r
- print "Executing $cmdline\n";\r
- \r
##++ Begin repository action:\r
if ($rverb =~ /skip/) {print "Info -- *** Skipping repository access.\n" if ($verbose);}\r
else {\r
$cvscmdroot .= " -r $odr->{cvstag}->{value}";\r
}\r
\r
- if ($rverb =~ /checkout/) { \r
+ if (($rverb =~ /checkout/) || ($rverb =~ /export/)) { \r
chdir($src) or die "Fatal -- couldn't chdir to $src\n";\r
print "Info -- chdir to ".`cd`."\n" if ($verbose);\r
my @cvsmodules = ( \r
'pismere/athena/util/lib/getopt', \r
'pismere/athena/util/guiwrap'\r
);\r
-\r
+ local $logging = $odr->{logfile}->{def} ? ">> $odr->{logfile}->{value} 2>&1" : " ";\r
foreach my $module (@cvsmodules) {\r
local $cvscmd = $cvscmdroot." ".$module;\r
if ($verbose) {print "Info -- cvs command: $cvscmd\n";}\r
- !system($cvscmd) or die "Fatal -- command \"$cvscmd\" failed; return code $?\n";\r
+ !system("$cvscmd") or die "Fatal -- command \"$cvscmd\" failed; return code $?\n";\r
}\r
}\r
else { ## Update.\r
chdir($krb5dir) or die "Fatal -- Couldn't chdir to $krb5dir";\r
print "Info -- chdir to ".`cd`."\n" if ($verbose);\r
my $svncmd = "svn $rverb ";\r
- if ($rverb =~ /checkout/) { # Append the rest of the checkout command:\r
+ if (($rverb =~ /checkout/) || ($rverb =~ /export/)) { # Append the rest of the checkout/export command:\r
chdir("..");\r
+ if ($rverb =~ /export/) {\r
+ ## svn export will fail if the destination directory exists\r
+ rmdir "krb5";\r
+ } \r
$svncmd .= "svn+ssh://".$odr->{username}->{value}."@".$odr->{SVNURL}->{value}."/krb5/";\r
if (length $odr->{svntag}->{value} > 0) {\r
$svncmd .= "tags/$odr->{svntag}->{value}";\r
##-- Read in the version information & set config info.\r
\r
##++ Repository action, part 2:\r
- if ($rverb =~ /checkout/) { \r
+ if (($rverb =~ /checkout/) || ($rverb =~ /export/)) { \r
if (! $bOutputCleaned) { ## In case somebody cleaned $out before us.\r
if (-d $out) {!system("rm -rf $out/*") or die "Fatal -- Couldn't clean $out."} ## Clean output directory.\r
else {mkdir($out);}\r