diff --git a/support/buildbot/bootstrap.pl b/support/buildbot/bootstrap.pl index 477fc83c..5dc0055c 100755 --- a/support/buildbot/bootstrap.pl +++ b/support/buildbot/bootstrap.pl @@ -10,7 +10,7 @@ chdir($path); require 'helpers.pm'; #Go to main source dir -chdir(Build::PathFormat('../..')); +chdir(Build::PathFormat('../../..')); #Get the source path. our ($root) = getcwd(); diff --git a/support/buildbot/helpers.pm b/support/buildbot/helpers.pm index 704a7b17..05ce5945 100644 --- a/support/buildbot/helpers.pm +++ b/support/buildbot/helpers.pm @@ -9,6 +9,24 @@ our $SVN = "/usr/bin/svn"; our $SVN_USER = 'dvander'; our $SVN_ARGS = ''; +sub GitRevNum +{ + my ($path) = (@_); + my ($cd, $text, $rev); + + $cd = Cwd::cwd(); + chdir($path); + $text = `git rev-list --count HEAD`; + chdir($cd); + + chomp $text; + if ($text =~ /^(\d+)/) { + return $1; + } + + return 0; +} + sub HgRevNum { my ($path) = (@_); diff --git a/support/buildbot/package.pl b/support/buildbot/package.pl index 874b81de..2397f659 100755 --- a/support/buildbot/package.pl +++ b/support/buildbot/package.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl +# vim: set ts=4 sts=4 sw=4 tw=99 noet: use strict; use Cwd; @@ -28,7 +29,7 @@ require 'helpers.pm'; my ($version); $version = Build::ProductVersion(Build::PathFormat('../../product.version')); -$version .= '-hg' . Build::HgRevNum('.'); +$version .= '-git' . Build::GitRevNum('.'); #Switch to the output folder. chdir(Build::PathFormat('../../../OUTPUT')); @@ -38,9 +39,33 @@ my (@packages,@mac_exclude); @mac_exclude = ('esf', 'ns', 'ts'); my ($major,$minor) = ($version =~ /^(\d+)\.(\d+)/); -$ftp_path .= "/$major.$minor"; + +my ($i); +for ($i = 0; $i <= $#packages; $i++) { + my ($filename); + next if (($^O eq "darwin") && ($packages[$i] ~~ @mac_exclude)); + + if ($^O eq "linux") { + $filename = "amxmodx-$version-" . $packages[$i] . "-linux.tar.gz"; + } elsif ($^O eq "darwin") { + $filename = "amxmodx-$version-" . $packages[$i] . "-mac.zip"; + } else { + $filename = "amxmodx-$version-" . $packages[$i] . "-windows.zip"; + } + unlink($filename); + + chdir(Build::PathFormat("packages/" . $packages[$i])); + if ($^O eq "linux") { + Build::Command("tar zcvf $filename addons"); + } else { + Build::Command("zip -r $filename addons"); + } + Build::Move($filename, Build::PathFormat('../../')); + chdir(Build::PathFormat('../..')); +} my ($ftp); +$ftp_path .= "/$major.$minor"; $ftp = Net::FTP->new($ftp_host, Debug => 0, Passive => 0) or die "Cannot connect to host $ftp_host: $@"; @@ -51,11 +76,10 @@ $ftp->login($ftp_user, $ftp_pass) if ($ftp_path ne '') { $ftp->cwd($ftp_path) - or die "Cannot change to folder $ftp_path: " . $ftp->message . "\n"; + or die "Cannot change to folder $ftp_path: " . $ftp->message . "\n"; } $ftp->binary(); -my ($i); for ($i = 0; $i <= $#packages; $i++) { my ($filename); if ($^O eq "linux") { diff --git a/support/buildbot/startbuild.pl b/support/buildbot/startbuild.pl index 9d1c1cd4..42ec2b6f 100755 --- a/support/buildbot/startbuild.pl +++ b/support/buildbot/startbuild.pl @@ -7,7 +7,7 @@ chdir($path); require 'helpers.pm'; -chdir('../../OUTPUT'); +chdir('../../../OUTPUT'); my $argn = $#ARGV + 1; if ($argn > 0) {