of the repositories will cause pismere/athena to be created under <src>. -->\r
<src path ="C:\projects\Autobuild" />\r
<out path ="C:\projects\Autobuild\public" /> <!-- Must be absolute path. -->\r
- <unixfind path ="c:\cygwin\bin" />\r
</Directories>\r
<Options>\r
<debug value="0" />\r
<SVNURL name="svn.mit.edu" /> <!-- NB: No protocol or slashes!! -->\r
<USERNAME name="" /> <!-- Needed for svn/plink. Override from command line -->\r
</Config>\r
- </FetchSources>\r
- <Make></Make>\r
+ <Zips>\r
+ <Zip dummy="foo" /> <!-- To force desired XML::Simple behavior -->\r
+ <Zip name="SRC" filename="%filestem%-src.zip" topdir="%filestem%-final">\r
+ <CopyList>\r
+ <Files>\r
+ <!-- File from paths are relative to <src>/pismere. -->\r
+ <!-- File to paths are relative to <out>. -->\r
+ <File dummy="foo" /> <!-- Forces XML::Simple behavior -->\r
+ <!-- Without this, XML::Simple does not make an anonymous array and I can't figure out how to iterate over it. -->\r
+ <File name="*.*" from="athena" to="src\athena" />\r
+ <File name="*.*" from="doc" to="src\doc" />\r
+ <File name="*.*" from="scripts" to="src\scripts" />\r
+ </Files>\r
+ </CopyList>\r
+ <Prunes> <!-- Files to be removed from current build to match what is in the 3.1 distribution: -->\r
+ <Prune dummy="foo" />\r
+ <Prune name="CVS" />\r
+ <Prune name=".cvsignore" flags="i" />\r
+ <Prune name="Changelog" flags="i" />\r
+ <Prune name="site" />\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
+ </Requires>\r
+ </Zip>\r
+ </Zips>\r
+ </FetchSources>\r
+ <Make>\r
+ <!-- Script checks for prunes. -->\r
+ </Make>\r
<PrePackage>\r
<CopyList>\r
<Config>\r
<Prune dummy="foo" />\r
<Prune name="*.exe" />\r
<Prune name="*.msi" />\r
+ <Prune name="*.dll" />\r
+ <Prune name="*.obj" />\r
+ <Prune name="*.wixobj" />\r
+ <Prune name="custom.lib" />\r
+ <Prune name="custom.exp" />\r
</Prunes>\r
- </Zip>\r
- <Zip name="SRC" filename="%filestem%-src.zip" topdir="%filestem%-final">\r
- <CopyList>\r
- <Files>\r
- <!-- File from paths are relative to <src>/pismere. -->\r
- <!-- File to paths are relative to <out>. -->\r
- <File dummy="foo" /> <!-- Forces XML::Simple behavior -->\r
- <!-- Without this, XML::Simple does not make an anonymous array and I can't figure out how to iterate over it. -->\r
- <File name="*.*" from="athena" to="src\athena" />\r
- <File name="*.*" from="doc" to="src\doc" />\r
- <File name="*.*" from="scripts" to="src\scripts" />\r
- </Files>\r
- </CopyList>\r
- <Prunes> <!-- Files to be removed from current build to match what is in the 3.1 distribution: -->\r
- <Prune dummy="foo" />\r
- <Prune name="CVS" />\r
- <Prune name=".cvsignore" flags="i" />\r
- <Prune name="Changelog" flags="i" />\r
- <Prune name="obj" />\r
- <Prune name="site" />\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
- </Requires>\r
</Zip>\r
</Zips> \r
<CopyList> <!-- Copied at end of post-package step. -->\r
use Archive::Zip;\r
use Logger;\r
require "copyfiles.pl";\r
+require "prunefiles.pl";\r
require "signfiles.pl";\r
-require "makeZip.pl";\r
+require "zipXML.pl";\r
\r
my $BAIL;\r
$0 = fileparse($0);\r
\r
# List of programs which must be in PATH:\r
my @required_list = ('sed', 'awk', 'which', 'cat', 'rm', 'cvs', 'svn', 'doxygen', 'hhc', 'candle', 'light', 'makensis', 'nmake', 'plink');\r
- my $requirements_met = 1;\r
- my $first_missing = 0;\r
- my $error_list = "";\r
+ my $requirements_met = 1;\r
+ my $first_missing = 0;\r
+ my $error_list = "";\r
foreach my $required (@required_list) {\r
if (!get_info($required)) {\r
$requirements_met = 0;\r
\r
##++ Assemble configuration from config file and command line:\r
\r
- my $configfile;\r
- $configfile = $OPT->{config};\r
+ my $configfile = $OPT->{config};\r
+ my $bOutputCleaned = 0;\r
\r
print "Info -- Reading configuration from $configfile.\n";\r
\r
#print "cvs tag: $tags[0]->{cvs}->{value}\n";\r
#print "CVSROOT: $fetch[0]->{CVSROOT}->{name}\n";\r
\r
+ # We read in the version information to be able to update the site-local files in the install build areas:\r
+ local $version_path = $config->{Stages}->{Package}->{Config}->{Paths}->{Versions}->{path};\r
+ open(DAT, "$src/$version_path") or die "Could not open $version_path.";\r
+ @raw = <DAT>;\r
+ close DAT;\r
+ foreach $line (@raw) {\r
+ chomp $line;\r
+ if ($line =~ /#define/) { # Process #define lines:\r
+ $line =~ s/#define//; # Remove #define token\r
+ $line =~ s/^\s+//; # and leading & trailing whitespace\r
+ $line =~ s/\s+$//;\r
+ local @qr = split("\"", $line); # Try splitting with quotes\r
+ if (exists $qr[1]) {\r
+ $qr[0] =~ s/^\s+//; # Clean up whitespace\r
+ $qr[0] =~ s/\s+$//;\r
+ $config->{Versions}->{$qr[0]} = $qr[1]; # Save string\r
+ }\r
+ else { # No quotes, so\r
+ local @ar = split(" ", $line); # split with space\r
+ $ar[0] =~ s/^\s+//; # Clean up whitespace\r
+ $ar[0] =~ s/\s+$//;\r
+ $config->{Versions}->{$ar[0]} = $ar[1]; # and save numeric value\r
+ }\r
+ }\r
+ }\r
+\r
+ # Check that the versions we will need for site-local have been defined:\r
+ my @required_versions = ('VER_PROD_MAJOR', 'VER_PROD_MINOR', 'VER_PROD_REV', \r
+ 'VER_PROD_MAJOR_STR', 'VER_PROD_MINOR_STR', 'VER_PROD_REV_STR', \r
+ 'VER_PRODUCTNAME_STR');\r
+ $requirements_met = 1;\r
+ $first_missing = 0;\r
+ $error_list = "";\r
+ foreach my $required (@required_versions) {\r
+ if (! exists $config->{Versions}->{$required}) {\r
+ $requirements_met = 0;\r
+ if (!$first_missing) {\r
+ $first_missing = 1;\r
+ $error_list = "Fatal -- The following version(s) are not defined in $src/$version_path.\n";\r
+ }\r
+ $error_list .= "$required\n";\r
+ }\r
+ }\r
+ if (!$requirements_met) {\r
+ print $error_list;\r
+ exit(0);\r
+ }\r
+ # Apply any of these tags to filestem:\r
+ my $filestem = $config->{Stages}->{PostPackage}->{Config}->{FileStem}->{name};\r
+ $filestem =~ s/%VERSION_MAJOR%/$config->{Versions}->{'VER_PROD_MAJOR_STR'}/;\r
+ $filestem =~ s/%VERSION_MINOR%/$config->{Versions}->{'VER_PROD_MINOR_STR'}/;\r
+ $filestem =~ s/%VERSION_PATCH%/$config->{Versions}->{'VER_PROD_REV_STR'}/;\r
+ $config->{Stages}->{PostPackage}->{Config}->{FileStem}->{name} = $filestem;\r
+ \r
+ # Test the unix find command:\r
+ if (! exists $config->{CommandLine}->{Directories}->{unixfind}->{path}) {\r
+ $config->{CommandLine}->{Directories}->{unixfind}->{path} = "C:\\tools\\cygwin\\bin";\r
+ }\r
+ local $unixfind = $config->{CommandLine}->{Directories}->{unixfind}->{path};\r
+\r
+ local $savedPATH = $ENV{PATH};\r
+ $ENV{PATH} = $unixfind.";".$savedPATH;\r
+print "PATH now $ENV{PATH}\n";\r
+ print "Info -- chdir to ".`cd`."\n" if ($verbose);\r
+ if (-e "a.tmp") {!system("rm a.tmp") or die "Fatal -- Couldn't clean temporary file a.tmp.";}\r
+ !system("find . -name a.tmp > b.tmp 2>&1") or die "Fatal -- find test failed.";\r
+ local $filesize = -s "b.tmp";\r
+ $ENV{PATH} = $savedPATH;\r
+ if ($filesize > 0) {\r
+ die "Fatal -- $unixfind does not appear to be a path to a UNIX find command.";\r
+ }\r
+\r
##-- Assemble configuration from config file and command line.\r
\r
my $sw = $switches[0]->{repository}->{value};\r
}\r
$switches[0]->{repository}->{value} = $rverb; ## Save canonicalized repository verb.\r
\r
+ if ( ($rverb =~ /checkout/) && $clean) {\r
+ print "Warning -- Because sources afe being checked out, make clean will not be run.\n";\r
+ $clean = $switches[0]->{clean}->{value} = 0;\r
+ }\r
+\r
my $wd = $src."\\pismere";\r
\r
if (! ($rverb =~ /skip/)) {\r
if ($verbose) {print "Info -- svn command: $svncmd\n";}\r
!system($svncmd) or die "Fatal -- command \"$svncmd\" failed; return code $?\n";\r
\r
+ if ($rverb =~ /checkout/) { \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
+ $bOutputCleaned = 1;\r
+ }\r
+ zipXML($config->{Stages}->{FetchSources}, $config); ## Make zips.\r
+ }\r
+\r
if ($verbose) {print "Info -- *** End fetching sources.\n";}\r
}\r
##-- End repository action.\r
}\r
\r
# Prune any unwanted directories before the build:\r
- if (exists $config->{Stages}->{Make}->{Prunes}) {\r
- # Use Unix find instead of Windows find. Save PATH so we can restore it when we're done:\r
- my $savedPATH = $ENV{PATH};\r
- $ENV{PATH} = $config->{CommandLine}->{Directories}->{unixfind}->{path}.";".$savedPATH;\r
- my $prunes = $config->{Stages}->{Make}->{Prunes};\r
- my $j=0;\r
- print "Info -- Processing prunes in ".`cd`."\n" if ($verbose);\r
-print Dumper($prunes);\r
- while ($prunes->{Prune}->[$j]) {\r
- if (exists $prunes->{Prune}->[$j]->{name}) { ## Don't process dummy entry!\r
- my $prune = $prunes->{Prune}->[$j]->{name};\r
- my $flags = $prunes->{Prune}->[$j]->{flags};\r
- $flags = "" if (!$flags);\r
- my $cmd = "find . -".$flags."name $prune";\r
- print "Info -- Looking for filenames containing $prune\n";\r
- my $list = `$cmd`;\r
- foreach $target (split("\n", $list)) {\r
- print "Info -- Pruning $target\n" if ($verbose);\r
- ! system("rm -rf $target") or die "Unable to prune $target";\r
- }\r
- }\r
- $j++;\r
- }\r
- $ENV{PATH} = $savedPATH;\r
- }\r
+ pruneFiles($config->{Stages}->{Make}, $config);\r
\r
if ($verbose) {print "Info -- *** End preparing for build.\n";}\r
\r
\r
chdir("$wd\\athena") or die "Fatal -- couldn't chdir to source directory $wd\\athena\n";\r
print "Info -- chdir to ".`cd`."\n" if ($verbose);\r
- my $dbgswitch = ($switches[0]->{debug}->{value}) ? " " : "NODEBUG=1";\r
+ local $dbgswitch = ($switches[0]->{debug}->{value}) ? " " : "NODEBUG=1";\r
!system("perl ../scripts/build.pl --softdirs --nolog $buildtarget $dbgswitch") or die "Fatal -- build $buildtarget failed.";\r
\r
chdir("$wd") or die "Fatal -- couldn't chdir to $wd.";\r
##-- Make action.\r
\r
##++ Package action:\r
- if ($switches[0]->{nopackage}->{value}) { ## If /clean, this switch will have been cleared.\r
- print "Info -- *** Skipping packaging.";\r
- if (-d $out) {\r
+ if ($switches[0]->{nopackage}->{value}) { ## If /clean, nopackage will be set.\r
+ print "Info -- *** Skipping packaging.\n";\r
+ if ((-d $out) && ! $bOutputCleaned) {\r
print "Warning -- *** Output directory $out will not be cleaned.\n";\r
}\r
}\r
else {\r
if ($verbose) {print "Info -- *** Begin prepackage.\n";}\r
\r
- if (-d $out) {\r
- !system("rm -rf $out/*") or die "Fatal -- Couldn't clean $out.";\r
- }\r
- else {\r
- mkdir($out) or die "Fatal -- Couldn't create $out.";\r
- }\r
-\r
- # We read in the version information to be able to update the site-local files in the install build areas:\r
- local $version_path = $config->{Stages}->{Package}->{Config}->{Paths}->{Versions}->{path};\r
- open(DAT, "$src/$version_path") or die "Could not open $version_path.";\r
- @raw = <DAT>;\r
- close DAT;\r
- foreach $line (@raw) {\r
- chomp $line;\r
- if ($line =~ /#define/) { # Process #define lines:\r
- $line =~ s/#define//; # Remove #define token\r
- $line =~ s/^\s+//; # and leading & trailing whitespace\r
- $line =~ s/\s+$//;\r
- local @qr = split("\"", $line); # Try splitting with quotes\r
- if (exists $qr[1]) {\r
- $qr[0] =~ s/^\s+//; # Clean up whitespace\r
- $qr[0] =~ s/\s+$//;\r
- $config->{Versions}->{$qr[0]} = $qr[1]; # Save string\r
- }\r
- else { # No quotes, so\r
- local @ar = split(" ", $line); # split with space\r
- $ar[0] =~ s/^\s+//; # Clean up whitespace\r
- $ar[0] =~ s/\s+$//;\r
- $config->{Versions}->{$ar[0]} = $ar[1]; # and save numeric value\r
- }\r
- }\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
+ $bOutputCleaned = 1;\r
}\r
\r
- # Check that the versions we will need for site-local have been defined:\r
- my @required_versions = ('VER_PROD_MAJOR', 'VER_PROD_MINOR', 'VER_PROD_REV', \r
- 'VER_PROD_MAJOR_STR', 'VER_PROD_MINOR_STR', 'VER_PROD_REV_STR', \r
- 'VER_PRODUCTNAME_STR');\r
- my $requirements_met = 1;\r
- my $first_missing = 0;\r
- my $error_list = "";\r
- foreach my $required (@required_versions) {\r
- if (! exists $config->{Versions}->{$required}) {\r
- $requirements_met = 0;\r
- if (!$first_missing) {\r
- $first_missing = 1;\r
- $error_list = "Fatal -- The following version(s) are not defined in $src/$version_path.\n";\r
- }\r
- $error_list .= "$required\n";\r
- }\r
- }\r
- if (!$requirements_met) {\r
- print $error_list;\r
- exit(0);\r
- }\r
- # Apply any of these tags to filestem:\r
- my $filestem = $config->{Stages}->{PostPackage}->{Config}->{FileStem}->{name};\r
- $filestem =~ s/%VERSION_MAJOR%/$config->{Versions}->{'VER_PROD_MAJOR_STR'}/;\r
- $filestem =~ s/%VERSION_MINOR%/$config->{Versions}->{'VER_PROD_MINOR_STR'}/;\r
- $filestem =~ s/%VERSION_PATCH%/$config->{Versions}->{'VER_PROD_REV_STR'}/;\r
- $config->{Stages}->{PostPackage}->{Config}->{FileStem}->{name} = $filestem;\r
- \r
# The build results are copied to a staging area, where the packager expects to find them.\r
# We put the staging area in the fixed area .../pismere/staging.\r
my $prepackage = $config->{Stages}->{PrePackage};\r
\r
# Run the script on site-local.wxi:\r
!system("sed -f $tmpfile site-local-tagged.wxi > site-local.wxi") or die "Fatal -- Couldn't modify site-local.wxi.";\r
+ !system("rm site-local-tagged.wxi") or die "Fatal -- Couldn't remove site-local-tagged.wsi.";\r
\r
# Now update site-local.nsi:\r
chdir "..\\nsis";\r
print "Info -- chdir to ".`cd`."\n" if ($verbose);\r
!system("sed -f ..\\wix\\$tmpfile site-local-tagged.nsi > b.tmp") or die "Fatal -- Couldn't modify site-local.wxi.";\r
+ !system("rm site-local-tagged.nsi") or die "Fatal -- Couldn't remove site-local-tagged.nsi.";\r
# Add DEBUG or RELEASE:\r
if ($switches[0]->{debug}->{value}) { ## debug build\r
!system("echo !define DEBUG >> b.tmp") or die "Fatal -- Couldn't modify b.tmp."; \r
\r
# Run the script on nsi-includes-tagged.nsi:\r
!system("sed -f ..\\wix\\$tmpfile nsi-includes-tagged.nsi > nsi-includes.nsi") or die "Fatal -- Couldn't modify nsi-includes.nsi.";\r
+ !system("rm nsi-includes-tagged.nsi") or die "Fatal -- Couldn't remove nsi-includes-tagged.nsi.";\r
+ !system("rm ..\\wix\\$tmpfile") or die "Fatal -- Couldn't remove $tmpfile.";\r
\r
if ($verbose) {print "Info -- *** End prepackage.\n";}\r
\r
!system("makensis kfw.nsi") or die "Error -- executable installer build failed.";\r
\r
# Begin packaging extra items:\r
- chdir($src); # Now in <src>.\r
- print "Info -- chdir to ".`cd`."\n" if ($verbose);\r
- if (-d $out) {!system("rm -rf $out/*") or die "Fatal -- Couldn't clean $out."} ## Clean output directory.\r
- else {mkdir($out);}\r
- my $zipsXML = $config->{Stages}->{PostPackage}->{Zips};\r
-\r
- local $i = 0;\r
- while ($zipsXML->{Zip}[$i]) {\r
- local $zip = $zipsXML->{Zip}[$i];\r
- makeZip($zip, $config) if (exists $zip->{name}); ## Ignore dummy entry.\r
- chdir("$out");\r
- print "Info -- chdir to ".`cd`."\n" if ($verbose);\r
- system("rm -rf ziptemp") if (-d "ziptemp"); ## Clean up any temp directory.\r
- $i++; \r
- } ## End zip in xml.\r
- \r
+ zipXML($config->{Stages}->{PostPackage}, $config); ## Make zips.\r
+\r
$config->{Stages}->{PostPackage}->{CopyList}->{Config} = $config->{Stages}->{PostPackage}->{Config}; ## Use the post package config.\r
$config->{Stages}->{PostPackage}->{CopyList}->{Config}->{From}->{root} = "$src\\pismere";\r
$config->{Stages}->{PostPackage}->{CopyList}->{Config}->{To}->{root} = "$out";\r
#!perl -w\r
\r
#use strict;\r
-use Data::Dumper;\r
\r
-require "signfiles.pl";\r
+require "prunefiles.pl";\r
+\r
+use Data::Dumper;\r
\r
sub makeZip {\r
local ($zip, $config) = @_;\r
print "Info -- chdir to ".`cd`."\n" if ($verbose);\r
\r
# Prune any unwanted files or directories from the directory we're about to zip:\r
- if (exists $zip->{Prunes}) {\r
- # Use Unix find instead of Windows find. Save PATH so we can restore it when we're done:\r
- local $savedPATH = $ENV{PATH};\r
- $ENV{PATH} = $config->{CommandLine}->{Directories}->{unixfind}->{path}.";".$savedPATH;\r
- local $prunes = $zip->{Prunes};\r
- local $j = 0;\r
- print "Info -- Processing prunes in ".`cd`."\n" if ($verbose);\r
- while ($prunes->{Prune}->[$j]) {\r
- if (exists $prunes->{Prune}->[$j]->{name}) { ## Don't process dummy entry!\r
- local $prune = $prunes->{Prune}->[$j]->{name};\r
- local $flags = $prunes->{Prune}->[$j]->{flags};\r
- $flags = "" if (!$flags);\r
- local $cmd = "find . -".$flags."name $prune";\r
- print "Info -- Looking for filenames containing $prune\n";\r
- local $list = `$cmd`;\r
- foreach $target (split("\n", $list)) {\r
- print "Info -- Pruning $target\n" if ($verbose);\r
- !system("rm -rf $target") or die "Error -- Couldn't remove $target.";;\r
- }\r
- }\r
- $j++;\r
- }\r
- $ENV{PATH} = $savedPATH;\r
- }\r
+ pruneFiles($zip, $config);\r
\r
local $zipfile = Archive::Zip->new();\r
local $topdir = $zip->{topdir};\r
$topdir =~ s/%filestem%/$filestem/g;\r
$zipfile->addTree('.', $topdir);\r
- if (-e $zipname) {!system("rm -f $zipname") or die "Error -- Couldn't remove $zipname.";}\r
+ if (-e $zipname) {!system("rm -f $zipname") or die "Error -- Couldn't remove $zipname.";}\r
$zipfile->writeToFileNamed($zipname);\r
- print "Info -- created $out\\$zipname.\n" if ($verbose);\r
- # move .zip from <out>/ziptemp to <out>.\r
- !system("mv -f $zipname ..") or die "Error -- Couldn't move $zipname to ..";\r
+ chdir("$out");\r
+ print "Info -- chdir to ".`cd`."\n" if ($verbose);\r
+ # move .zip from <out>/ziptemp to <out>.\r
+ !system("mv -f ziptemp/$zipname .") or die "Error -- Couldn't move $zipname to ..";\r
+ system("rm -rf ziptemp") if (-d "ziptemp"); ## Clean up any temp directory.\r
+ print "Info -- created $out\\$zipname.\n" if ($verbose);\r
}\r
\r
return 1;
\ No newline at end of file