sourcemod/tools/buildbot/package.pl
Kyle Sanderson 48150e0c7a
Bring languages into the tree (#1625)
* translations: bring languages into tree

* Update translation phrases changed since 2021

* Update packaging script to include all translations

* Update languages.cfg

* Add Latin American Spanish translations

This is a copy of spanish for now.

* Ignore "en" when looking for translation folders

English is the default and doesn't use a subfolder.

* Only add each translation folder once

Korean "ko" is in there twice.

* Compare language coverage to english

All phrases are compared to the english baseline files and any differences
are reported. The differences are pushed to a Github Project as well for
an easier overview.

Thank you to @nosoop for sharing the Python SMC parser!

* Add link to README

---------

Co-authored-by: Peace-Maker <peace-maker@wcfan.de>
2023-03-29 16:23:05 +02:00

142 lines
3.1 KiB
Perl
Executable File

#!/usr/bin/perl
use strict;
use Cwd;
use File::Basename;
use File::Copy;
use File::stat;
use File::Temp qw/ tempfile :seekable/;
use Net::FTP;
use autodie qw(:all);
my ($ftp_file, $ftp_host, $ftp_user, $ftp_pass, $ftp_path, $tag);
$ftp_file = shift;
$tag = 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);
use FindBin;
use lib $FindBin::Bin;
require 'helpers.pm';
#Switch to the output folder.
chdir(Build::PathFormat('../../../OUTPUT/package'));
unless (-e '../GeoLite2-City_20191217.tar')
{
print "Downloading GeoLite2-City.mmdb...\n";
# Don't check certificate. It will fail on the slaves and we're resolving to internal addressing anyway
system('wget --no-check-certificate -q -O ../GeoLite2-City_20191217.tar.gz https://sm.alliedmods.net/GeoLite2-City_20191217.tar.gz');
system('gunzip ../GeoLite2-City_20191217.tar.gz');
system('tar -C ../ -xf ../GeoLite2-City_20191217.tar');
copy('../GeoLite2-City_20191217/GeoLite2-City.mmdb', 'addons/sourcemod/configs/geoip/GeoLite2-City.mmdb');
}
else
{
print "Reusing existing GeoLite2-City.mmdb\n";
}
my ($version);
$version = Build::ProductVersion(Build::PathFormat('../../build/product.version'));
$version =~ s/-dev//g;
$version .= '-git' . Build::GitRevNum('../../build');
# Append OS to package version
if ($^O eq "darwin")
{
$version .= '-mac';
}
elsif ($^O =~ /MSWin/)
{
$version .= '-windows';
}
else
{
$version .= '-' . $^O;
}
if (defined $tag)
{
$version .= '-' . $tag;
}
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 ($tmpfh, $tmpfile) = tempfile();
print $tmpfh $filename;
$tmpfh->seek( 0, SEEK_END );
my $latest = "sourcemod-latest-";
if ($^O eq "darwin") {
$latest .= "mac";
}
elsif ($^O =~ /MSWin/) {
$latest .= "windows";
}
else {
$latest .= $^O;
}
my ($major,$minor) = ($version =~ /^(\d+)\.(\d+)/);
$ftp_path .= "/$major.$minor";
my ($ftp);
$ftp = Net::FTP->new($ftp_host, Debug => 0, Passive => 1)
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->put($tmpfile, $latest)
or die "Cannot drop file $latest ($ftp_path): " . $ftp->message . "\n";
$ftp->close();
print "File sent to drop site as $filename.\n";
print "Deleting file \"$filename\"...\n";
unlink($filename) or die "Cannot delete file \"$filename\"\n";
print "Successfully deleted file.\n";
print "Build succeeded.\n";
exit(0);