From 998c9c86f5c66096073f0329429197624bcad0cc Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 18 Nov 2008 03:43:28 -0600 Subject: [PATCH] Added packager. --- support/buildbot/package.pl | 78 +++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 support/buildbot/package.pl diff --git a/support/buildbot/package.pl b/support/buildbot/package.pl new file mode 100755 index 0000000..15484cb --- /dev/null +++ b/support/buildbot/package.pl @@ -0,0 +1,78 @@ +#!/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_user = ; +$ftp_pass = ; +$ftp_path = ; +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')); + +my ($version); + +$version = Build::ProductVersion(Build::PathFormat('../../product.version')); +$version .= '-hg' . Build::HgRevNum('../..'); + +my ($filename); +$filename = 'mmsource-' . $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); +