Updated build scipts.
This commit is contained in:
parent
0014b4f2ad
commit
5c67e6a460
@ -217,7 +217,7 @@ class SM:
|
|||||||
|
|
||||||
# For OS X dylib versioning
|
# For OS X dylib versioning
|
||||||
import re
|
import re
|
||||||
productFile = open(os.path.join(AMBuild.sourceFolder, 'buildbot', 'product.version'), 'r')
|
productFile = open(os.path.join(AMBuild.sourceFolder, 'product.version'), 'r')
|
||||||
productContents = productFile.read()
|
productContents = productFile.read()
|
||||||
productFile.close()
|
productFile.close()
|
||||||
m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
|
m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
|
||||||
|
|||||||
@ -24,7 +24,7 @@ def PerformReversioning():
|
|||||||
return False
|
return False
|
||||||
cache.CacheVariable('cset', cset)
|
cache.CacheVariable('cset', cset)
|
||||||
|
|
||||||
productFile = open(os.path.join(AMBuild.sourceFolder, 'buildbot', 'product.version'), 'r')
|
productFile = open(os.path.join(AMBuild.sourceFolder, 'product.version'), 'r')
|
||||||
productContents = productFile.read()
|
productContents = productFile.read()
|
||||||
productFile.close()
|
productFile.close()
|
||||||
m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', productContents)
|
m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', productContents)
|
||||||
|
|||||||
@ -1,58 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
# vim: set ts=2 sw=2 tw=99 noet:
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use Cwd;
|
|
||||||
use File::Basename;
|
|
||||||
use File::Path;
|
|
||||||
|
|
||||||
my ($myself, $path) = fileparse($0);
|
|
||||||
chdir($path);
|
|
||||||
|
|
||||||
require 'helpers.pm';
|
|
||||||
|
|
||||||
#Go back above build dir
|
|
||||||
chdir(Build::PathFormat('../..'));
|
|
||||||
|
|
||||||
#Get the source path.
|
|
||||||
our ($root) = getcwd();
|
|
||||||
|
|
||||||
rmtree('OUTPUT');
|
|
||||||
mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
|
|
||||||
chdir('OUTPUT');
|
|
||||||
my ($result);
|
|
||||||
print "Attempting to reconfigure...\n";
|
|
||||||
|
|
||||||
#update and configure shiz
|
|
||||||
if ($^O eq "linux") {
|
|
||||||
$ENV{'SOURCEMOD14'} = '/home/builds/common/sourcemod-1.4';
|
|
||||||
$ENV{'MMSOURCE19'} = '/home/builds/common/mmsource-1.9';
|
|
||||||
|
|
||||||
$ENV{'HL2SDKOBVALVE'} = '/home/builds/common/hl2sdk-ob-valve';
|
|
||||||
$ENV{'HL2SDKCSS'} = '/home/builds/common/hl2sdk-css';
|
|
||||||
} elsif ($^O eq "darwin") {
|
|
||||||
$ENV{'SOURCEMOD14'} = '/Users/builds/slaves/common/sourcemod-1.4';
|
|
||||||
$ENV{'MMSOURCE19'} = '/Users/builds/slaves/common/mmsource-1.9';
|
|
||||||
|
|
||||||
$ENV{'HL2SDKOBVALVE'} = '/Users/builds/slaves/common/hl2sdk-ob-valve';
|
|
||||||
$ENV{'HL2SDKCSS'} = '/Users/builds/slaves/common/hl2sdk-css';
|
|
||||||
} else {
|
|
||||||
$ENV{'SOURCEMOD14'} = 'C:/Scripts/common/sourcemod-1.4';
|
|
||||||
$ENV{'MMSOURCE19'} = 'C:/Scripts/common/mmsource-1.9';
|
|
||||||
|
|
||||||
#$ENV{'HL2SDKOBVALVE'} = 'H:/hl2sdk-ob-valve';
|
|
||||||
#$ENV{'HL2SDKCSS'} = 'H:/hl2sdk-css';
|
|
||||||
}
|
|
||||||
|
|
||||||
#configure AMBuild
|
|
||||||
if ($^O eq "linux") {
|
|
||||||
$result = `CC=gcc CXX=gcc python3 ../build/configure.py --enable-optimize`;
|
|
||||||
} elsif ($^O eq "darwin") {
|
|
||||||
$result = `CC=clang CXX=clang python3 ../build/configure.py --enable-optimize`;
|
|
||||||
} else {
|
|
||||||
$result = `C:\\Python31\\Python.exe ..\\build\\configure.py --enable-optimize`;
|
|
||||||
}
|
|
||||||
print "$result\n";
|
|
||||||
if ($? != 0) {
|
|
||||||
die('Could not configure!');
|
|
||||||
}
|
|
||||||
@ -1,94 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use Cwd;
|
|
||||||
|
|
||||||
package Build;
|
|
||||||
|
|
||||||
sub HgRevNum
|
|
||||||
{
|
|
||||||
my ($path) = (@_);
|
|
||||||
my ($cd, $text, $rev);
|
|
||||||
|
|
||||||
$cd = Cwd::cwd();
|
|
||||||
chdir($path);
|
|
||||||
$text = `hg identify -n`;
|
|
||||||
chdir($cd);
|
|
||||||
|
|
||||||
chomp $text;
|
|
||||||
if ($text =~ /^(\d+)/)
|
|
||||||
{
|
|
||||||
return $1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub ProductVersion
|
|
||||||
{
|
|
||||||
my ($file) = (@_);
|
|
||||||
my ($version);
|
|
||||||
open(FILE, $file) or die "Could not open $file: $!\n";
|
|
||||||
$version = <FILE>;
|
|
||||||
close(FILE);
|
|
||||||
chomp $version;
|
|
||||||
return $version;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use Cwd;
|
|
||||||
use File::Basename;
|
|
||||||
use Net::FTP;
|
|
||||||
|
|
||||||
my ($ftp_host, $ftp_user, $ftp_pass, $ftp_path);
|
|
||||||
|
|
||||||
$ftp_host = $ARGV[0];
|
|
||||||
$ftp_user = $ARGV[1];
|
|
||||||
$ftp_pass = $ARGV[2];
|
|
||||||
$ftp_path = $ARGV[3];
|
|
||||||
|
|
||||||
my ($myself, $path) = fileparse($0);
|
|
||||||
chdir($path);
|
|
||||||
|
|
||||||
require 'helpers.pm';
|
|
||||||
|
|
||||||
my ($version);
|
|
||||||
$version = Build::ProductVersion(Build::PathFormat('product.version'));
|
|
||||||
$version .= '-hg' . Build::HgRevNum('.');
|
|
||||||
|
|
||||||
# Append OS to package version
|
|
||||||
if ($^O eq "darwin")
|
|
||||||
{
|
|
||||||
$version .= '-mac';
|
|
||||||
}
|
|
||||||
elsif ($^O =~ /MSWin/)
|
|
||||||
{
|
|
||||||
$version .= '-windows';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$version .= '-' . $^O;
|
|
||||||
}
|
|
||||||
|
|
||||||
#Switch to the output folder.
|
|
||||||
chdir(Build::PathFormat('../../OUTPUT/package'));
|
|
||||||
|
|
||||||
my ($filename);
|
|
||||||
$filename = 'connect-' . $version;
|
|
||||||
if ($^O eq "linux")
|
|
||||||
{
|
|
||||||
$filename .= '.tar.gz';
|
|
||||||
print "tar zcvf $filename addons\n";
|
|
||||||
system("tar zcvf $filename addons");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$filename .= '.zip';
|
|
||||||
print "zip -r $filename addons\n";
|
|
||||||
system("zip -r $filename addons");
|
|
||||||
}
|
|
||||||
|
|
||||||
#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);
|
|
||||||
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
# vim: set ts=2 sw=2 tw=99 noet:
|
|
||||||
|
|
||||||
use File::Basename;
|
|
||||||
|
|
||||||
my ($myself, $path) = fileparse($0);
|
|
||||||
chdir($path);
|
|
||||||
|
|
||||||
require 'helpers.pm';
|
|
||||||
|
|
||||||
chdir('../../OUTPUT');
|
|
||||||
|
|
||||||
$ENV{'BREAKPAD_SYMBOL_SERVER'} = 'http://crash.limetech.org/submit-symbols';
|
|
||||||
|
|
||||||
if ($^O eq "linux") {
|
|
||||||
$ENV{'PATH'} .= ':/home/builds/common/';
|
|
||||||
} elsif ($^O eq "darwin") {
|
|
||||||
$ENV{'PATH'} .= ':/Users/builds/slaves/common/';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($^O eq "linux" || $^O eq "darwin") {
|
|
||||||
system("python3 build.py 2>&1");
|
|
||||||
} else {
|
|
||||||
system("C:\\Python31\\python.exe build.py 2>&1");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($? != 0)
|
|
||||||
{
|
|
||||||
die "Build failed: $!\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
71
upload.py
Normal file
71
upload.py
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
import re, os, sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import zipfile
|
||||||
|
import ftplib
|
||||||
|
|
||||||
|
platform = 'unknown'
|
||||||
|
if sys.platform.startswith('linux'):
|
||||||
|
platform = 'linux'
|
||||||
|
elif sys.platform.startswith('win32'):
|
||||||
|
platform = 'windows'
|
||||||
|
elif sys.platform.startswith('darwin'):
|
||||||
|
platform = 'mac'
|
||||||
|
|
||||||
|
def HGVersion():
|
||||||
|
p = subprocess.Popen(['hg', 'identify', '-n'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||||
|
(stdout, stderr) = p.communicate()
|
||||||
|
stdout = stdout.decode('UTF-8')
|
||||||
|
|
||||||
|
return stdout.rstrip('+\r\n')
|
||||||
|
|
||||||
|
def ReleaseVersion():
|
||||||
|
productFile = open('product.version', 'r')
|
||||||
|
productContents = productFile.read()
|
||||||
|
productFile.close()
|
||||||
|
|
||||||
|
m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', productContents)
|
||||||
|
if m == None:
|
||||||
|
raise Exception('Could not detremine product version')
|
||||||
|
|
||||||
|
major, minor, release, tag = m.groups()
|
||||||
|
return '.'.join([major, minor, release])
|
||||||
|
|
||||||
|
filename = '-'.join(['connect', ReleaseVersion(), 'hg' + HGVersion(), platform])
|
||||||
|
|
||||||
|
debug_build = os.environ.get('is_debug_build', False) == "1"
|
||||||
|
|
||||||
|
if debug_build:
|
||||||
|
filename += '-debug'
|
||||||
|
|
||||||
|
filename += '.zip'
|
||||||
|
|
||||||
|
zip = zipfile.ZipFile(filename, 'w', zipfile.ZIP_DEFLATED)
|
||||||
|
|
||||||
|
for base, dirs, files in os.walk('package'):
|
||||||
|
for file in files:
|
||||||
|
fn = os.path.join(base, file)
|
||||||
|
fns = fn[(len('package') + 1):]
|
||||||
|
|
||||||
|
zip.write(fn, fns)
|
||||||
|
|
||||||
|
print("%-33s %-10s %21s %12s" % ("File Name", "CRC32", "Modified ", "Size"))
|
||||||
|
for zinfo in zip.infolist():
|
||||||
|
date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
|
||||||
|
print("%-33s %-10d %21s %12d" % (zinfo.filename, zinfo.CRC, date, zinfo.file_size))
|
||||||
|
|
||||||
|
zip.close()
|
||||||
|
|
||||||
|
if 'ftp_hostname' in os.environ:
|
||||||
|
print('')
|
||||||
|
|
||||||
|
ftp = ftplib.FTP(os.environ['ftp_hostname'], os.environ['ftp_username'], os.environ['ftp_password'])
|
||||||
|
print('Connected to server, uploading build...')
|
||||||
|
ftp.cwd(os.environ['ftp_directory'])
|
||||||
|
print(ftp.storbinary('STOR ' + filename, open(filename, 'rb')))
|
||||||
|
ftp.quit()
|
||||||
|
|
||||||
|
print('Uploaded as \'' + filename + '\'')
|
||||||
|
|
||||||
|
os.unlink(filename)
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user