| 6 |
# For information about translation revisions please see |
# For information about translation revisions please see |
| 7 |
# http://www.debian.org/devel/website/uptodate |
# http://www.debian.org/devel/website/uptodate |
| 8 |
|
|
| 9 |
# This is GPL'ed code, copyright 1998 Paolo Molaro <lupus@debian.org> |
# This is GPL'ed code. |
| 10 |
# Copyright 2000 Martin Quinson <mquinson@ens-lyon.fr> |
# Copyright 1998 Paolo Molaro <lupus@debian.org>. |
| 11 |
|
# Copyright 2000,2001 Martin Quinson <mquinson@ens-lyon.fr>. |
| 12 |
|
|
| 13 |
# Invocation: |
# Invocation: |
| 14 |
# check_trans.pl [-vqdlM] [-C dir] [-p pattern] [-s subtree] |
# check_trans.pl [-vqdlM] [-C dir] [-p pattern] [-s subtree] |
| 15 |
# [-m email] [-g] [-n N] [-t outputtype] |
# [-m email -n N] [-g] [-t outputtype] |
| 16 |
# [language] |
# [language] |
| 17 |
|
|
| 18 |
# It needs to be run from the top level webwml directory. |
# It needs to be run from the top level webwml directory. |
| 31 |
# -C <dir> go to <dir> directory before running this script |
# -C <dir> go to <dir> directory before running this script |
| 32 |
# -d output CVS diffs |
# -d output CVS diffs |
| 33 |
# -l output CVS log messages |
# -l output CVS log messages |
| 34 |
|
# -T output translated diffs |
| 35 |
# -p <pattern> include only files matching <pattern>, |
# -p <pattern> include only files matching <pattern>, |
| 36 |
# default is *.html|*.wml |
# default is *.html|*.wml |
| 37 |
# -s <subtree> check only that subtree |
# -s <subtree> check only that subtree |
| 38 |
# -t <type> choose output type (default is `text') |
# -t <type> choose output type (default is `text') |
| 39 |
# -M display differences for all 'Makefile's |
# -M display differences for all 'Makefile's |
| 53 |
# BEWARE, SOME PEOPLE DO NOT LIKE TO RECEIVE AUTOMATIC MAILS! |
# BEWARE, SOME PEOPLE DO NOT LIKE TO RECEIVE AUTOMATIC MAILS! |
| 54 |
|
|
| 55 |
# PREREQUISITES: |
# PREREQUISITES: |
| 56 |
# o You will need two databases: |
# You will need two databases: |
| 57 |
# - one in which to see which translator maintains which file |
# - one in which to see which translator maintains which file |
| 58 |
# it must be named "./$langto/international/$langto/current_status.pl" |
# it must be named "./$langto/international/$langto/current_status.pl" |
| 59 |
# (where $langto equals "french", "italian" or so) |
# (where $langto equals "french", "italian" or so) |
| 62 |
# which they want to get mails. It must be named |
# which they want to get mails. It must be named |
| 63 |
# webwml/$langto/international/$langto/translator.db.pl |
# webwml/$langto/international/$langto/translator.db.pl |
| 64 |
# Please refer to the French one for more info. |
# Please refer to the French one for more info. |
|
# o You must also have the perl module called "MIME::Lite", |
|
|
# install the package libmime-lite-perl or get it from CPAN |
|
| 65 |
|
|
| 66 |
# USAGE: |
# USAGE: |
| 67 |
# - If you give the "-g" option, all mails are sent to the default addressee |
# If you give the "-g" option, all mails are sent to the default addressee |
| 68 |
# (i.e. the one given as value to the -m option), without respect to their |
# (i.e. the one given as value to the -m option), without respect to their |
| 69 |
# normal addressee. It is useful if you want to run it for yourself, |
# normal addressee. It is useful if you want to run it for yourself, |
| 70 |
# and for debugging. |
# and for debugging. |
| 71 |
# Without that option, it sends real mails to real addresses. |
# Without that option, it sends real mails to real addresses. |
| 72 |
# MAKE SURE THE ADDRESSEES REALLY WANT TO GET THESE MAILS |
# MAKE SURE THE ADDRESSEES REALLY WANT TO GET THESE MAILS |
| 73 |
|
|
| 74 |
|
use strict; |
| 75 |
use Getopt::Std; |
use Getopt::Std; |
| 76 |
use IO::Handle; |
use IO::Handle; |
| 77 |
use Date::Parse; |
use Date::Parse; |
| 78 |
|
|
| 79 |
# Well, uncommenting the next line implies to define the opt_blah with 'our' |
# These modules reside under webwml/Perl |
| 80 |
# in perl 5.6, which is not a valid keyword in older version. So, we can't |
use lib ($0 =~ m|(.*)/|, $1 or ".") ."/Perl"; |
| 81 |
# use strict for now, which is, IMHO, a bad thing. -- Martin |
use Local::Cvsinfo; |
| 82 |
# Let's wait for perl 5.6 to be in wider use |
use Local::WmlDiffTrans; |
| 83 |
#use strict; |
use Webwml::TransCheck; |
| 84 |
|
use Webwml::TransIgnore; |
| 85 |
|
|
| 86 |
# TODO: |
# TODO: |
| 87 |
# get the revisions from $lang/intl/$lang so diffing works |
# get the revisions from $lang/intl/$lang so diffing works |
| 88 |
# need to quote dirnames? |
# need to quote dirnames? |
| 89 |
# use a file to bind a file to a translator? |
# use a file to bind a file to a translator? |
| 90 |
|
|
| 91 |
# from db |
# global db variables |
| 92 |
my $translations_status; |
my $translations_status; |
| 93 |
my $translators;# the ref resulting of require |
my $translators;# the ref resulting of require |
| 94 |
my %translators;# the real hash |
my %translators;# the real hash |
| 95 |
|
|
| 96 |
# misc |
# misc hardcoded things |
| 97 |
my @en; #english files |
my $maintainer = "mquinson\@ens-lyon.fr"; # the default e-mail at which to bitch :-) |
|
my $showlog; # boolean |
|
|
my $maintainer = "mquinson\@ens-lyon.fr"; # the default e-mail to bitch at :-) |
|
|
my $ignorables = " " |
|
|
."/sitemap.wml " |
|
|
."/MailingLists/subscribe.wml " |
|
|
."/MailingLists/unsubscribe.wml " |
|
|
."/international/l10n/data/countries.wml " |
|
|
."/international/l10n/scripts/l10nheader.wml " |
|
|
; # $ignorables must begin and end with a space! |
|
| 98 |
|
|
| 99 |
# options |
# options (note: with perl 5.6, this could change to our()) |
| 100 |
$opt_d = 0; |
use vars qw($opt_C $opt_M $opt_Q $opt_d $opt_g $opt_l $opt_m $opt_n $opt_p $opt_q $opt_s $opt_t $opt_T $opt_v); |
|
$opt_s = ''; |
|
|
$opt_p = undef; |
|
|
$opt_l = 0; |
|
|
$opt_g = 0; |
|
|
$opt_m = undef; |
|
| 101 |
$opt_n = 5; # an invalid default |
$opt_n = 5; # an invalid default |
| 102 |
$opt_M = 0; |
$opt_s = ''; |
| 103 |
$opt_C = '.'; |
$opt_C = '.'; |
| 104 |
$opt_t = 'text'; |
$opt_t = 'text'; |
|
$opt_v = 0; |
|
|
$opt_q = 0; |
|
|
$opt_Q = 0; |
|
| 105 |
|
|
| 106 |
unless (getopts('vgdqQC:m:s:t:p:ln:M')) |
unless (getopts('vgdqQC:m:s:Tt:p:ln:M')) |
| 107 |
{ |
{ |
| 108 |
open SELF, "<$0" or die "Unable to display help: $!\n"; |
open SELF, "<$0" or die "Unable to display help: $!\n"; |
| 109 |
HELP: while (<SELF>) |
HELP: while (<SELF>) |
| 116 |
} |
} |
| 117 |
exit; |
exit; |
| 118 |
} |
} |
| 119 |
|
|
| 120 |
die "you can't have both verbose and quiet, doh!\n" if (($opt_v) && ($opt_Q)); |
die "you can't have both verbose and quiet, doh!\n" if (($opt_v) && ($opt_Q)); |
| 121 |
|
|
| 122 |
warn "Checking subtree $opt_s only\n" if (($opt_v) && ($opt_s)); |
warn "Checking subtree $opt_s only\n" if (($opt_v) && ($opt_s)); |
| 127 |
# Go to desired directory |
# Go to desired directory |
| 128 |
chdir($opt_C) || die "Cannot go to $opt_C\n"; |
chdir($opt_C) || die "Cannot go to $opt_C\n"; |
| 129 |
|
|
| 130 |
|
my $cvs = Local::Cvsinfo->new(); |
| 131 |
|
$cvs->options( |
| 132 |
|
recursive => 1, |
| 133 |
|
matchfile => [ $filename ], |
| 134 |
|
skipdir => [ "template" ], |
| 135 |
|
); |
| 136 |
|
# This object is used to retrieve information when original is |
| 137 |
|
# not English |
| 138 |
|
my $altcvs = $cvs->new(); |
| 139 |
|
|
| 140 |
|
# Global .transignore |
| 141 |
|
my $globtrans = Webwml::TransIgnore->new("."); |
| 142 |
|
|
| 143 |
# language configuration |
# language configuration |
| 144 |
my $defaultlanguage = 'italian'; |
my $defaultlanguage = 'italian'; |
| 145 |
if (open CONF, "<language.conf") |
if (open CONF, "<language.conf") |
| 153 |
my $to = shift || $defaultlanguage; |
my $to = shift || $defaultlanguage; |
| 154 |
$to =~ s%/$%%; # Remove slash from the end |
$to =~ s%/$%%; # Remove slash from the end |
| 155 |
|
|
|
#my $langfrom = $from; |
|
|
|
|
| 156 |
my $langto = $to; |
my $langto = $to; |
| 157 |
$langto =~ s,^([^/]*).*$,$1,; |
$langto =~ s,^([^/]*).*$,$1,; |
| 158 |
if (-e "./$langto/international/$langto/current_status.pl" && |
if (-e "./$langto/international/$langto/current_status.pl" && |
| 179 |
$from = "$from/$opt_s"; |
$from = "$from/$opt_s"; |
| 180 |
$to = "$to/$opt_s"; |
$to = "$to/$opt_s"; |
| 181 |
|
|
|
@en= split(/\n/, `find $from -name Entries -print`); |
|
|
|
|
|
$showlog = $opt_l; |
|
|
|
|
| 182 |
init_mails(); |
init_mails(); |
| 183 |
|
|
| 184 |
print "\$translations = {\n" if $opt_t eq 'perl'; |
print "\$translations = {\n" if $opt_t eq 'perl'; |
| 185 |
|
|
| 186 |
foreach (@en) { |
$cvs->readinfo($from); |
| 187 |
next if $_ =~ "template/debian"; |
foreach my $path (@{$cvs->dirs()}) { |
| 188 |
|
my $tpath = $path; |
| 189 |
|
$tpath =~ s/^$from/$to/o; |
| 190 |
|
my $transignore = Webwml::TransIgnore->new($tpath); |
| 191 |
|
next unless $transignore->found(); |
| 192 |
|
warn "Loading $tpath/.transignore\n" if $opt_v; |
| 193 |
|
foreach (@{$transignore->local()}) { |
| 194 |
|
s/^$to/$from/o; |
| 195 |
|
$cvs->removefile($_); |
| 196 |
|
} |
| 197 |
|
} |
| 198 |
|
|
| 199 |
|
foreach (sort @{$cvs->files()}) { |
| 200 |
my ($path, $tpath); |
my ($path, $tpath); |
| 201 |
$path = $_; |
$path = $_; |
|
$path =~ s,CVS/Entries$,,; |
|
| 202 |
$tpath = $path; |
$tpath = $path; |
| 203 |
$tpath =~ s/^$from/$to/o; |
$tpath =~ s/^$from/$to/o; |
| 204 |
my $d = load_entries($_); |
check_file($tpath, |
| 205 |
my $ignore = load_ignorelist($tpath); |
$cvs->revision($path), |
| 206 |
foreach my $f (keys %$d) { |
str2time($cvs->date($path)), |
| 207 |
check_file("${tpath}$f", |
get_translators_from_db($tpath)); |
|
$d->{$f}->{'rev'}, |
|
|
$d->{$f}->{'mtime'}, |
|
|
get_translators_from_db("$tpath$f")) |
|
|
unless $$ignore{"${tpath}$f"}; |
|
|
} |
|
| 208 |
} |
} |
| 209 |
|
|
| 210 |
print "}; 1;\n" if $opt_t eq 'perl'; |
print "}; 1;\n" if $opt_t eq 'perl'; |
| 211 |
|
|
| 212 |
send_mails(); |
send_mails(); |
| 213 |
|
|
| 214 |
if ($opt_M) |
if ($opt_M) { |
| 215 |
{ |
foreach my $makefile (split(/\n/, `find $from -name Makefile -print`)) { |
|
my @makefile= split(/\n/, `find $from -name Makefile -print`); |
|
|
foreach my $makefile (@makefile) { |
|
| 216 |
my $destination = $makefile; |
my $destination = $makefile; |
| 217 |
$destination =~ s/^$from/$to/o; |
$destination =~ s/^$from/$to/o; |
| 218 |
if (-e $destination) { |
if (-e $destination) { |
| 271 |
my $str= "Hello,\n". |
my $str= "Hello,\n". |
| 272 |
"This is an automatically generated mail sent to you\n". |
"This is an automatically generated mail sent to you\n". |
| 273 |
"because you are the official translator of some pages\n". |
"because you are the official translator of some pages\n". |
| 274 |
"to $langto of the Debian web site.\n". |
"in ".ucfirst($langto)." of the Debian web site.\n". |
| 275 |
"\n". |
"\n". |
| 276 |
"I sent you what I think you want. (i.e. what is in my DB).\n". |
"I sent you what I think you want. (i.e. what is in my DB).\n". |
| 277 |
" That is to say:\n"; |
" That is to say:\n"; |
| 278 |
foreach my $n (qw(summary logs diff file)) { |
foreach my $n (qw(summary logs diff tdiff file)) { |
| 279 |
$str.=" ".$n.": ". |
$str.=" ".$n.": ". |
| 280 |
($translators{$name}{$n} != 0 ? |
($translators{$name}{$n} != 0 ? |
| 281 |
($translators{$name}{$n} != 1 ? |
($translators{$name}{$n} != 1 ? |
| 306 |
" - The list of the work to do in a summarized form\n". |
" - The list of the work to do in a summarized form\n". |
| 307 |
" - diff between the version you translated and the current one\n". |
" - diff between the version you translated and the current one\n". |
| 308 |
" - log between the version you translated and the current one\n". |
" - log between the version you translated and the current one\n". |
| 309 |
" - the file you translated (to avoid to download it before to work)\n". |
" - the file you translated (so that you don't have to download it manually)\n". |
| 310 |
" - your email address\n". |
" - your email address\n". |
| 311 |
" - the compression level (none, gzip or bzip2), even if I'll ignore it\n". |
" - the compression level (none, gzip or bzip2), even if I'll ignore it\n". |
| 312 |
" because this feature is not implemented yet ;)\n". |
" because this feature is not implemented yet ;)\n". |
| 337 |
Filename => 'Missing_summary', |
Filename => 'Missing_summary', |
| 338 |
Data => $translators{$name}{"part_missing"}) |
Data => $translators{$name}{"part_missing"}) |
| 339 |
if defined($translators{$name}{"part_missing"}); |
if defined($translators{$name}{"part_missing"}); |
| 340 |
foreach my $part (qw (file logs diff)) { |
foreach my $part (qw (file logs diff tdiff)) { |
| 341 |
if (defined($translators{$name}{"part_$part"})) { |
if (defined($translators{$name}{"part_$part"})) { |
| 342 |
foreach my $file (sort keys %{$translators{$name}{"part_$part"}}) { |
foreach my $file (sort keys %{$translators{$name}{"part_$part"}}) { |
| 343 |
$translators{$name}{"msg"}->attach( |
$translators{$name}{"msg"}->attach( |
| 350 |
if ($translators{$name}{"send"}) { |
if ($translators{$name}{"send"}) { |
| 351 |
print "send mail to $name\n"; |
print "send mail to $name\n"; |
| 352 |
if (($name =~ m,mquinson,) || ($opt_g && $opt_m eq $maintainer)) { |
if (($name =~ m,mquinson,) || ($opt_g && $opt_m eq $maintainer)) { |
| 353 |
print "Well, detoured to $maintainer\n"; |
print "Well, detourned to $maintainer\n"; |
| 354 |
$translators{$name}{"msg"}->send; |
$translators{$name}{"msg"}->send; |
| 355 |
} |
} |
| 356 |
# $translators{$name}{"msg"}->print_header; |
# $translators{$name}{"msg"}->print_header; |
| 358 |
} else { |
} else { |
| 359 |
print "didn't send mail to $name: nothing to say to him\n"; |
print "didn't send mail to $name: nothing to say to him\n"; |
| 360 |
} |
} |
| 361 |
} |
} |
|
} |
|
|
|
|
|
sub load_entries { |
|
|
my ($list) = shift; |
|
|
my $data = {}; |
|
|
my ($name, $rev, $date); |
|
|
warn "Loading $list\n" if $opt_v; |
|
|
open(F, $list) || die $!; |
|
|
while(<F>) { |
|
|
next unless m,^/,; |
|
|
if (($name, $rev, $date) = (m,^/([^/]+)/([^/]+)/([^/]+)/,)) { |
|
|
if ($name =~ /$filename/o) { |
|
|
$data->{$name} = { |
|
|
rev => $rev, |
|
|
mtime => str2time($date), |
|
|
}; |
|
|
} |
|
|
} |
|
|
} |
|
|
close (F); |
|
|
return $data; |
|
|
} |
|
|
|
|
|
sub load_ignorelist { |
|
|
my ($dir) = shift; |
|
|
my (%data); |
|
|
open(F, "${dir}.transignore") || return \%data; |
|
|
warn "Loading ${dir}.transignore\n" if $opt_v; |
|
|
while(<F>) { |
|
|
chomp; |
|
|
$data{"$dir$_"} = 1; |
|
|
} |
|
|
close (F); |
|
|
return \%data; |
|
| 362 |
} |
} |
| 363 |
|
|
| 364 |
sub add_part { |
sub add_part { |
| 377 |
my $name = shift; |
my $name = shift; |
| 378 |
my $part = shift; |
my $part = shift; |
| 379 |
my $subpart=shift; |
my $subpart=shift; |
| 380 |
my $cmd = shift; |
my $txt = shift; |
| 381 |
$name =~ s,<.*?>,,; |
$name =~ s,<.*?>,,; |
| 382 |
$name =~ s,^ *(.*?) *$,$1,; |
$name =~ s,^ *(.*?) *$,$1,; |
| 383 |
# print "add_sub_part($name)(part=$part)($subpart):"; |
# print "add_sub_part($name)(part=$part)($subpart):$txt" if $opt_v; |
| 384 |
|
STDOUT->flush; |
| 385 |
if (verify_send($name,$part)) { |
if (verify_send($name,$part)) { |
| 386 |
# print "YES\n"; |
# print "YES\n"; |
| 387 |
$translators{$name}{"part_$part"}{$subpart}.=`$cmd`; |
$translators{$name}{"part_$part"}{$subpart}.= "$txt"; |
| 388 |
$translators{$name}{"send"}=1; |
$translators{$name}{"send"}=1; |
|
# return; |
|
| 389 |
} |
} |
| 390 |
# print "no\n"; |
# print "no\n"; |
| 391 |
} |
} |
|
|
|
| 392 |
|
|
| 393 |
|
sub get_diff_txt { |
| 394 |
|
my ($oldr, $revision, $oldname, $name) = @_; |
| 395 |
|
my $cmd; |
| 396 |
|
|
| 397 |
|
# Get old revision file |
| 398 |
|
$cmd = "cvs -z3 update -r $oldr -p $oldname 2>/dev/null"; |
| 399 |
|
# print "!get_diff_txt: cvs -z3 update -r ".$oldr." -p ".$oldname."\n"; |
| 400 |
|
my @old_rev_file_lines = qx($cmd); |
| 401 |
|
|
| 402 |
|
# Get translation file |
| 403 |
|
open (FILE,"$name") || die ("Can't open `$name' for read"); |
| 404 |
|
my @translation_file_lines; |
| 405 |
|
while (<FILE>) { |
| 406 |
|
$translation_file_lines[scalar @translation_file_lines] = $_; |
| 407 |
|
} |
| 408 |
|
close FILE || die ("Can't close $name after reading"); |
| 409 |
|
|
| 410 |
|
# Get diff lines |
| 411 |
|
$cmd = "cvs -z3 diff -u -r$oldr -r $revision $oldname 2>/dev/null"; |
| 412 |
|
# print "get_diff_txt: $cmd: cvs -z3 diff -u -r$oldr -r $revision $oldname\n"; |
| 413 |
|
my @diff_lines = qx($cmd); |
| 414 |
|
|
| 415 |
|
my $txt = Local::WmlDiffTrans::find_trans_parts(\@old_rev_file_lines, |
| 416 |
|
\@translation_file_lines, |
| 417 |
|
\@diff_lines); |
| 418 |
|
|
| 419 |
|
return $txt; |
| 420 |
|
} |
| 421 |
|
|
| 422 |
sub check_file { |
sub check_file { |
| 423 |
my ($name, $revision, $mtime, $translator) = @_; |
my ($name, $revision, $mtime, $translator) = @_; |
| 427 |
$docname =~ s#^$langto/##; |
$docname =~ s#^$langto/##; |
| 428 |
$docname =~ s#\.wml$##; |
$docname =~ s#\.wml$##; |
| 429 |
unless (-r $name) { |
unless (-r $name) { |
| 430 |
my $iname; |
(my $iname = $name) =~ s/^$to\///; |
| 431 |
($iname = $name) =~ s/$to//; |
if (!$globtrans->is_global($iname)) { |
|
if (index($ignorables, " $iname ") < 0) { |
|
| 432 |
unless (($opt_q) || ($opt_Q)) { |
unless (($opt_q) || ($opt_Q)) { |
| 433 |
if ($opt_t eq 'perl') { |
if ($opt_t eq 'perl') { |
| 434 |
print "'$docname' => {\n\t'type' => 'Web',\n"; |
print "'$docname' => {\n\t'type' => 'Web',\n"; |
| 446 |
} |
} |
| 447 |
return; |
return; |
| 448 |
} |
} |
| 449 |
open(F, $name) || die $!; |
my $transcheck = Webwml::TransCheck->new($name); |
| 450 |
while(<F>) { |
$oldr = $transcheck->revision() || 0; |
| 451 |
if (/wml::debian::translation-check/) { |
if (!$oldr && ($name =~ m#$langto/international/$langto#i)) { |
| 452 |
if (/translation="([^"]+)"/) { |
# This document is original, check for |
| 453 |
$oldr = $1; |
# english/international/$langto... |
| 454 |
warn "Found translation for $oldr\n" if $opt_v; |
$name =~ s{^$to}{$from}; |
| 455 |
} |
$transcheck = Webwml::TransCheck->new($name); |
| 456 |
if (/maintainer="([^"]+)"/) { |
$oldr = $transcheck->revision() || 0; |
| 457 |
$translator = $1; |
} |
| 458 |
warn "Translated by $translator\n" if $opt_v; |
$translator = $transcheck->maintainer() || ""; |
| 459 |
} |
$original = $transcheck->original(); |
| 460 |
if (/original="([^"]+)"/) { |
warn "Found translation for $oldr\n" if $opt_v and $oldr; |
| 461 |
$original = $1; |
warn "Translated by $translator\n" if $opt_v and $translator; |
| 462 |
warn "Original is $original\n" if $opt_v; |
warn "Original is $original\n" if $opt_v and $original; |
| 463 |
} |
if ($original) { |
| 464 |
last; |
my ($fromname, $fromdir); |
| 465 |
} |
$fromname = $name; |
| 466 |
# the following old style cases should be removed eventually |
$fromname =~ s{^[^/]+}{$original}; |
| 467 |
if (/translation\s+([.0-9]*)\s*-->/i) { |
$fromdir = $fromname; |
| 468 |
$oldr = $1; |
$fromdir =~ s{/+[^/]+$}{}; |
| 469 |
warn "Found translation for $oldr\n" if $opt_v; |
$altcvs->reset(); |
| 470 |
} |
$altcvs->readinfo($fromdir, matchfile => [$fromname]); |
| 471 |
if (/Translat(.*?): (.*)$/i) { |
$revision = $altcvs->revision($fromname); |
| 472 |
$translator=$2 if ($translator eq ""); |
warn "Original is $original, revision $revision\n" if $opt_v; |
|
warn "Translated by $translator\n" if $opt_v; |
|
|
} |
|
|
last if (($oldr) && ($translator)); |
|
|
} |
|
|
close(F); |
|
|
|
|
|
if ((!$oldr) && ($name =~ /$langto\/international\/$langto/)) { |
|
|
my $ename; |
|
|
($ename = $name) =~ s/$to/$from/; |
|
|
open FE, $ename || die $!; |
|
|
while (<FE>) { |
|
|
if (/wml::debian::translation-check/) { |
|
|
if (/translation="([^"]+)"/) { |
|
|
$oldr = $1; |
|
|
warn "Found translation for $1\n" if $opt_v; |
|
|
} |
|
|
if (/original="([^"]+)"/) { |
|
|
$original = $1; |
|
|
warn "Original is $1\n" if $opt_v; |
|
|
} |
|
|
last; |
|
|
} |
|
|
} |
|
|
close FE; |
|
| 473 |
} |
} |
| 474 |
|
|
| 475 |
$translator =~ s/^\s+//; |
$translator =~ s/^\s+//; |
| 476 |
$translator =~ s/\s+$//; |
$translator =~ s/\s+$//; |
| 477 |
|
|
| 478 |
my $str; |
my $str; |
| 479 |
my $status = 8; |
my $status = 8; |
| 480 |
|
(my $numrev) = $revision =~ m/^1\.(\d+)$/; $numrev ||= "0"; |
| 481 |
|
(my $numoldr) = $oldr =~ m/^1\.(\d+)$/; $numoldr ||= "0"; |
| 482 |
if (!$oldr) { |
if (!$oldr) { |
| 483 |
$oldr = '1.1'; |
$oldr = '1.1'; |
| 484 |
$str = "Unknown status of $name (revision should be $revision)"; |
$str = "Unknown status of $name (revision should be $revision)"; |
| 485 |
} elsif ($oldr eq $revision) { |
} elsif ($oldr eq $revision) { |
| 486 |
$status = 4; |
$status = 4; |
| 487 |
} elsif ($oldr > $revision) { |
} elsif ($numoldr > $numrev) { |
| 488 |
$str = "Broken revision number $oldr for $name, it should be $revision"; |
$str = "Broken revision number $oldr for $name, it should be $revision"; |
| 489 |
} else { |
} else { |
| 490 |
$str = "NeedToUpdate $name from version $oldr to version $revision"; |
$str = "NeedToUpdate $name from version $oldr to version $revision"; |
| 517 |
$translator = "list" if ($translator eq ""); |
$translator = "list" if ($translator eq ""); |
| 518 |
add_part($translator,"summary",$str); |
add_part($translator,"summary",$str); |
| 519 |
add_sub_part($translator,"diff",$name, |
add_sub_part($translator,"diff",$name, |
| 520 |
"cvs -z3 diff -u -r'$oldr' -r '$revision' '$oldname'"); |
join("",qx(cvs -z3 diff -u -r'$oldr' -r $revision $oldname))); |
| 521 |
|
add_sub_part($translator,"tdiff",$name, |
| 522 |
|
get_diff_txt("$oldr","$revision","$oldname","$name")); |
| 523 |
|
|
| 524 |
add_sub_part($translator,"logs",$name, |
add_sub_part($translator,"logs",$name, |
| 525 |
"cvs -z3 log -r'$logoldr:$revision' '$oldname'"); |
join("",qx(cvs -z3 log -r$logoldr:$revision $oldname))); |
| 526 |
add_sub_part($translator,"file",$name, |
add_sub_part($translator,"file",$name, |
| 527 |
"cat $name"); |
join("",qx(cat $name))); |
| 528 |
} |
} |
| 529 |
|
|
| 530 |
if ($opt_d) { |
if ($opt_d) { |
| 531 |
STDOUT->flush; |
STDOUT->flush; |
| 532 |
my $cvsline = "cvs -z3 log -r'$logoldr:$revision' '$oldname'"; |
my $cvsline = "cvs -z3 log -r'$logoldr:$revision' '$oldname'"; |
| 533 |
warn "Running $cvsline\n" if (($opt_v) && ($showlog)); |
warn "Running $cvsline\n" if (($opt_v) && ($opt_l)); |
| 534 |
system($cvsline) if $showlog; |
system($cvsline) if $opt_l; |
| 535 |
STDOUT->flush if $showlog; |
STDOUT->flush if $opt_l; |
| 536 |
$cvsline = "cvs -z3 diff -u -r '$oldr' -r '$revision' '$oldname'"; |
$cvsline = "cvs -z3 diff -u -r '$oldr' -r '$revision' '$oldname'"; |
| 537 |
warn "Running $cvsline\n" if $opt_v; |
warn "Running $cvsline\n" if $opt_v; |
| 538 |
system($cvsline); |
system($cvsline); |
| 539 |
STDOUT->flush; |
STDOUT->flush; |
| 540 |
} |
} |
| 541 |
|
|
| 542 |
|
if ($opt_T) { |
| 543 |
|
print get_diff_txt("$oldr", "$revision", "$oldname", "$name")."\n"; |
| 544 |
|
} |
| 545 |
} |
} |