Bug#288532: po-debconf: Please use DEBEMAIL in podebconf-report-po

2005-01-28 Thread Denis Barbier
On Thu, Jan 27, 2005 at 11:51:45AM +0100, Fabio Tranchitella wrote:
> Il giorno mer, 26-01-2005 alle 22:01 +0100, Denis Barbier ha scritto:
> > Hi Fabio,
> > I would like to fix these bugs.  Will you have time soon to provide a
> > patch?  Otherwise I will work on them.
> 
> Hi Denis,
>   I've prepared the patch two weeks ago but I've missed to send it to
> the bts, sorry. Here there is a patch for #288532, #292472 and #288533.

Ok, I made many cosmetic changes to the code, I believe it is more
structured now.

> Now podebconf-report-po:
>  - uses the DEBMAIL environment variable to override the submitter 
>of the emails (if available).
>  - allows the editing of mail headers (subject, from and whatever else),
>  - allows to set the reply-to field to a bug report in BTS (--bts)
>  - can send a bug against the package to warn the maintainer about
>the outdated translations of the package (--report, very useful 
>in combination with --bts to track the replies of the translators)

I renamed --report into --submit.  The other visible change is that
translation teams are no more Cc'ed but put in the To: field.  The
reason is that I did not know what to do if a Cc header was also present
in mail comments.

Can you please test
  http://people.debian.org/~barbier/tmp/po-debconf_0.8.19_all.deb
?  Here is the podebconf-report-po script.

Denis
#!/usr/bin/perl -w

# podebconf-report-po, Send outdated debconf PO files to the last translator
# Copyright (C) 2004, 2005 Fabio Tranchitella <[EMAIL PROTECTED]>
#  Denis Barbier <[EMAIL PROTECTED]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

## Release information
my $PROGRAM = "podebconf-report-po";
my $VERSION = "0.06";

## Loaded modules, require libmail-sendmail-perl
use strict;
eval q{use Mail::Sendmail;};
die "$PROGRAM: This program requires the libmail-sendmail-perl package.\n".
"$PROGRAM: Aborting!\n" if $@;
use MIME::Base64;
use MIME::QuotedPrint;
use Getopt::Long;
use POSIX;

## Global variables
my $HELP_ARG = 0;
my $VERSION_ARG = 0;
my $VERBOSE_ARG = 0;
my $SUBMIT_ARG = 0;
my $FORCE_ARG = 0;
my $LANGUAGETEAM_ARG = 0;
my $SMTP_ARG = "";
my $TEMPLATE_ARG = "";
my $DEFAULT_ARG = 0;
my $PACKAGE_ARG = "";
my $FROM_ARG = (exists($ENV{'DEBEMAIL'}) ? $ENV{'DEBEMAIL'} : "");
my $BTS_ARG = "";
my $DEADLINE_ARG = "";
my $PODIR_ARG = "";

my @TOPDIRS = qw{../.. .. .};

my $PODIR = '';

my $EDITOR = '/usr/bin/sensible-editor';

## Default templates
my $comments = "# Lines beginning with a number sign are comments, they are 
removed when
# sending mails.  If a line is composed of a # followed by a 'Name: Value'
# pair, it is interpreted as a mail header field and is passed to your mail
# transport agent.  You can edit/add/remove those header fields.";

my $SUBJECT_TRANSLATOR = "Please update debconf PO translation for the package 
";
my $BODY_TRANSLATOR = $comments. "
# 
# From: 
# Subject: 
# Reply-To: 
#
# This mail will be sent to the following people:


Hi,

you are noted as the last translator of the debconf translation for
. The English template has been changed, and now some messages
are marked \"fuzzy\" in your translation or are missing.
I would be grateful if you could take the time and update it.



Thanks,
";

my $SUBJECT_SUBMIT = "debconf PO translations for the package  are 
outdated";
my $BODY_SUBMIT = $comments. "
# 
# From: 
# Subject: 

Package: 
Version: N/A
Severity: wishlist
Tags: l10n

The following debconf translations are outdated:
  

Translators, please send your translations to this bugreport.


Thanks,
";

my $SUBJECT = '';
my $BODY = '';

