[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ddts-script v. 0.1.9



Bonjour,

changelog:
version 0.1.9
  - bug fix:
    - add: permissions when creating $tr_dir (for compliance with perl < 5.6
      thanks to Nicolas Sabouret for reminding me this patch from Denis
      Barbier
    - add: creates $bug_dir and $rev_dir if they don't exist
    - add: list fixed files
    - add: say if nothing has been sent
    - add: remove `*~' files with `clean' command
    - add: `From: ' line option, with `$mail_from'
      thanks to Nicolas Sabouret for reporting these bugs
      
Désolé de n'avoir pas vu passé la rustine de Denis, donc maintenant ça
devrait marcher sur une patate sans modification.

Il faut ajouter une ligne à votre .ddts-script :
$mail_from = $mail_addr;                # mail address for ddts answers

Vous pouvez mettre une autre valeur bien sûr si vous en avez besoin,
cela devrait régler le petit problème de Nico

J'ai encore a gérer les rapports de bogue indiquant un changement dans
la version anglaise (c'est une nouvelle manière de faire pour Grisu qui
lui évite de dupliquer son code).

La rustine est attachée, le script complet toujours là :
http://perso.wanadoo.fr/nico.bertol/ddts/ddts-script.txt

Nicolas
-- 
--- ddts-script_0.1.8.txt	Tue Nov 27 20:08:13 2001
+++ ddts-script_0.1.9.txt	Wed Nov 28 14:41:03 2001
@@ -19,6 +19,7 @@
     $ok_e,
     
     $mail_addr,
+    $mail_from,
     $mail_self,
     $mail_enc,
     $mail_charset,
@@ -33,14 +34,14 @@
 my $void = $ENV{HOME}."/.ddts-script";		# config file
 die "You must define \$tr_dir, \$rev_dir, \$bug_dir, \$temp_dir, \$comment, \$todo_e,"
    ."\$tr_e, \$rev_e, \$bug_e, \$fix_e, \$sent_e, \$old_e, \$ok_r, \$debug, \$mail_addr,"
-   ."\$mail_self, \$mail_enc, \$mail_charset, \$editor Perl variables in"
+   ."\$mail_from, \$mail_self, \$mail_enc, \$mail_charset, \$editor Perl variables in"
    ."\$HOME/.ddts-script" unless -r $void;
 scalar eval `cat $void`;			# get the variables
 
 # Test if variables are defined
 foreach (qw(tr_dir rev_dir bug_dir temp_dir
 	    todo_e tr_e rev_e bug_e fix_e sent_e old_e ok_e
-	    mail_addr mail_self mail_enc mail_charset
+	    mail_addr mail_from mail_self mail_enc mail_charset
             comment debug editor)) {
 	eval "\$void=\$$_";
 	die "\$$_ not defined in \$HOME/.ddts-script" unless ($void ne "");
@@ -208,12 +209,14 @@
 
 =cut
 
-my $version = "0.1.8";
+my $version = "0.1.9";
 
 # Test if configuration as been made
-if (! -d $tr_dir) {
-	mkdir $tr_dir || die "Is the script configured?\n"
-			    ."Can't create `$tr_dir': $!";
+foreach ($tr_dir, $bug_dir, $rev_dir) {
+	if (! -d $_) {
+		mkdir ($_, 755) || die "Is the script configured?\n"
+				      ."Can't create `$_': $!";
+	}
 }
 
 # Move file
@@ -957,7 +960,8 @@
 		my $file = $_;
 		my $c    = substr($comment, 1);
 
-		$debug>3 && print "    file:         $file\n";
+		$debug   && $debug<3 && print "fixed:        $file\n";
+		$debug>3 &&             print "    fixed:        $file\n";
 
 		my @data = split("\n", &get_all("$bug_dir/$file.$fix_e"));
 		   @data = grep (/^[^($comment)]/,             @data);
@@ -1020,7 +1024,8 @@
 
 # Send mails
 sub mail {
-	my $BCount = 0;
+	my $BCount   = 0;
+	my $nb_sent = 0;
 	
 	$debug>2 && print "mail\n";
 
@@ -1061,12 +1066,14 @@
 			      ."Content-Transfer-Encoding: $mail_enc\n"
 			      ."Content-Disposition: attachment; filename=\"$file\"\n\n";
 		print SENDMAIL join("\n", @bugs)."\n" unless (@bugs == 0);
-		print SENDMAIL $header
+		print SENDMAIL "From: $mail_from\n"
+			      .$header
 			      ."Description: ".&get_description("$tr_dir/$file.$tr_e")
 			      ."Description-$language\: ".&uncomment(&get_translation("$tr_dir/$file.$tr_e"), "# |$comment")
 			      ."\n"
 			      ."--$boundary--\n\n";
 		close SENDMAIL						|| die "Can't run sendmail: $!";
+		$nb_sent++;
 
 		&move_file ("$tr_dir/$file.$tr_e", "$tr_dir/$file.$sent_e");
 
@@ -1110,10 +1117,12 @@
 			      ."Content-Type: text/plain; charset=$mail_charset\n"
 			      ."Content-Transfer-Encoding: $mail_enc\n"
 			      ."Content-Disposition: attachment; filename=\"$file\"\n\n"
+			      ."From: $mail_from\n"
 			      .&make_review($file)
 			      ."\n\n"
 			      ."--$boundary--\n\n";
 		close SENDMAIL						|| die "Can't run sendmail: $!";
+		$nb_sent++;
 
 		if (&uncomment(&get_translation("$rev_dir/$file"),        "# |$comment") eq
 		    &uncomment(&get_translation("$rev_dir/$file.$rev_e"), "# |$comment")    ) {
@@ -1128,6 +1137,14 @@
 			$debug>2 &&             print "    sent:         $file\n";
 		}
 	}
+
+	if ($nb_sent) {
+		$debug==2 && print "sent:         #$nb_sent\n";
+		$debug>3  && print "    sent:         #$nb_sent\n";
+	} else {
+		$debug   && $debug<3 && print "nothing to send\n";
+		$debug>2 &&             print "    nothing to send\n";
+	}
 }
 
 # Clean obsolete files
@@ -1141,6 +1158,7 @@
 		next if /^\./;
 
 		&remove_file("$tr_dir/$_") if /\.$old_e$/;
+		&remove_file("$tr_dir/$_") if /\~$/;
 
 		s/\..*$//;
 		if (-e "$tr_dir/$_.$todo_e") {

Reply to: