| 1 |
#!/usr/bin/env perl -w |
| 2 |
|
| 3 |
use utf8; |
| 4 |
use encoding "utf8"; |
| 5 |
use File::Copy; |
| 6 |
|
| 7 |
my %files = map {$_ => undef} ("merkaartor", "templates"); |
| 8 |
my $templ = "(".join("|",keys %files).")"; |
| 9 |
foreach my $f (@ARGV) |
| 10 |
{ |
| 11 |
if($f =~ /\*/) { printf "Skipping $f\n"; } |
| 12 |
elsif($f =~ /${templ}_(.*)\.po$/) { $files{$1}{$2} = $f; } |
| 13 |
elsif($f =~ /${templ}\.pot$/) { $files{$1}{pot} = $f; } |
| 14 |
elsif($f =~ /^${templ}-/) { warn "Skip $f"; } |
| 15 |
else { die "unknown file name $f."; } |
| 16 |
} |
| 17 |
mkdir "upl"; |
| 18 |
foreach my $t (keys %files) |
| 19 |
{ |
| 20 |
mkdir "upl/$t" if $files{$t}; |
| 21 |
} |
| 22 |
|
| 23 |
my $temp = "templates"; |
| 24 |
if($files{$temp}) |
| 25 |
{ |
| 26 |
copy($files{$temp}{"pot"}, "upl/$temp/$temp.pot"); |
| 27 |
foreach my $t (keys %{$files{$temp}}) |
| 28 |
{ |
| 29 |
next if $t eq "pot"; |
| 30 |
copy($files{$temp}{$t}, "upl/$temp/$t.po"); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
$temp = "merkaartor"; |
| 35 |
if($files{$temp}) |
| 36 |
{ |
| 37 |
copy($files{$temp}{"pot"}, "upl/$temp/$temp.pot"); |
| 38 |
foreach my $t (keys %{$files{$temp}}) |
| 39 |
{ |
| 40 |
next if $t eq "pot"; |
| 41 |
copy($files{$temp}{$t}, "upl/$temp/$t.po") if -f "${temp}_$t.ts"; |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
chdir "upl"; |
| 46 |
my @t=gmtime(); |
| 47 |
my $date=sprintf("%04d-%02d-%02d_%02d_%02d", 1900+$t[5],$t[4]+1,$t[3],$t[2],$t[1]); |
| 48 |
|
| 49 |
system "tar -czf ../${date}_launchpad_upload.tgz *"; |
| 50 |
chdir ".."; |
| 51 |
|
| 52 |
foreach my $t (keys %files) |
| 53 |
{ |
| 54 |
unlink glob("upl/$t/*"); |
| 55 |
rmdir "upl/$t"; |
| 56 |
} |
| 57 |
rmdir "upl" |