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

Ca marche pas :( [Re: ddts-rev version 0.7]



Martin Quinson wrote:
> 
>    Comme ca, j'espere
>    que Nico sera content, et qu'il l'utilisera.
> 
>    De toute facon, Nico, si tu trouves encore que c'est pas pratique,
>    je le remodifierais ;)

Promis, je ne le fais pas exprès ;)

$ cat rapport.ddts | ./ddts-rev parse
Not enough arguments for mkdir at ./ddts-rev line 102, near ""Can't
create $home. Is the script configured ?\n";"
Execution of ./ddts-rev aborted due to compilation errors.

(c'était déjà dans la 0.6, et j'ai pas eu le temps de regarder le code
en détail mais tu trouveras plus facilement que moi).

Maintenant, je rajoute :)

$perldoc ./ddts-rev &> beurk
=> Voir le fichier beurk en attachement.

NB : j'utilise perl5.004 (potato)
-- 
Nicolas SABOURET
LIMSI-CNRS, BP133, 91403 Orsay, France
http://www.limsi.fr/Individu/nico
/usr/bin/pod2man: bad option in paragraph 17 of ./ddts-rev: ``-d'' should be [CB]<-d>
/usr/bin/pod2man: bad option in paragraph 18 of ./ddts-rev: ``-e'' should be [CB]<-e>
/usr/bin/pod2man: bad option in paragraph 20 of ./ddts-rev: ``-e'' should be [CB]<-e>
/usr/bin/pod2man: bad option in paragraph 20 of ./ddts-rev: ``-e'' should be [CB]<-e>
/usr/bin/pod2man: bad option in paragraph 20 of ./ddts-rev: ``-e'' should be [CB]<-e>
/usr/bin/pod2man: bad option in paragraph 20 of ./ddts-rev: ``-u'' should be [CB]<-u>
/usr/bin/pod2man: bad option in paragraph 22 of ./ddts-rev: ``-e'' should be [CB]<-e>
/usr/bin/pod2man: bad option in paragraph 22 of ./ddts-rev: ``-e'' should be [CB]<-e>