## Handle options
GetOptions
(
 "help"=> \$HELP_ARG,
 "version" => \$VERSION_ARG,
 "v|verbose"   => \$VERBOSE_ARG,
 "f|force" => \$FORCE_ARG,
 "podir=s" => \$PODIR_ARG,
 "smtp=s"  => \$SMTP_ARG,
 "template=s"  => \$TEMPLATE_ARG,
 "default" => \$DEFAULT_ARG,
 "languageteam"=> \$LANGUAGETEAM_ARG,
 "package=s"   => \$PACKAGE_ARG,
 "deadline=s"  => \$DEADLINE_ARG,
 "from=s"  => \$FROM_ARG,
 "bts=s"   => \$BTS_ARG,
 "submit"  => \$SUBMIT_ARG
 ) or &Help_InvalidOption;

&Help_PrintVersion if $VERSION_ARG;
&Help_PrintHelpif $HELP_ARG;

## Try to find default editor
$EDITOR = $ENV{'EDITOR'} if exists($ENV{'EDITOR'});
$EDITOR = $

Bug#288532: po-debconf: Please use DEBEMAIL in podebconf-report-po

2005-01-27 Thread Fabio Tranchitella
Just another thing, I've missed to change the template for the email and
now it refers only to fuzzy translations. Please modify it to refer also
to missing translations. :)

Thanks a lot for your work,
Fabio

-- 
Fabio Tranchitella http://www.kobold.it
Studio Tranchitella Assoc. Professionale   http://www.tranchitella.it
_
1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564



signature.asc
Description: Questa parte del messaggio =?ISO-8859-1?Q?=E8?= firmata


Bug#288532: po-debconf: Please use DEBEMAIL in podebconf-report-po

2005-01-27 Thread Fabio Tranchitella
Il giorno mer, 26-01-2005 alle 22:01 +0100, Denis Barbier ha scritto:
> Hi Fabio,
> I would like to fix these bugs.  Will you have time soon to provide a
> patch?  Otherwise I will work on them.

Hi Denis,
  I've prepared the patch two weeks ago but I've missed to send it to
the bts, sorry. Here there is a patch for #288532, #292472 and #288533.

Now podebconf-report-po:
 - uses the DEBMAIL environment variable to override the submitter 
   of the emails (if available).
 - allows the editing of mail headers (subject, from and whatever else),
 - allows to set the reply-to field to a bug report in BTS (--bts)
 - can send a bug against the package to warn the maintainer about
   the outdated translations of the package (--report, very useful 
   in combination with --bts to track the replies of the translators)

Please, review the patch and apply all the modifications you think are
needed. And please have a look at the body of the bug report template,
because it is very minimalistic.

Thanks,

-- 
Fabio Tranchitella http://www.kobold.it
Studio Tranchitella Assoc. Professionale   http://www.tranchitella.it
_
1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564

--- /usr/bin/podebconf-report-po	2004-12-29 09:17:13.0 +0100
+++ podebconf-report-po	2005-01-27 11:34:31.0 +0100
@@ -21,7 +21,7 @@
 
 ## Release information
 my $PROGRAM = "podebconf-report-po";
-my $VERSION = "0.04";
+my $VERSION = "0.05";
 
 ## Loaded modules, require libmail-sendmail-perl
 use strict;
@@ -37,6 +37,7 @@
 my $HELP_ARG = 0;
 my $VERSION_ARG = 0;
 my $VERBOSE_ARG = 0;
+my $REPORT_ARG = 0;
 my $FORCE_ARG = 0;
 my $LANGUAGETEAM_ARG = 0;
 my $SMTP_ARG = "";
@@ -44,6 +45,7 @@
 my $DEFAULT_ARG = 0;
 my $PACKAGE_ARG = "";
 my $FROM_ARG = "";
+my $BTS_ARG = "";
 my $DEADLINE_ARG = "";
 my $PODIR_ARG = "";
 
@@ -57,7 +59,10 @@
 my $SMTP = '';
 
 my $SUBJECT = "Please update debconf po translation for the package ";
-my $BODY = "Hi,
+my $BODY = "# From: 
+# Subject: 
+
+Hi,
 
 you are noted as the last translator of the debconf translation for
 . The English template has been changed, and now a couple of
@@ -69,11 +74,27 @@
 Thanks,
 ";
 
+my $SUBJECT_BUGREPORT = "debconf po translations for the package  are outdated";
+my $BODY_BUGREPORT = "# From: 
+# Subject: 
+
+Package: 
+Version: N/A
+Severity: wishlist
+Tags: l10n
+
+The following debconf translations for the package  are outdated:
+
+
+Thanks,
+";
+
 ## Handle options
 GetOptions
 (
  "help"=> \$HELP_ARG,
  "version" => \$VERSION_ARG,
+ "report"  => \$REPORT_ARG,
  "v|verbose"   => \$VERBOSE_ARG,
  "f|force" => \$FORCE_ARG,
  "languageteam"=> \$LANGUAGETEAM_ARG,
@@ -83,6 +104,7 @@
  "package=s"   => \$PACKAGE_ARG,
  "deadline=s"  => \$DEADLINE_ARG,
  "from=s"  => \$FROM_ARG,
+ "bts=s"   => \$BTS_ARG,
  "podir=s" => \$PODIR_ARG
  ) or &Help_InvalidOption;
 
@@ -107,6 +129,9 @@
 	$PODIR = $PODIR_ARG;
 }
 
+## Read the environment variable DEBEMAIL to override the From field of the emails
+$FROM_ARG = $ENV{'DEBEMAIL'} if ($FROM_ARG eq "" and exists($ENV{'DEBEMAIL'}));
+
 ## Try to find the maintainer e-mail address and the package name
 if ($PACKAGE_ARG eq "" or $FROM_ARG eq "") {
 	foreach $i (@CONTROLS) {
@@ -136,8 +161,17 @@
   $DEADLINE_ARG = "\nThe deadline for receiving the updated translation is $DEADLINE_ARG.";
 }
 
+$BTS_ARG = $BTS_ARG . "[EMAIL PROTECTED]" if ($BTS_ARG ne "");
+
 ## Apply the values to the subject and to the body of the message
+
+if ($REPORT_ARG) {
+	$BODY = $BODY_BUGREPORT;
+	$SUBJECT = $SUBJECT_BUGREPORT;
+}
+
 $SUBJECT =~ s//$PACKAGE_ARG/ig;
+$BODY =~ s//$SUBJECT/ig;
 $BODY =~ s//$PACKAGE_ARG/ig;
 $BODY =~ s//$FROM_ARG/ig;
 $BODY =~ s/\n/$DEADLINE_ARG/ig;
@@ -158,7 +192,8 @@
 		next if m/msgid ""\nmsgstr/s;
 		#  Ignore outdated msgids
 		next unless m/^msgid /m;
-		if (m/^#, .*fuzzy/m) {
+		#  Check for fuzzy or missing translations
+		if (m/^#, .*fuzzy/m or m/msgstr ""$/s) {
 			push (@files, $file);
 			last;
 		}
@@ -174,14 +209,18 @@
 	exit(0);
 }
 
-if ($TEMPLATE_ARG eq "") {
-	$BODY = &OpenEditor($EDITOR) if not $DEFAULT_ARG;
-} else {
-	$BODY = &ReadFile($TEMPLATE_ARG);
+my %headers = ();
+if (not $REPORT_ARG) {
+	if ($TEMPLATE_ARG eq "") {
+		$BODY = &OpenEditor($EDITOR) if not $DEFAULT_ARG;
+	} else {
+		$BODY = &ReadFile($TEMPLATE_ARG);
+	}
+	%headers = &ParseHeaders($BODY);
+	$BODY = encode_qp(&RemoveHeaders($BODY));
 }
 
-$BODY = encode_qp($BODY);
-
+my $filelist = "";
 my @mails = ();
 foreach my $file (@files) {
 
@@ -212,18 +251,34 @@
 		warn "Warning: $file:  Unable to determine last translator.\n";
 		next;
 	}
-	print "  $file: $recipient";
-	print ", $recipient_team" if $recipient_team ne "";
-	print "\n";
+
+	my $tmp = "  $file: $recipient";
+	$tmp .= ", $recipient_team" if $recipient_team ne "";
+	$tmp .= "\n";
+	print $tmp;
+
+	$filelist .= 

Bug#288532: po-debconf: Please use DEBEMAIL in podebconf-report-po

2005-01-26 Thread Denis Barbier
On Wed, Jan 05, 2005 at 10:22:09AM +0100, Fabio Tranchitella wrote:
> Il giorno mar, 04-01-2005 alle 23:07 +0100, Denis Barbier ha scritto:
> > Agreed for both suggestions, but this looks more difficult, so I will
> > wait until Fabio provides a patch ;)
> 
> Mm, interesting. Don't worry Denis, I'll provide a patch as
> soon as possibile for all the features required by Christian. :)
> 
> Talk to you later,

Hi Fabio,

I would like to fix these bugs.  Will you have time soon to provide a
patch?  Otherwise I will work on them.

Denis


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]