Merged buildbot changes from trunk.
--HG-- branch : sourcemod-1.0.x extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402507
This commit is contained in:
parent
2e8282dab5
commit
f74aed3db2
1
product.version
Normal file
1
product.version
Normal file
@ -0,0 +1 @@
|
||||
1.0.4
|
59
tools/buildbot/bootstrap.pl
Normal file
59
tools/buildbot/bootstrap.pl
Normal file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
my ($myself, $path) = fileparse($0);
|
||||
chdir($path);
|
||||
|
||||
require 'helpers.pm';
|
||||
|
||||
chdir(Build::PathFormat('../builder'));
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
Build::Command('make clean');
|
||||
Build::Command('make');
|
||||
}
|
||||
else
|
||||
{
|
||||
Build::Command('"' . $ENV{'MSVC7'} . '" /Rebuild Release builder.csproj');
|
||||
Build::Command('move ' . Build::PathFormat('bin/Release/builder.exe') . ' .');
|
||||
}
|
||||
|
||||
die "Unable to build builder tool!\n" unless -e 'builder.exe';
|
||||
|
||||
#Go back to main source dir.
|
||||
chdir(Build::PathFormat('../..'));
|
||||
|
||||
#Get the source path.
|
||||
my ($root) = getcwd();
|
||||
|
||||
#Create output folder if it doesn't exist.
|
||||
if (!(-d 'OUTPUT')) {
|
||||
mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
|
||||
}
|
||||
|
||||
#Write the configuration file.
|
||||
open(CONF, '>build.cfg') or die("Failed to write build.cfg: $!\n");
|
||||
print CONF "OutputBase = " . Build::PathFormat($root . '/OUTPUT') . "\n";
|
||||
print CONF "SourceBase = $root\n";
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
print CONF "BuilderPath = /usr/bin/make\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print CONF "BuilderPath = " . $ENV{'MSVC8'} . "\n";
|
||||
}
|
||||
close(CONF);
|
||||
|
||||
#Do the annoying revision bumping.
|
||||
#Linux needs some help here.
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
Build::Command("flip -u modules.versions");
|
||||
Build::Command("flip -u tools/versionchanger.pl");
|
||||
Build::Command("chmod +x tools/versionchanger.pl");
|
||||
}
|
||||
Build::Command(Build::PathFormat('tools/versionchanger.pl'));
|
116
tools/buildbot/helpers.pm
Normal file
116
tools/buildbot/helpers.pm
Normal file
@ -0,0 +1,116 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
|
||||
package Build;
|
||||
|
||||
our $SVN = "/usr/bin/svn";
|
||||
our $SVN_USER = 'dvander';
|
||||
our $SVN_ARGS = '';
|
||||
our $SVN_VERSION = "/usr/bin/svnversion";
|
||||
|
||||
sub Revision
|
||||
{
|
||||
my ($str)=(@_);
|
||||
my $dir = $SVN_VERSION;
|
||||
|
||||
my $data = Command($dir . ' -c ' . $str);
|
||||
if ($data =~ /(\d+):(\d+)/)
|
||||
{
|
||||
return $2;
|
||||
} elsif ($data =~ /(\d+)/) {
|
||||
return $1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sub Delete
|
||||
{
|
||||
my ($str)=(@_);
|
||||
if ($^O =~ /MSWin/)
|
||||
{
|
||||
Command("del /S /F /Q \"$str\"");
|
||||
Command("rmdir /S /Q \"$str\"");
|
||||
} else {
|
||||
Command("rm -rf $str");
|
||||
}
|
||||
return !(-e $str);
|
||||
}
|
||||
|
||||
sub Copy
|
||||
{
|
||||
my ($src,$dest)=(@_);
|
||||
if ($^O =~ /MSWin/)
|
||||
{
|
||||
Command("copy \"$src\" \"$dest\" /y");
|
||||
} else {
|
||||
Command("cp \"$src\" \"$dest\"");
|
||||
}
|
||||
return (-e $dest);
|
||||
}
|
||||
|
||||
sub Move
|
||||
{
|
||||
my ($src,$dest)=(@_);
|
||||
if ($^O =~ /MSWin/)
|
||||
{
|
||||
Command("move \"$src\" \"$dest\"");
|
||||
} else {
|
||||
Command("mv \"$src\" \"$dest\"");
|
||||
}
|
||||
return (-e $dest);
|
||||
}
|
||||
|
||||
sub Command
|
||||
{
|
||||
my($cmd)=(@_);
|
||||
print "$cmd\n";
|
||||
return `$cmd`;
|
||||
}
|
||||
|
||||
sub PathFormat
|
||||
{
|
||||
my ($str)=(@_);
|
||||
if ($^O =~ /MSWin/)
|
||||
{
|
||||
$str =~ s#/#\\#g;
|
||||
} else {
|
||||
$str =~ s#\\#/#g;
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub SVN_Remove
|
||||
{
|
||||
my ($file)=(@_);
|
||||
my ($path, $name);
|
||||
if ($^O =~ /MSWin/)
|
||||
{
|
||||
($path, $name) = ($file =~ /(.+)\/([^\/]+)$/);
|
||||
} else {
|
||||
($path, $name) = ($file =~ /(.+)\\([^\\]+)$/);
|
||||
}
|
||||
my $dir = Cwd::cwd();
|
||||
chdir($path);
|
||||
Command($SVN . ' ' . $SVN_ARGS . ' delete ' . $name);
|
||||
chdir($dir);
|
||||
}
|
||||
|
||||
sub SVN_Add
|
||||
{
|
||||
my ($file)=(@_);
|
||||
my ($path, $name);
|
||||
if ($^O =~ /MSWin/)
|
||||
{
|
||||
($path, $name) = ($file =~ /(.+)\/([^\/]+)$/);
|
||||
} else {
|
||||
($path, $name) = ($file =~ /(.+)\\([^\\]+)$/);
|
||||
}
|
||||
my $dir = Cwd::cwd();
|
||||
chdir($path);
|
||||
Command($SVN . ' ' . $SVN_ARGS . ' add ' . $name);
|
||||
chdir($dir);
|
||||
}
|
||||
|
79
tools/buildbot/package.pl
Normal file
79
tools/buildbot/package.pl
Normal file
@ -0,0 +1,79 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
use Net::FTP;
|
||||
|
||||
my ($ftp_file, $ftp_host, $ftp_user, $ftp_pass, $ftp_path);
|
||||
|
||||
$ftp_file = shift;
|
||||
|
||||
open(FTP, $ftp_file) or die "Unable to read FTP config file $ftp_file: $!\n";
|
||||
$ftp_host = <FTP>;
|
||||
$ftp_user = <FTP>;
|
||||
$ftp_pass = <FTP>;
|
||||
$ftp_path = <FTP>;
|
||||
close(FTP);
|
||||
|
||||
chomp $ftp_host;
|
||||
chomp $ftp_user;
|
||||
chomp $ftp_pass;
|
||||
chomp $ftp_path;
|
||||
|
||||
my ($myself, $path) = fileparse($0);
|
||||
chdir($path);
|
||||
|
||||
require 'helpers.pm';
|
||||
|
||||
#Switch to the output folder.
|
||||
chdir(Build::PathFormat('../../OUTPUT/base'));
|
||||
|
||||
my ($version);
|
||||
|
||||
$version = `cat ../../product.version`;
|
||||
chomp $version;
|
||||
$version .= '.' . Build::Revision('../..');
|
||||
|
||||
my ($filename);
|
||||
$filename = 'sourcemod-' . $version;
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
$filename .= '.tar.gz';
|
||||
print "tar zcvf $filename addons cfg\n";
|
||||
system("tar zcvf $filename addons cfg");
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename .= '.zip';
|
||||
print "zip -r $filename addons cfg\n";
|
||||
system("zip -r $filename addons cfg");
|
||||
}
|
||||
|
||||
my ($major,$minor) = ($version =~ /^(\d+)\.(\d+)/);
|
||||
$ftp_path .= "/$major.$minor";
|
||||
|
||||
my ($ftp);
|
||||
|
||||
$ftp = Net::FTP->new($ftp_host, Debug => 0)
|
||||
or die "Cannot connect to host $ftp_host: $@";
|
||||
|
||||
$ftp->login($ftp_user, $ftp_pass)
|
||||
or die "Cannot connect to host $ftp_host as $ftp_user: " . $ftp->message . "\n";
|
||||
|
||||
if ($ftp_path ne '')
|
||||
{
|
||||
$ftp->cwd($ftp_path)
|
||||
or die "Cannot change to folder $ftp_path: " . $ftp->message . "\n";
|
||||
}
|
||||
|
||||
$ftp->binary();
|
||||
$ftp->put($filename)
|
||||
or die "Cannot drop file $filename ($ftp_path): " . $ftp->message . "\n";
|
||||
|
||||
$ftp->close();
|
||||
|
||||
print "File sent to drop site as $filename -- build succeeded.\n";
|
||||
|
||||
exit(0);
|
||||
|
39
tools/buildbot/startbuild.pl
Normal file
39
tools/buildbot/startbuild.pl
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use File::Basename;
|
||||
|
||||
my ($myself, $path) = fileparse($0);
|
||||
chdir($path);
|
||||
|
||||
require 'helpers.pm';
|
||||
|
||||
chdir('..');
|
||||
chdir('..');
|
||||
|
||||
my ($cmd, $output);
|
||||
|
||||
$cmd = Build::PathFormat('tools/builder/builder.exe') . ' build.cfg 2>&1';
|
||||
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
$cmd = 'mono ' . $cmd;
|
||||
}
|
||||
|
||||
system($cmd);
|
||||
|
||||
if ($? == -1)
|
||||
{
|
||||
die "Build failed: $!\n";
|
||||
}
|
||||
elsif ($^O eq "linux" and $? & 127)
|
||||
{
|
||||
die "Build died :(\n";
|
||||
}
|
||||
elsif ($? >> 8 != 0)
|
||||
{
|
||||
die "Build failed with exit code: " . ($? >> 8) . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(0);
|
||||
}
|
@ -44,7 +44,6 @@ namespace builder
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
|
||||
Console.WriteLine("Debug: wd = " + info.WorkingDirectory + " fn = " + info.FileName + " arg = " + info.Arguments);
|
||||
Console.WriteLine(output);
|
||||
|
||||
string binary = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source);
|
||||
|
@ -43,8 +43,11 @@ namespace builder
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Console.WriteLine("Build failed: " + e.Message);
|
||||
Console.WriteLine("Build failed, exception: " + e.Message);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user