2010-04-04 23:07:37 +00:00
|
|
|
#!/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';
|
|
|
|
|
|
|
|
my ($version);
|
2010-04-05 01:10:35 +00:00
|
|
|
$version = Build::ProductVersion(Build::PathFormat('../../product.version'));
|
|
|
|
$version .= '-hg' . Build::HgRevNum('.');
|
2010-04-04 23:07:37 +00:00
|
|
|
|
2010-04-05 01:10:35 +00:00
|
|
|
#Switch to the output folder.
|
|
|
|
chdir(Build::PathFormat('../../../OUTPUT'));
|
2010-04-04 23:07:37 +00:00
|
|
|
|
2013-02-13 07:22:40 +00:00
|
|
|
my (@packages,@mac_exclude);
|
2010-04-05 01:10:35 +00:00
|
|
|
@packages = ('base', 'cstrike', 'dod', 'esf', 'ns', 'tfc', 'ts');
|
2013-02-13 07:22:40 +00:00
|
|
|
@mac_exclude = ('esf', 'ns', 'ts');
|
2010-04-04 23:07:37 +00:00
|
|
|
|
|
|
|
my ($major,$minor) = ($version =~ /^(\d+)\.(\d+)/);
|
|
|
|
$ftp_path .= "/$major.$minor";
|
|
|
|
|
|
|
|
my ($ftp);
|
|
|
|
|
2011-07-02 02:51:27 +00:00
|
|
|
$ftp = Net::FTP->new($ftp_host, Debug => 0, Passive => 0)
|
2010-04-04 23:07:37 +00:00
|
|
|
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();
|
2010-04-05 01:10:35 +00:00
|
|
|
my ($i);
|
|
|
|
for ($i = 0; $i <= $#packages; $i++) {
|
|
|
|
my ($filename);
|
|
|
|
if ($^O eq "linux") {
|
2013-02-13 07:22:40 +00:00
|
|
|
$filename = "amxmodx-$version-" . $packages[$i] . "-linux.tar.gz";
|
|
|
|
} elsif ($^O eq "darwin") {
|
|
|
|
next if ($packages[$i] ~~ @mac_exclude);
|
|
|
|
$filename = "amxmodx-$version-" . $packages[$i] . "-mac.zip";
|
2010-04-05 01:10:35 +00:00
|
|
|
} else {
|
2013-02-13 07:22:40 +00:00
|
|
|
$filename = "amxmodx-$version-" . $packages[$i] . "-windows.zip";
|
2010-04-05 01:10:35 +00:00
|
|
|
}
|
|
|
|
print "Uploading $filename...\n";
|
|
|
|
$ftp->put($filename)
|
|
|
|
or die "Cannot drop file $filename ($ftp_path): " . $ftp->message . "\n";
|
|
|
|
}
|
2010-04-04 23:07:37 +00:00
|
|
|
|
|
|
|
$ftp->close();
|
|
|
|
|
2010-04-05 01:10:35 +00:00
|
|
|
print "Files sent to drop site -- build succeeded.\n";
|
2010-04-04 23:07:37 +00:00
|
|
|
|
|
|
|
exit(0);
|
|
|
|
|