diff options
author | Kevin Koch <kpkoch@mit.edu> | 2007-04-20 20:41:42 +0000 |
---|---|---|
committer | Kevin Koch <kpkoch@mit.edu> | 2007-04-20 20:41:42 +0000 |
commit | 9a729fd320a0604545cf3c392a4073e3a83783cf (patch) | |
tree | 50fde2b4cb5f659c5143175f6880cea787774745 /src/windows | |
parent | 0068c833457bd580ccc8dda09dd209466bc89a8a (diff) | |
download | krb5-9a729fd320a0604545cf3c392a4073e3a83783cf.zip krb5-9a729fd320a0604545cf3c392a4073e3a83783cf.tar.gz krb5-9a729fd320a0604545cf3c392a4073e3a83783cf.tar.bz2 |
Add /REPOSITORY EXPORT option
Adjust abbreviations: /svntag is now 't' so /src can be 's' so /repository can have the abbreviation 'r.'
Process /NOLOG.
Write out ignored command line options as ones being passed to NMAKE (via build.pl).
Generate GetOptions argument from the <Config> section of the config.xml file.
Ticket: new
Tags: Pullup
Target_Version: 1.6.1
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19513 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows')
-rw-r--r-- | src/windows/build/BKWconfig.xml | 35 | ||||
-rw-r--r-- | src/windows/build/bkw-automation.html | 17 | ||||
-rw-r--r-- | src/windows/build/bkw.pl | 116 |
3 files changed, 89 insertions, 79 deletions
diff --git a/src/windows/build/BKWconfig.xml b/src/windows/build/BKWconfig.xml index 93167f3..30c77f9 100644 --- a/src/windows/build/BKWconfig.xml +++ b/src/windows/build/BKWconfig.xml @@ -8,6 +8,7 @@ Parameters are grouped into Options, Directories, Repository and Environment.
Attributes a parameter can have:
+ abbr: A one character abbreviation.
def: defined or not. A value of 'A' for 'always' means the
option can't be negated on the command line.
value: string value, if the option can have a value. If the option
@@ -15,33 +16,35 @@ options: space-delimited list, the 1st element is the default.
Synonyms for a valid option are concatenated with '|'.
env: an environment variable will be set to value or deleted,
- depending on def.
+ depending on def. If set and no value is given, '1' is used.
-->
<!-- Options: -->
<clean def="0" />
- <debug def="0" />
- <help def="0" />
- <logfile def="1" value="bkw.pl.log" />
+ <config def="1" abbr="f" value="bkwconfig.xml" />
+ <debug def="0" abbr="d" />
+ <help def="0" abbr="h|?" />
+ <logfile def="1" abbr="l" value="bkw.pl.log" />
<make def="1" />
+ <nolog def="0" />
<package def="1" />
- <repository def="1" value="skip" options="skip checkout|co update|up" />
+ <repository def="A" abbr="r" value="skip" options="skip checkout|co export|ex update|up" />
<sign def="0" />
- <verbose def="0" />
+ <verbose def="0" abbr="v" />
<vverbose def="0" />
<!-- Directory settings: -->
<!-- Sources will be checked out of repositories into <src>. The structure
of the repositories will cause pismere/athena to be created under <src>. -->
- <src def="A" value="C:\KfW" /> <!-- Must be absolute path. -->
- <out def="A" value="C:\KfW\public" /> <!-- Must be absolute path. -->
+ <src def="A" abbr="s" value="C:\KfW" /> <!-- Must be absolute path. -->
+ <out def="A" abbr="o" value="C:\KfW\public" /> <!-- Must be absolute path. -->
<!-- Repository settings: -->
- <cvstag def="0" value="" />
- <svntag def="0" value="" />
- <svnbranch def="0" value="" />
+ <cvstag def="0" abbr="c" value="" />
+ <svntag def="0" abbr="t" value="" />
+ <svnbranch def="0" abbr="b" value="" />
+ <username def="0" abbr="u" value="" /> <!-- Needed for svn/plink. Override from command line -->
<CVSROOT def="A" value=":kserver:cvs.mit.edu:/cvs/pismere" />
- <SVNURL def="A" value="svn.mit.edu" /> <!-- NB: No protocol or slashes!! -->
- <username def="0" value="" /> <!-- Needed for svn/plink. Override from command line -->
+ <SVNURL def="A" value="svn.mit.edu" /> <!-- NB: No protocol or slashes!! -->
<!-- Environment variables: -->
<KH_RELEASE def="1" env="1" value="OFFICIAL" options="OFFICIAL PRERELEASE PRIVATE" />
@@ -72,8 +75,8 @@ </Prunes>
<Requires>
<Switch dummy="foo" />
- <Switch name="REPOSITORY" value="CHECKOUT"/>
- <ErrorMsg text="Can't build source zip unless /REPOSITORY CHECKOUT is specified." />
+ <Switch name="REPOSITORY" value="CHECKOUT|EXPORT"/>
+ <ErrorMsg text="Can't build source zip unless /REPOSITORY CHECKOUT or /REPOSITORY EXPORT is specified." />
</Requires>
</Zip>
</Zips>
@@ -142,7 +145,7 @@ <ReleaseTag value="%release%" /> <!-- Pick a string that won't appear in a path. -->
</Config>
<Files>
- <Include path="corebinaryfiles.xml" /> <!-- Includeed file is relative to location of bkw.pl. -->
+ <Include path="corebinaryfiles.xml" /> <!-- Included file is relative to location of bkw.pl. -->
</Files>
</CopyList>
</Zip>
diff --git a/src/windows/build/bkw-automation.html b/src/windows/build/bkw-automation.html index 4583e54..ab0ef7d 100644 --- a/src/windows/build/bkw-automation.html +++ b/src/windows/build/bkw-automation.html @@ -124,7 +124,7 @@ /config /f path Path to config file. Default is
bkwconfig.xml.
<BR>
- /src /r dir Source directory to use.
+ /src /s dir Source directory to use.
Should contain
<BR>
@@ -140,19 +140,18 @@ <BR>
</TT><TT> /repository checkout | co \ What repository action to take.
<BR>
-
- update | up ) Options are to checkout, update or
- <BR>
-
- skip / take no
- action [skip].
- <BR>
+ /r
+ update | up \ Options are to checkout, update, export<BR>
+ export
+ | ex \ or take no action [skip]. <BR>
+
+ skip<BR>
/username /u name username used to access svn if checking out.
<BR>
/cvstag /c tag use -r <tag>
<TAG>in cvs
command <BR> /svnbranch /b tag use
-/branches/<tag><TAG> instead of /trunk.<BR> /svntag /s tag use
+/branches/<tag><TAG> instead of /trunk.<BR> /svntag /t tag use
/tags/<tag><TAG> instead of /trunk.<BR> /debug
/d Do debug make instead of
release make. <BR>
diff --git a/src/windows/build/bkw.pl b/src/windows/build/bkw.pl index 8b8b1ab..08a1682 100644 --- a/src/windows/build/bkw.pl +++ b/src/windows/build/bkw.pl @@ -41,17 +41,18 @@ Usage: $0 [options] NMAKE-options Options:
/help /? usage information (what you now see).
/config /f path Path to config file. Default is bkwconfig.xml.
- /srcdir /r dir Source directory to use. Should contain
+ /srcdir /s dir Source directory to use. Should contain
pismere/athena. If cvstag or svntag is null,
the directory should be prepopulated.
/outdir /o dir Directory to be created where build results will go
/repository checkout | co \\ What repository action to take.
- update | up ) Options are to checkout, update or
- skip / take no action [skip].
+ /r update | up \\ Options are to checkout, update, export
+ export | ex \\ or skip (take no action).
+ skip
/username /u name username used to access svn if checking out.
/cvstag /c tag use -r <tag> in cvs command
/svnbranch /b tag use /branches/<tag> instead of /trunk.
- /svntag /s tag use /tags/<tag> instead of /trunk.
+ /svntag /t tag use /tags/<tag> instead of /trunk.
/debug /d Do debug make instead of release make.
/[no]make Control the make step.
/clean Build clean target.
@@ -89,27 +90,38 @@ sub main { 'ignore_case', 'pass_through',
'prefix_pattern=(--|-|\+|\/)',
);
- GetOptions($OPT,
- 'help|h|?',
- 'cvstag|c:s',
- 'svntag|s:s',
- 'svnbranch|b:s',
- 'src|r:s',
- 'out|o:s',
- 'debug|d',
- 'nodebug',
- 'config|f=s',
- 'logfile|l:s',
- 'nolog',
- 'repository:s',
- 'username|u:s',
- 'verbose|v',
- 'vverbose',
- 'make!',
- 'clean',
- 'package!',
- 'sign!',
- );
+
+ local @goargs = ('config|f=s');
+ if (!GetOptions($OPT, @goargs)) {
+ Usage();
+ exit(0);
+ }
+
+ if (! exists $OPT->{config}) {$OPT->{config} = "bkwconfig.xml";}
+ my $configfile = $OPT->{config};
+ print "Info -- Reading configuration from $configfile.\n";
+ my $xml = new XML::Simple();
+ $config = $xml->XMLin($configfile); ## Read in configuration file.
+
+ # Set up convenience variables:
+ local $odr = $config->{Config}; ## Options, directories, repository, environment.
+
+ # Build argument description from Config section of the XML,
+ # to parse the rest of the arguments:
+ local @xmlargs;
+ while (($sw, $val) = each %$odr) {
+ local $arg = $sw;
+ if (exists $val->{abbr}) {$arg .= "|$val->{abbr}";}
+ if (exists $val->{value}) { ## Can't do both negations and string values.
+ $arg .= ":s";
+ }
+ else {
+ if (! ($val->{def} =~ /A/)) {$arg .= "!";}
+ }
+ push @xmlargs, $arg;
+ }
+
+ if (!GetOptions($OPT, @xmlargs)) {$OPT->{help} = 1;}
if ( $OPT->{help} ) {
usage();
@@ -120,15 +132,6 @@ sub main { ##++ Validate required conditions:
- local $argvsize = @ARGV;
- if ($argvsize > 0) {
- print "Error -- invalid argument: $ARGV[0]\n";
- usage();
- die;
- }
-
- if (! exists $OPT->{config}) {$OPT->{config} = "bkwconfig.xml";}
-
# List of programs which must be in PATH:
my @required_list = ('sed', 'awk', 'which', 'cat', 'rm', 'cvs', 'svn', 'doxygen',
'hhc', 'candle', 'light', 'makensis', 'nmake', 'plink', 'filever');
@@ -160,17 +163,8 @@ sub main { ##++ Assemble configuration from config file and command line:
- my $configfile = $OPT->{config};
my $bOutputCleaned = 0;
- print "Info -- Reading configuration from $configfile.\n";
-
- # Get configuration file:
- my $xml = new XML::Simple();
- $config = $xml->XMLin($configfile);
- # Set up convenience variables:
- local $odr = $config->{Config}; ## Options, directories, repository, environment.
-
#while ($v = each %$OPT) {print "$v: $OPT->{$v}\n";}
# Scan the configuration for switch definitions:
@@ -265,11 +259,14 @@ sub main { die "Fatal -- Can't specify both /SVNTAG and /SVNBRANCH.";
}
+ # /logfile and /nolog interact:
+ if ($odr->{nolog}->{def}) {$odr->{logfile}->{def} = 0;}
+
##-- Assemble configuration from config file and command line.
local $rverb = $odr->{repository}->{value};
- if ( ($rverb =~ /checkout/) && $clean) {
- print "Warning -- Because sources afe being checked out, make clean will not be run.\n";
+ if ( (($rverb =~ /checkout/) || ($rverb =~ /export/)) && $clean) {
+ print "Warning -- Because sources are being checked out, make clean will not be run.\n";
$clean = $odr->{clean}->{def} = 0;
}
@@ -285,9 +282,18 @@ sub main { }
}
- if ( ($rverb =~ /checkout/) && (-d $wd) ){
+ print "Executing $cmdline\n";
+ local $argvsize = @ARGV;
+ if ($argvsize > 0) {
+ print "\nArguments for NMAKE: ";
+ map {print " $_ "} @ARGV;
+ print "\n";
+ }
+
+ # (------------------------------------------------)
+ if ( (-d $wd) && ( ($rverb =~ /export/) || ($rverb =~ /checkout/) ) ) {
print "\n\nHEADS UP!!\n\n";
- print "/REPOSITORY CHECKOUT will cause everything under $wd to be deleted.\n";
+ print "/REPOSITORY ".uc($rverb)." will cause everything under $wd to be deleted.\n";
print "If this is not what you intended, here's your chance to bail out!\n\n\n";
print "Are you sure you want to remove everything under $wd? ";
my $char = getc;
@@ -305,8 +311,6 @@ sub main { $l->no_die_handler; ## Needed so XML::Simple won't throw exceptions.
}
- print "Executing $cmdline\n";
-
##++ Begin repository action:
if ($rverb =~ /skip/) {print "Info -- *** Skipping repository access.\n" if ($verbose);}
else {
@@ -328,7 +332,7 @@ sub main { $cvscmdroot .= " -r $odr->{cvstag}->{value}";
}
- if ($rverb =~ /checkout/) {
+ if (($rverb =~ /checkout/) || ($rverb =~ /export/)) {
chdir($src) or die "Fatal -- couldn't chdir to $src\n";
print "Info -- chdir to ".`cd`."\n" if ($verbose);
my @cvsmodules = (
@@ -337,11 +341,11 @@ sub main { 'pismere/athena/util/lib/getopt',
'pismere/athena/util/guiwrap'
);
-
+ local $logging = $odr->{logfile}->{def} ? ">> $odr->{logfile}->{value} 2>&1" : " ";
foreach my $module (@cvsmodules) {
local $cvscmd = $cvscmdroot." ".$module;
if ($verbose) {print "Info -- cvs command: $cvscmd\n";}
- !system($cvscmd) or die "Fatal -- command \"$cvscmd\" failed; return code $?\n";
+ !system("$cvscmd") or die "Fatal -- command \"$cvscmd\" failed; return code $?\n";
}
}
else { ## Update.
@@ -364,8 +368,12 @@ sub main { chdir($krb5dir) or die "Fatal -- Couldn't chdir to $krb5dir";
print "Info -- chdir to ".`cd`."\n" if ($verbose);
my $svncmd = "svn $rverb ";
- if ($rverb =~ /checkout/) { # Append the rest of the checkout command:
+ if (($rverb =~ /checkout/) || ($rverb =~ /export/)) { # Append the rest of the checkout/export command:
chdir("..");
+ if ($rverb =~ /export/) {
+ ## svn export will fail if the destination directory exists
+ rmdir "krb5";
+ }
$svncmd .= "svn+ssh://".$odr->{username}->{value}."@".$odr->{SVNURL}->{value}."/krb5/";
if (length $odr->{svntag}->{value} > 0) {
$svncmd .= "tags/$odr->{svntag}->{value}";
@@ -446,7 +454,7 @@ sub main { ##-- Read in the version information & set config info.
##++ Repository action, part 2:
- if ($rverb =~ /checkout/) {
+ if (($rverb =~ /checkout/) || ($rverb =~ /export/)) {
if (! $bOutputCleaned) { ## In case somebody cleaned $out before us.
if (-d $out) {!system("rm -rf $out/*") or die "Fatal -- Couldn't clean $out."} ## Clean output directory.
else {mkdir($out);}
|