DDTS-REV(1)    User Contributed Perl Documentation    DDTS-REV(1)


       o You're done with the review and want to send your work
       to translators back.    Call the script with the _m_a_i_l
       option. It will make a diff of your version and  the
       translators one. If the two versions are equal, nothing
       will be done. Else, the script will send a mail in mime
       format with three parts:

       - the comments you've put between the COMMENTS lines =item
       - the version resulting of your review    Just in case the
       translator lost it's original work

       - the diff between your version and the translator one.
       =back Then, the script will show you the resulting mail,
       and prompt you if you want to  send it or not. Be carfull
       with sending mails. Please make sure you are really  done
       with the review before. Lastly, the script will save the
       sent mail to _p_k_g_-_n_a_m_e_._m_a_i_l_S_e_n_t to make sure  the mail
       won't be sent several times if you run the script several
       times.

       o clean your workspace    Calling the script with the
       _c_l_e_a_n option removes all temp files like *~ ones, or the
       ones created internally. If _p_k_g_-_n_a_m_e_._t_o_d_o and
       _p_k_g_-_n_a_m_e_._r_e_l_u both  exists, the script will remove the
       first. So, be carfull when using this option...    =back
       =cut
           my $version="0.7";

           if (! -d $home) {
               mkdir $home || die "Can't create $home. Is the
           script configured ?\n"; }

           sub parse_report {
               my $package;
               my $translator;
               my $desc;
               my $trans;
               my $lang;

               # Pass the mail header
               while (<>) {      last if (m,^$,);
               }

               # Read all packages
               while (<>) {      chomp;      #    print "$_";
                # Read the translator name      $translator=$_;
                $_=<>; chomp;      $package=$_;      last if
           $translator eq "";      print "Translator:
           $translator\n" if $debug;      print "Package:
           $package\n" if $debug;      $_=<>;            if
           (m,^Description: (.*)$,) {          $desc="$1\n";
                    while (<>) {           if (m,^ ,) {
                         $desc .= $_;           } else {
                         last;           }          }      }



5/Sep/2001             perl 5.005, patch 03                     1





DDTS-REV(1)    User Contributed Perl Documentation    DDTS-REV(1)


                print "Description: $desc\n" if $debug;
                if (m,^Description-(..)(_..)?: (.*)$,) {
           $lang="$1$2";          $trans="$3\n";          while
           (<>) {           if (m,^ ,) {               $trans .=
           $_;           } else {               last;           }
                    }      }            if (m,^$,) {          if
           ($package eq "") {           my $shortdesc=$desc;
                     $shortdesc =~ s/\n.*//mg;           open
           APT, "apt-cache search '$shortdesc'|";
                     $package = <APT>;           _c_h_o_m_p($package);
                     $package =~ s/^([^ ]*) .*$/$1/;
                     print "I guess '$shortdesc' referes to
           '$package'\n";          }                if ($package
           eq "" ||           $translator eq "" ||
                     $desc eq "" ||           $trans eq "" ||
                     $lang eq "") {               die "Parse
           error: empty line before the package is well
           defined.\n"                 ."Are you sure I'm parsing
           a repport from the ddts ?\n";           }
           if (-e "$home/$package.$todoext") {           warn
           "$home/$package.$todoext overwritten...\n";          }




































5/Sep/2001             perl 5.005, patch 03                     2





DDTS-REV(1)    User Contributed Perl Documentation    DDTS-REV(1)


                       # Outputs the package
                       open PKG, ">$home/$package"
                         || die "Can't open $home/$package\n";
                       open TODO, ">$home/$package.$todoext"
                         || die "Can't open $home/$package.$todoext\n";

                       my $str = "Translator: $translator\n";
                       $str .= "Description:$desc";
                       $str .= "Description-$lang:$trans";

                       print "$str\n" if $debug;
                       print PKG "$str\n";
                       print TODO "--BEGIN COMMENTS [don t change this line]\n"
                         .$mail_dflt
                         ."--END COMMENTS [don t change this line]\n"
                         ."$str\n";

                       close PKG || die "Can't write '$home/$package': $!\n";
                       close TODO || die "Can't write '$home/$package.$todoext': $!\n";

                       # Remove the mailSent
                       if (-e "$home/$package.$sentmailext") {
                           print "removing $package.$sentmailext";
                           unlink "$home/$package.$sentmailext";
                       }

                       # Move revext to revext.old
                       if (-e "$home/$package.$sentmailext") {
                           print "Moving $package.$revext -> $package.$revext.old";
                           system ("mv $package.$revext $package.$revext.old");
                       }

                       # clears the variables
                       $package=$translator=$desc=$trans=$lang = "";
                   }


                   # stop when encountering the signature
                   last if m,^--$,;
                   last if m,^-- $,;
               }
           }

           sub make_mails {
               my $boundary;
               my $BCount=0;

               die "Cannot read the content of $home: $! \n"
                 unless opendir (PKGLIST,$home);

               chdir $home || die "Can't chdir to $home: $!\n";
               foreach (_r_e_a_d_d_i_r(PKGLIST)) {      next if
           /\.$todoext$/;            next if /\.$revext$/;
                next if /\.diff$/;            next if



5/Sep/2001             perl 5.005, patch 03                     3





DDTS-REV(1)    User Contributed Perl Documentation    DDTS-REV(1)


           /\.$newmailext$/;      next if /\.$mailext$/;
                next if /\.$sentmailext$/;      my $pkg = $_;
                      if (-e "$pkg.$revext" && -e "$pkg") {
           if (-e "$pkg.$sentmailext") {           print
           "$pkg.$sentmailext exists. I won't send the same mail
           two times\n";           next;          }
           $boundary="----------=_"._s_c_a_l_a_r(time)."-$$-".$BCount++;
                    # get translator name          open PKG,
           "$pkg" || die "Can't read $pkg\n";          my
           $translator = <PKG>;          _c_h_o_m_p($translator);
                    $translator =~ s/Translator: //;
           close PKG;                # build the mail          my
           $mail = "From: $mail_from\n";          if ($debug) {
                     $mail .= "To: $mail_from\n";          } else
           {           $mail .= "To: $_\n";          }
           $mail .= "Subject: ";          $mail .= sprintf
           $mail_title,$pkg;          $mail .= "\nMime-Version:
           1.0\n"             ."Content-Type: multipart/mixed;
           boundary=\"$boundary\"\n"             ."Content-
           Disposition: inline\n"             ."Content-Transfer-
           Encoding: $mail_enc\n"             ."User-Agent: ddts
           review helper\n\n\n"             ."--$boundary\n"
                       ."Content-Type: text/plain;
           charset=$mail_charset\n"             ."Content-
           Disposition: inline\n"             ."Content-Transfer-
           Encoding: $mail_enc\n\n";          open REV,
           "$pkg.$revext";          while (<REV>) {
                     last if /^--BEGIN COMMENTS \[don t change
           this line\]$/;          }          while (<REV>) {
                     last if /^--END COMMENTS \[don t change this
           line\]$/;           $mail .= $_;          }
           $mail .= "\n\n"                ."--$boundary\n"
           ."Content-Type: text/plain; charset=$mail_charset\n"
                      ."Content-Disposition: attachment;
           filename=\"$pkg.new\"\n\n";

                    # Prepare the diff and add the new version to
           the mail          open TMP,">$pkg.new";          while
           (<REV>) {           print TMP $_;           $mail .=
           $_;          }          close REV;          close TMP;
                          $mail .= "\n\n"
           ."--$boundary\n"            ."Content-Type:
           text/plain; charset=$mail_charset\n"
           ."Content-Disposition: attachment;
           filename=\"$pkg.diff\"\n\n";          if (!system
           "diff -u $pkg $pkg.new > $pkg.diff") {           #
           empty diff           unlink "$pkg.diff";
                     unlink "$pkg.new";          } else {
                     # puts the diff           open DIFF,
           "$pkg.diff";           while (<DIFF>) {
           $mail .= "$_";           }           close DIFF;
                                # Ends the mime stuff
                     $mail .= "--$boundary--\n\n";




5/Sep/2001             perl 5.005, patch 03                     4





DDTS-REV(1)    User Contributed Perl Documentation    DDTS-REV(1)


                           print "Here is the mail:\n$mail\nDo you want to send it [y/N] ?\n";
                           $_=<>;
                           if (m/^[yY]/) {
                               open SENT, ">$pkg.$sentmailext";
                               print SENT $mail;
                               close SENT
                                 || die "Can't save the mail to $pkg.$sentmailext: $!\n";

                               open SENDMAIL,"| /usr/lib/sendmail -t -oi -oem";
                               print SENDMAIL $mail;
                               close SENDMAIL
                                 || die "Can't run sendmail: $!\n";

                               print "Mail sent\n";
                           } else {
                               print "As you want. Nothing sent\n";
                           }
                       }
                       unlink "$pkg.new" unless $debug>1;
                       unlink "$pkg.diff" unless $debug>1;
                   }
               }
           }

           sub clean {
               die "Cannot read the content of $home: $! \n"
                 unless opendir (PKGLIST,$home);
               foreach (_r_e_a_d_d_i_r(PKGLIST)) {      if (/~$/ ||
                    /\.new$/ ||          /\.diff$/) {
                     print "Remove $_\n";           unlink
           "$home/$_";          }      if (! /\./) {          my
           $pkg = $_;          if (-e "$home/$pkg.$revext" && -e
           "$home/$pkg.$todoext") {           print "Remove
           $pkg.$todoext\n";           unlink
           "$home/$pkg.$todoext";          }      }
               } }

           my $cmd=shift; if ($cmd eq "parse") {
               _p_a_r_s_e___r_e_p_o_r_t_(_); } elsif ($cmd eq "mail") {
               _m_a_k_e___m_a_i_l_s_(_); } elsif ($cmd eq "clean") {
               _c_l_e_a_n_(_); } else {
               my $me=$0;
               $me=~s,^.*?/([^/]*)$,$1,;
               die "Usage $me [parse|mail|clean]\n"
                 ."  parse: read a ddts from the standard input
           and change the files in $home\n"
                 ."  mail:  create the pkg.newmail files which
           you should edit and send\n"
                 ."  clean: remove : \n"
                 ."           - *~\n"
                 ."           - the $todoext when a $revext
           exists\n"
                 ."           - all tmp files (.diff, .new)\n"
                 ."\n$me version $version\n"; }



5/Sep/2001             perl 5.005, patch 03                     5





DDTS-REV(1)    User Contributed Perl Documentation    DDTS-REV(1)


AAAAUUUUTTTTHHHHOOOORRRR
       Martin Quinson <Martin.Quinson@ens-lyon.fr>

       =cut





















































5/Sep/2001             perl 5.005, patch 03                     6



Reply to: