diff options
author | Josip Rodin <joy> | 2001-07-24 03:37:30 +0000 |
---|---|---|
committer | Josip Rodin <joy> | 2001-07-24 03:37:30 +0000 |
commit | f0471506a0cdd26912b37df1fe7937784aac0d05 (patch) | |
tree | 4043882ff20191fe8bf60c26031666e39f5afe83 /check_trans.pl | |
parent | 7a0cea094f5774152db01827f63cc8abe4a96da8 (diff) |
a bunch of irrelevant nitpicking
CVS version numbers
check_trans.pl: 1.27 -> 1.28
Diffstat (limited to 'check_trans.pl')
-rwxr-xr-x | check_trans.pl | 223 |
1 files changed, 109 insertions, 114 deletions
diff --git a/check_trans.pl b/check_trans.pl index 0f9ec222d3a..b9a31aa9513 100755 --- a/check_trans.pl +++ b/check_trans.pl @@ -1,100 +1,86 @@ #!/usr/bin/perl -w -# This is GPL'ed code, copyright 1998 Paolo Molaro <lupus@debian.org>. +# This is a little utility designed to keep track of translations +# in the Debian web site CVS repository. + +# For information about translation revisions please see +# http://www.debian.org/devel/website/uptodate + +# This is GPL'ed code, copyright 1998 Paolo Molaro <lupus@debian.org> # Copyright 2000 Martin Quinson <mquinson@ens-lyon.fr> -# Little utility to keep track of translations in the debian CVS repo. -# Invoke as check_trans.pl [-v] [-d] [-l] [-q] [-M] [-s subtree] [language] -# from the webwml directory, eg: -# $ check_trans.pl -v italian +# Invocation: +# check_trans.pl [-vqdlM] [-p pattern] [-s subtree] +# [-m email] [-g] [-n N] +# [language] + +# It needs to be run from the top level webwml directory. +# If you don't specify a language on the command line, the language name +# will be loaded from a file called language.conf, if such a file exists. + +# For example: +# $ check_trans.pl -v italian # You may also check only some subtrees as in: -# $ check_trans.pl -s devel italian - -# Option: -# -v enable verbose mode -# -Q enable quiet mode -# -d output diff -# -l output log messages -# -q don't whine about missing files -# -p include only files matching <value> -# -s check only subtree <value> -# -M display differences for all 'Makefile's - -# Options usefull when sending mails: -# -g debuG -# -m makes mails to translation maintainers -# PLEASE READ CARFULLY THE TEXT BELOW ABOUT MAKING MAILS !! -# (if -m is given, it must be followed by the default recipient) -# (it should be the list used for organisation) -# (I sent it to debian-l10n-french@lists.debian.org) -# -n send mails of priority upper or equal to <value> -# (ie, <value> must be 1 (monthly), 2 (weekly) or 3 (daily) +# $ check_trans.pl -s devel italian + +# Options: +# -v enable verbose mode +# -q just don't whine about missing files +# -Q enable really quiet mode +# -d output CVS diffs +# -l output CVS log messages +# -p <pattern> include only files matching <pattern>, +# default is *.html|*.wml +# -s <subtree> check only that subtree +# -M display differences for all 'Makefile's + +# Options useful when sending mails: +# -m <email> sends mails to translation maintainers +# PLEASE CAREFULLY READ THE BELOW TEXT ABOUT MAKING MAILS! +# <email> is the default recipient +# (it should be the list used for organisation, +# e.g. debian-l10n-french@lists.debian.org) +# -g debuG +# -n <1|2|3> send mails of priority upper or equal to +# 1 (monthly), 2 (weekly) or 3 (daily) # Making Mails # If you want to, this script send mails to the maintainer of the mails. -# BEWARE, SOME PEOPLE DO NOT LIKE TO RECEIVE AUTOMATIC MAILS !! -# PREQUESITE: -# o To do so, you need two databases: -# - one to see which translator maintains which file +# BEWARE, SOME PEOPLE DO NOT LIKE TO RECEIVE AUTOMATIC MAILS! + +# PREREQUISITES: +# o You will need two databases: +# - one in which to see which translator maintains which file # it must be named "./$langto/international/$langto/current_status.pl" -# with $langto equal to "french", "italian" or so -# Please refer to "webwml/french/international/french/current_status.pl" -# to have an example -# - one to get info about translators and the frequency at which they want to get -# mails. It must be named "webwml/$langto/international/$langto/translator.db.pl" -# Please refer to the french one for more info -# o You must also have the perl module called "MIME::Lite", which is not yet packaged. -# You can download it from your favorite CPAN... +# (where $langto equals "french", "italian" or so) +# See webwml/french/international/french/current_status.pl" for example. +# - one in which to get info about translators and the frequency at +# which they want to get mails. It must be named +# webwml/$langto/international/$langto/translator.db.pl +# 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 + # USAGE: -# - If you give the "-g" option, all mails are sent to the "default addressee" -# (ie, the one given as value to the -m option), without respect to their -# normal addressee. It is usefull if you want to run it for your own, -# and for debugging. -# - With out it, it sends real mails to real addresses. -# BE SURE THE ADDRESSEES REALLY WANT TO GET THESE MAILS - -# If you do not specify a language on the command line, it will try to load -# one from a file called language.conf, if such a file exists. That file -# should contain one line naming the language subdirectory to check. - -# Translators need to embed in the files they translate a comment -# in its own line with the revision of the file they translated such as: -# #use wml::debian::translation-check translation="revision" -# (Old form <!--translation revision--> works too.) -# The revision can be obtained from the CVS/Entries files or from -# the command "cvs status filename". - -# TODO: -# get the revisions from $lang/intl/$lang so diffing works -# need to quote dirnames? -# use a file to bind a file to a translator? +# - If you give the "-g" option, all mails are sent to the default addressee +# (i.e. the one given as value to the -m option), without respect to their +# normal addressee. It is useful if you want to run it for yourself, +# and for debugging. +# Without that option, it sends real mails to real addresses. +# MAKE SURE THE ADDRESSEES REALLY WANT TO GET THESE MAILS use Getopt::Std; use IO::Handle; # Well, uncommenting the next line implies to define the opt_blah with 'our' -# in perl 5.6, which is not a valid keyword in older version. So, we can't -# use strict for now, what is, IMHO, a bad think. -# Let's wait for perl 5.6 in testing.. +# in perl 5.6, which is not a valid keyword in older version. So, we can't +# use strict for now, which is, IMHO, a bad thing. -- Martin +# Let's wait for perl 5.6 to be in wider use #use strict; -# options -$opt_d = 0; -$opt_s = ''; -$opt_p = undef; -$opt_l = 0; -$opt_g = 0; -$opt_m = undef; -$opt_n = 5; -$opt_M = 0; -# our $opt_v; -# our $opt_q; -# our $opt_Q; - -# languages -my $defaultlanguage; -my $from; -my $to; -my $langto; +# TODO: +# get the revisions from $lang/intl/$lang so diffing works +# need to quote dirnames? +# use a file to bind a file to a translator? # from db my $translations_status; @@ -104,8 +90,7 @@ my %translators;# the real hash # misc my @en; #english files my $showlog; # boolean -#$maintainer = "debian-www\@lists.debian.org"; #adress of maintainer of this script -my $maintainer = "mquinson\@ens-lyon.fr"; #adress of maintainer of this script +my $maintainer = "mquinson\@ens-lyon.fr"; # the default e-mail to bitch at :-) my $ignorables = "/sitemap.wml " ."/MailingLists/subscribe.wml " ."/MailingLists/unsubscribe.wml " @@ -113,6 +98,19 @@ my $ignorables = "/sitemap.wml " ."/international/l10n/scripts/l10nheader.wml " ; # $ignorables must end with a space! +# options +$opt_d = 0; +$opt_s = ''; +$opt_p = undef; +$opt_l = 0; +$opt_g = 0; +$opt_m = undef; +$opt_n = 5; # an invalid default +$opt_M = 0; +$opt_v = 0; +$opt_q = 0; +$opt_Q = 0; + unless (getopts('vgdqQm:s:p:ln:M')) { open SELF, "<$0" or die "Unable to display help: $!\n"; @@ -121,37 +119,34 @@ unless (getopts('vgdqQm:s:p:ln:M')) print, next if /^$/; last HELP if (/^use/); s/^# ?//; + next if /^!/; print; } exit; } +die "you can't have both verbose and quiet, doh!\n" if (($opt_v) && ($opt_Q)); warn "Checking subtree $opt_s only\n" if (($opt_v) && ($opt_s)); # include only files matching $filename my $filename = $opt_p || '(\.wml$)|(\.html$)'; -# get configuration +# language configuration +my $defaultlanguage = 'italian'; if (open CONF, "<language.conf") { $defaultlanguage = <CONF>; chomp $defaultlanguage; close CONF; } -else -{ - $defaultlanguage = 'italian'; -} -$from = 'english'; -$to = shift || $defaultlanguage; +my $from = 'english'; +my $to = shift || $defaultlanguage; +$to =~ s%/$%%; # Remove slash from the end -#$langfrom=$from; +#my $langfrom = $from; -# Remove slash from end -$to =~ s%/$%%; - -$langto=$to; +my $langto = $to; $langto =~ s,^([^/]*).*$,$1,; if (-e "./$langto/international/$langto/current_status.pl" && -e "./$langto/international/$langto/translator.db.pl") { @@ -230,8 +225,6 @@ sub verify_send { && ($opt_n <= $translators{$name}{$part}); # check if the frequency is ok } - - sub get_translators_from_db { my $id=shift; my $res=''; @@ -258,16 +251,16 @@ sub init_mails { From => "Script watching translation state <$maintainer>", To => ($opt_g ? $opt_m : $translators{$name}{"email"}), Subject => ($name eq "list" ? - "Translations for the debian web site unmaintained" : - "Translations for the debian web site maintained by $name" + "Translations for the Debian web site unmaintained" : + "Translations for the Debian web site maintained by $name" ), Type => 'multipart/mixed'); my $str= "Hello,\n". - "This is a automatically generated mail sent to you\n". + "This is an automatically generated mail sent to you\n". "because you are the official translator of some pages\n". - "in $langto of the Debian web site.\n". + "to $langto of the Debian web site.\n". "\n". - "I send you what I think you want. (ie what is in my DB).\n". + "I sent you what I think you want. (i.e. what is in my DB).\n". " That is to say:\n"; foreach my $n (qw(summary logs diff file)) { $str.=" ".$n.": ". @@ -301,11 +294,11 @@ sub init_mails { " - diff between the version you translated and the current one\n". " - log between the version you translated and the current one\n". " - the file you translated (to avoid to download it before to work)\n". - " - your email adress\n". - " - the compression level (none,gzip or bzip2), even if I'll ignore it\n". + " - your email address\n". + " - the compression level (none, gzip or bzip2), even if I'll ignore it\n". " because this feature is not implemented yet ;)\n". "\n". - "For more informations, contact your team coordinator, or\n". + "For more information, contact your team coordinator, or\n". "the maintainer of this script ($maintainer).\n". "\n". "Thanks, and sorry for the annoyance.\n"; @@ -344,13 +337,13 @@ sub send_mails { if ($translators{$name}{"send"}) { print "send mail to $name\n"; if (($name =~ m,mquinson,) || ($opt_g && $opt_m eq $maintainer)) { - print "Well, detourned to $maintainer\n"; + print "Well, detoured to $maintainer\n"; $translators{$name}{"msg"}->send; } # $translators{$name}{"msg"}->print_header; $translators{$name}{"msg"}->send; } else { - print "don't send mail to $name : nothing to say to him\n"; + print "didn't send mail to $name: nothing to say to him\n"; } } } @@ -358,7 +351,7 @@ sub send_mails { sub load_entries { my ($name) = shift; my (%data); - warn "Loading $name\n" if ($opt_v && !$opt_q); + warn "Loading $name\n" if $opt_v; open(F, $name) || die $!; while(<F>) { next unless m,^/,; @@ -395,6 +388,7 @@ sub add_part { $translators{$name}{"send"}=1; } } + sub add_sub_part { my $name = shift; my $part = shift; @@ -417,15 +411,16 @@ sub add_sub_part { sub check_file { my ($name, $revision, $translator) = @_; my ($oldr, $oldname, $original); - warn "Checking $name english revision $revision\n" if $opt_v; + warn "Checking $name, English revision $revision\n" if $opt_v; unless (-r $name) { - unless ($opt_q) { - ($ename = $name) =~ s/$to//; - if (index($ignorables, "$ename ") < 0) { - print "Missing $name version $revision\n" - unless $opt_Q; + ($iname = $name) =~ s/$to//; + if (index($ignorables, "$iname ") < 0) { + unless (($opt_q) || ($opt_Q)) { + print "Missing $name version $revision\n"; add_part("list","missing","Missing $name version $revision\n"); } + } else { + warn "Ignored $name\n" if $opt_v; } return; } |