Bonjour,

journal des modifications :
version 0.4.4
  - bug fix:
    - change: write `Description: ' correctly when original description is
      changed
      thanks to Philippe Trbich for reporting this bug
    - add: die if line not processed when parsing attached files
      thanks to Lorenzo Cappelletti for reporting this bug

La rustine est attachée, le script complet n'a pas bougé :
http://perso.wanadoo.fr/ddts/ddts-script.txt

Bonne année à tous


Nicolas
-- 
--- ddts-script_0.4.3.txt       Sun Dec 30 21:05:20 2001
+++ ddts-script_0.4.4.txt       Tue Jan  1 23:19:29 2002
@@ -268,7 +268,7 @@
 
 =cut
 
-my $version = "0.4.3";
+my $version = "0.4.4";
 
 # Test if configuration as been made
 foreach ($tr_dir, $bug_dir, $rev_dir, $temp_dir) {
@@ -597,10 +597,15 @@
 
        open UU, "uudecode $uu_file -o - |"     || die "Can't run uudecode: $!";
        while (<UU>) {
+               my $processed;                                  # flag, defined 
if line processed
+
+               next if (defined && /^From: /);                         # skip 
ddts command
+               next if (defined && /^BTSCLOSE: /);                     # skip 
ddts command
 
                if (defined && /^# Package\(?s\)?: (\S+)/) {
 # DDTS ---------------------------------- \(s\) -
                        chomp ($package = $1);
+                       $processed++;
 
                        $debug   && $debug<3 && print "package:      
$package\n";
                        $debug>2             && print "    package:      
$package\n";
@@ -609,6 +614,7 @@
 
                if (defined && /^# changed translation from /) {
                        chomp($reviewer_addr = $');
+                       $processed++;
 
                        $debug   && $debug<3 && print "reviewer:     
$reviewer_addr\n";
                        $debug>2             && print "    reviewer:     
$reviewer_addr\n";
@@ -617,6 +623,7 @@
 
                if (defined && /^# Translator: /) {
                        chomp($translator_addr = $');
+                       $processed++;
 
                        $debug   && $debug<3 && print "translator:   
$translator_addr\n";
                        $debug>2             && print "    translator:   
$translator_addr\n";
@@ -625,6 +632,7 @@
 
                if (defined && /^# Bug-Nr.: (\d+)/) {
                        chomp ($bug_number = $1);
+                       $processed++;
 
                        $debug==2 && print "bug number:   $bug_number\n";
                        $debug>4  && print "    bug_number:   $bug_number\n";
@@ -637,6 +645,7 @@
                                last unless /^ /;
                                $description .= " $'";
                        }
+                       $processed++;
 
                        $debug>4 && print "    description:\n"
                                         .join("\n", map($_ = "        $_", 
split("\n", $description)))."\n";
@@ -652,6 +661,7 @@
                                last unless /^#  /;
                                $db_translation .= " $'";
                        }
+                       $processed++;
 
                        $debug>4 && print "    translation in database\n"
                                         ."        langage:  $langage\n"
@@ -666,6 +676,7 @@
                                last unless /^#  /;
                                $old_description .= " $'";
                        }
+                       $processed++;
 
                        $debug>4 && print "    old description\n";
                        $debug>4 && print join("\n", map($_ = "        $_", 
split("\n", $old_description)))."\n";
@@ -678,12 +689,22 @@
                                $translation .= $1 if (defined $1);
                                $translation .= " $'";
                        }
+                       $processed++;
 
                        $debug>4 && print "    translation\n"
                                         ."        langage:  $langage\n"
                                         .join("\n", map($_ = "        $_", 
split("\n", $translation)))."\n";
                }
 
+               next if (defined && /^# /);                             # skip 
comment
+
+               if (defined && (! /^$/) && (! $processed)) {            # die 
if line not empty and not processed
+                       $debug>2 && print "ERROR unknown line:\n"
+                                        ."$_\n";
+                                   die   "ERROR unknown line:\n"
+                                        ."$_\n";
+               }
+               
                next unless (defined $description);
 
                # Save the description
@@ -940,6 +961,8 @@
                        shift @diff;
                }
                $description .= "Description: ".join("\n", @diff)."\n";
+       } else {
+               $description  = "Description: $description";
        }
 
        # Re-format review for superdiff
@@ -987,12 +1010,7 @@
                 ."# ddts id:  $message_id\n"
                 ."# bug nb:   $bug_number $l\n"
                 ."# reviewer: $reviewer\n";
-       my @description = split("\n", $description);
-       if ($description[0] =~ /# -/) {
-               print PKG "# -Description: $'\n";
-               shift @description;
-       }
-       print PKG "Description: $description";
+       print PKG $description;
 
        # Gather differences
        for ($i = 0; $i<@diff; $i++) {

Répondre à