ddts-script 0.3
Bonjour,
Le journal des changements :
version 0.3
- add: `stats' command and corresponding manpage
- add: `clean' command in manpage
- add: options in manpage
- remove: alpha debug output
- remove: `known bug' in manpage
- bug fix:
- change: typo in manpage
- change: use right extensions in warning/error message in `parse_bug'
- change: warning messages in `parse_bug'
C'est promis, demain et après-demain il n'y aura pas de nouvelle
version.
La commande « stats » fonctionne très bien avec les relectures, pour le
reste je n'ai bien sûr pas pu tester.
La rustine est attachée, le script complet toujours là :
http://perso.wanadoo.fr/nico.bertol/ddts/ddts-script.txt
Nicolas
--
--- ddts-script_0.2.3.txt Sun Dec 2 08:30:00 2001
+++ ddts-script_0.3.txt Mon Dec 3 16:17:10 2001
@@ -55,7 +55,8 @@
=head1 SYNOPSIS
-ddts-script [parse|fix|mail|clean]
+ddts-script [-q] [--quiet] [-v] [--verbose n] [-s] [-n] [--mail-self yes|no]
+ parse|fix|mail|clean|stats
=head1 DESCRIPTION
@@ -63,6 +64,8 @@
ddts, splitting them into individual package files, sending reviews and
patching buggy translations.
+=head1 COMMANDS
+
Here is the basical process if you use this tool:
=over 4
@@ -70,7 +73,7 @@
=item - Receiving mail from the ddts
Pass the mail you received from the ddts to the standard input of this script,
-providing the I<parse> option.
+providing the I<parse> command.
If it finds descriptions to translate, it creates a F<package.todo> file for
each of them in your F<tr_dir> directory, diffing it with the preceeding you
@@ -127,13 +130,57 @@
=item - Sending files back to the ddts
-Run the script proving the I<mail> option.
+Run the script providing the I<mail> command.
It sends descriptions from F<package.tr> and F<package.rev> files back to the
ddts renaming them into F<package.sent> and closing bugs if necessary.
+=item - Cleaning directories for obsolete files
+
+Run the script providing the I<clean> command.
+
+It removes unnecessary files in ddts directories but temporary one as this
+directory should be a system wide temporary directory cleaned via system
+scheduled threads.
+
+=item - Getting statistics about my work
+
+Run the script providing the I<stats> command.
+
+It prints figures based on file counts, it may not be accurate if directory
+cleaning has not been made before.
+
+=back
+
+=head1 OPTIONS
+
+Verbosity level:
+
+=over 4
+
+=item I<-q>, quiet mode
+
+=item I<-v>, verbose, start at level 1, add more for more verbosity (see below)
+
+=item I<--verbose n>, set verbosity level to I<n> (see below)
+
+=back
+
+Cc mails to one-self:
+
+=over 4
+
+=item I<-s>, send mails also to oneself
+
+=item I<-n>, don't send mails to oneself
+
+=item I<--mail-self yes|no>, send mails to oneself if `yes', don't if `no'
+
=back
+In each option group, options are not compatible, last found option overrides
+previous one.
+
=head1 CONFIG FILE
This is your F<~/.ddts-script> file, it MUST contain the following variables:
@@ -151,7 +198,7 @@
=item I<$temp_dir>, directory for temporary files
-= back
+=back
file extensions (must be different from each other):
@@ -219,14 +266,9 @@
level 5 and 9 are really verbose, so direct the output to a file.
-=head1 KNOWN BUG
-
-The test for configuration doesn't work with potato, make sure your have
-configured the script and comment it, or send me a patch.
-
=cut
-my $version = "0.2.3";
+my $version = "0.3";
# Test if configuration as been made
foreach ($tr_dir, $bug_dir, $rev_dir, $temp_dir) {
@@ -655,8 +697,7 @@
if ($uu_file eq "$temp_dir/ddts-new-$$") {
&parse_translation($package, $langage, $description, $translation, $db_translation, $message_id);
} elsif ($uu_file eq "$temp_dir/ddts-newreview-$$") {
- &parse_review($package, $langage, $translator_addr, $description, &uncomment($translation, "## "), $message_id);
-# DDTS ------------------------------------------------------------------------ $translation ------------------
+ &parse_review($package, $langage, $translator_addr, $description, $translation, $message_id);
} elsif ($uu_file eq "$temp_dir/ddts-reviewed-$$") {
&parse_reviewed($package);
} else {
@@ -717,7 +758,7 @@
my $langage = shift;
my $translator = shift;
my $description = shift;
- my $translation = &uncomment(shift, "## ");
+ my $translation = shift;
my $message_id = shift;
$debug>2 && print "parse_review\n";
@@ -757,14 +798,9 @@
$todo = &get_header("$rev_dir/$package")
."Description: $description";
my @diff = split ("\n", &superdiff($original, $reviewed));
- print "0".$diff[0]."\n";
if ($diff[0] =~ /^$comment-/) {
- print "0".$diff[0]."\n";
- print "1".$diff[1]."\n";
$diff[0] =~ s/^$comment-//;
$diff[1] =~ s/^$comment\+//;
- print "0".$diff[0]."\n";
- print "1".$diff[1]."\n";
$todo .= "$comment-Description-$langage\: ".$diff[0]."\n"
."$comment+Description-$langage\: ".$diff[1]."\n";
shift @diff;
@@ -800,15 +836,15 @@
$debug>2 && print " WARNING: collision detected, $package.$fix_e exists,\n"
." $package skiped\n";
warn "WARNING: collision detected, $package.$fix_e exists,\n"
- ."try to remove it and rename $package.$bug_e.$old_e into $package.$bug_e.\n"
+ ."try to rename it into $package.$bug_e.\n"
."$package skiped.\n";
return;
}
if (-e "$tr_dir/$package.$tr_e") {
$debug>2 && print " WARNING: collision detected, $package.$tr_e exists,\n"
." $package skiped\n";
- warn "WARNING: collision detected, $package.$fix_e exists,\n"
- ."try to remove it and rename $package.$bug_e.$old_e into $package.$bug_e.\n"
+ warn "WARNING: collision detected, $package.$tr_e exists,\n"
+ ."try to remove it and rename $package.$fix_e.$old_e into $package.$bug_e.\n"
."$package skiped\n.";
return;
}
@@ -817,7 +853,7 @@
$debug>2 && print " ERROR: collision detected, $package.$sent_e exists,\n"
." and has a DIFFERENT translation,\n"
." $package skiped\n";
- warn "ERROR: collision detected, $package.$fix_e exists,\n"
+ warn "ERROR: collision detected, $package.$sent_e exists,\n"
." and has a DIFFERENT translation,\n"
." $package skiped\n";
return;
@@ -1274,6 +1310,86 @@
$debug = $d;
}
+# Print statistics
+sub stats {
+ my $totr_c = 0;
+ my $tr_c = 0;
+ my $senttr_c = 0;
+ my $oktr_c = 0;
+ my $bug_c = 0;
+ my $fix_c = 0;
+ my $torev_c = 0;
+ my $rev_c = 0;
+ my $sentrev_c = 0;
+ my $okrev_c = 0;
+ my $oldrev_c = 0;
+ my $allrev_c = 0;
+
+ $debug>2 && print "stats\n";
+
+ foreach (&ls_dir($tr_dir)) {
+ next if /^\./;
+ $totr_c++ if /\.$todo_e$/;
+ $tr_c++ if /\.$tr_e$/;
+ $senttr_c++ if /\.$sent_e$/;
+ $oktr_c++ if /\.$ok_e$/;
+ }
+ foreach (&ls_dir($bug_dir)) {
+ next if /^\./;
+ $bug_c++ if /\.$bug_e$/;
+ $fix_c++ if /\.$fix_e$/;
+ }
+ foreach (&ls_dir($rev_dir)) {
+ next if /^\./;
+ $torev_c++ if /\.$todo_e$/;
+ $rev_c++ if /\.$rev_e$/;
+ $sentrev_c++ if /\.$sent_e$/;
+ $okrev_c++ if /\.$ok_e$/;
+ $oldrev_c++ if /\.$old_e$/;
+ $allrev_c++;
+ }
+ my $myrev_c = $allrev_c-(2*$torev_c)-(2*$sentrev_c)-$okrev_c-$oldrev_c;
+
+ my $sumtr = $tr_c + $senttr_c + $oktr_c;
+ my $sumbug = $bug_c + $fix_c;
+ my $sumrev = $rev_c + $sentrev_c + $okrev_c;
+
+ $rev_c = $myrev_c - $rev_c;
+ $myrev_c -= 2 * $rev_c;
+
+ my $l = 0;
+ $l = $_>$l?$_:$l foreach ($sumtr, $sumbug, $sumrev);
+ $l = length $l;
+ if ($sumtr) {
+ print "===== translations\n";
+ printf " to do: %${l}d\n", $totr_c;
+ printf " to send: %${l}d\n", $tr_c;
+ printf " sent: %${l}d\n", $senttr_c;
+ printf " accepted: %${l}d\n", $oktr_c;
+ print " "."-"x$l."\n";
+ printf "translated: %${l}d\n", $sumtr;
+ }
+
+ if ($sumbug) {
+ print "===== bug reports\n";
+ printf " reports: %${l}d\n", $bug_c;
+ printf " fixed: %${l}d\n", $fix_c;
+ print " "."-"x$l."\n";
+ printf " bugged: %${l}d\n", $sumbug;
+ }
+
+ if ($sumrev) {
+ print "===== reviews\n";
+ printf " to do: %${l}d\n", $torev_c;
+ printf " to send: %${l}d\n", $rev_c;
+ printf " sent: %${l}d\n", $sentrev_c;
+ printf " reviewed: %${l}d\n", $myrev_c;
+ printf " accepted: %${l}d\n", $okrev_c;
+ print " "."-"x$l."\n";
+ printf " reviewed: %${l}d\n", $sumrev;
+ }
+}
+
# Parse command line
my $v = 0;
my $d;
@@ -1324,17 +1440,20 @@
&fix;
} elsif ($_ eq "clean") {
&clean;
+} elsif ($_ eq "stats") {
+ &stats;
} else {
my $me = $0; # get command name with path
$me =~ s/.*\/([^\/]*)$/$1/; # keep script name
die "Usage: $me [-q] [--quiet] [-v] [--verbose n] [-s] [-n]\n"
- ." [--mail-self yes|no] parse|mail|fix|clean\n"
+ ." [--mail-self yes|no] parse|mail|fix|clean|stats\n"
."\n"
."commands:\n"
." parse: extract the package descriptions from a ddts mail\n"
." mail: send mails back to the ddts\n"
." fix: create a fixed description from bugs\n"
." clean: remove obsolete files\n"
+ ." stats: print statistics\n"
."\n"
."options:\n"
." -q, --quiet quiet mode\n"
Reply to: