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.000000000 +0100 +++ podebconf-report-po 2005-01-27 11:34:31.000000000 +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 <package>"; -my $BODY = "Hi, +my $BODY = "# From: <from> +# Subject: <subject> + +Hi, you are noted as the last translator of the debconf translation for <package>. 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 <package> are outdated"; +my $BODY_BUGREPORT = "# From: <from> +# Subject: <subject> + +Package: <package> +Version: N/A +Severity: wishlist +Tags: l10n + +The following debconf translations for the package <package> are outdated: +<filelist> + +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>/$PACKAGE_ARG/ig; +$BODY =~ s/<subject>/$SUBJECT/ig; $BODY =~ s/<package>/$PACKAGE_ARG/ig; $BODY =~ s/<from>/$FROM_ARG/ig; $BODY =~ s/<deadline>\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 .= $tmp; my $file_encoded = encode_base64(&ReadFile($PODIR . "/" . $file)); my %mail = ( - from => $FROM_ARG, - to => $recipient, - subject => $SUBJECT + From => $FROM_ARG, + To => $recipient, + Subject => $SUBJECT ); - $mail{cc} = $recipient_team if $recipient_team ne ""; + $mail{"Reply-To"} = $BTS_ARG if $BTS_ARG ne ""; + + foreach my $h (keys(%headers)) { + $mail{$h} = $headers{$h}; + } + + if ($recipient_team ne "") { + if (exists($headers{Cc})) { + $mail{Cc} = $mail{Cc} . ", " . $recipient_team; + } else { + $mail{Cc} = $recipient_team; + } + } $mail{smtp} = $SMTP if ($SMTP ne ''); my $boundary = "=" . time() . "="; @@ -248,7 +303,39 @@ } if (!$FORCE_ARG) { - print "Ready to send the emails, are you sure? [y/N] "; + if (not $REPORT_ARG) { + print "Ready to send the emails, are you sure? [y/N] "; + } else { + + $BODY =~ s/<filelist>\n/$filelist/g; + + if ($TEMPLATE_ARG eq "") { + $BODY = &OpenEditor($EDITOR) if not $DEFAULT_ARG; + } else { + $BODY = &ReadFile($TEMPLATE_ARG); + } + + $BODY =~ s/<filelist>\n/$filelist/g; + %headers = &ParseHeaders($BODY); + $BODY = encode_qp(&RemoveHeaders($BODY)); + + my %mail = ( + From => $FROM_ARG, + To => "[EMAIL PROTECTED]", + Subject => $SUBJECT + ); + + foreach my $h (keys(%headers)) { + $mail{$h} = $headers{$h}; + } + + $mail{smtp} = $SMTP if ($SMTP ne ''); + $mail{body} = $BODY; + + print "Ready to send the bug report against the package $PACKAGE_ARG, are you sure? [y/N] "; + @mails = (\%mail); + } + my $line = <>; chop $line; exit(0) if ($line ne "Y" and $line ne "y"); @@ -263,7 +350,6 @@ ############################################################################### -## Handle invalid arguments sub OpenEditor { my $editor = shift; @@ -287,6 +373,28 @@ return $body; } +sub ParseHeaders +{ + my $body = shift; + my %headers = (); + + foreach my $line (split("\n",$body)) { + if ($line =~ /^# ([^:]*): (.*)/) { + $headers{$1} = $2; + } + } + return %headers; +} + +sub RemoveHeaders +{ + my $body = shift; + foreach my $line (split("\n",$body)) { + $body =~ s/$line\n//g if $line =~ /^# ([^:]*): (.*)/; + } + return $body; +} + sub ReadFile { my $file = shift; @@ -324,10 +432,13 @@ --default don't open the editor and use the template as is --package=PACKAGE specify the name of the package --from=MAINTAINER specify the name and the email address of the sender + --bts=BUGNUMBER specify the debian bug number to set as reply-to --deadline=DEADLINE specify the deadline for receiving the updated translations --languageteam send the email also to the Language Team as carbon copy --podir=PODIR specify where are located the po files + --report send a bug report against the package with a report + of the outdated debconf translations _EOF_ exit 0;
signature.asc
Description: Questa parte del messaggio =?ISO-8859-1?Q?=E8?= firmata