]> git.donarmstrong.com Git - debbugs.git/blobdiff - scripts/process
handle src: package maintainers properly in submit@
[debbugs.git] / scripts / process
index 11c692ed6524cd731c118f36f5731b03b4ae7720..12e667b9916596345d412c0558cd954ccb5d0f1c 100755 (executable)
@@ -13,11 +13,11 @@ use IO::File;
 
 use MIME::Parser;
 use Debbugs::MIME qw(decode_rfc1522 create_mime_message getmailbody);
-use Debbugs::Mail qw(send_mail_message encode_headers);
-use Debbugs::Packages qw(getpkgsrc);
+use Debbugs::Mail qw(send_mail_message encode_headers get_addresses);
+use Debbugs::Packages qw(getpkgsrc binarytosource);
 use Debbugs::User qw(read_usertags write_usertags);
-use Debbugs::Common qw(:lock get_hashname);
-use Debbugs::Status qw(writebug isstrongseverity lockreadbugmerge lockreadbug read_bug :versions);
+use Debbugs::Common qw(:lock get_hashname package_maintainer);
+use Debbugs::Status qw(writebug isstrongseverity lockreadbugmerge lockreadbug read_bug splitpackages :versions);
 
 use Debbugs::CGI qw(html_escape bug_url);
 
@@ -634,7 +634,7 @@ my $newsubject= $subject;  $newsubject =~ s/^$gBug#$ref:*\s*//;
 
 my $xcchdr= $header{ 'x-debbugs-cc' } || '';
 if ($xcchdr =~ m/\S/) {
-    push(@resentccs,$xcchdr);
+    push(@resentccs,get_addresses($xcchdr));
     $resentccexplain.= fill_template('mail/xdebbugscc',
                                     {xcchdr => $xcchdr},
                                    );
@@ -1049,57 +1049,36 @@ sub fill_template{
 }
 
 
+# this shole routine is *bad*; will be changed to use
+# Debbugs::Recipients and stuff therin in short order.
 sub checkmaintainers {
     return if $maintainerschecked++;
     return if !length($data->{package});
-    my %maintainerof;
-    open(MAINT,"$gMaintainerFile") || die die "maintainers open: $!";
-    while (<MAINT>) {
-       m/^\n$/ && next;
-       m/^\s*$/ && next;
-        m/^(\S+)\s+(\S.*\S)\s*\n$/ || die "maintainers bogus \`$_'";
-        $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
-       # use the package which is normalized to lower case; we do this because we lc the pseudo headers.
-        $maintainerof{$a}= $2;
-    }
-    close(MAINT);
-    open(MAINT,"$gMaintainerFileOverride") || die die "maintainers.override open: $!";
-    while (<MAINT>) {
-       m/^\n$/ && next;
-       m/^\s*$/ && next;
-        m/^(\S+)\s+(\S.*\S)\s*\n$/ || die "maintainers.override bogus \`$_'";
-        $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
-       # use the package which is normalized to lower case; we do this because we lc the pseudo headers.
-        $maintainerof{$a}= $2;
-    }
-    close(MAINT);
-    my %pkgsrc;
-    open(SOURCES,"$gPackageSource") || die "pkgsrc open: $!";
-    while (<SOURCES>) {
-        next unless m/^(\S+)\s+\S+\s+(\S.*\S)\s*$/;
-       ($a,$b)=($1,$2);
-       $a =~ y/A-Z/a-z/;
-       $pkgsrc{$a} = $b;
-    }
-    close(SOURCES);
+
     my $anymaintfound=0; my $anymaintnotfound=0;
-    for my $p (split(m/[ \t?,():]+/,$data->{package})) {
+    for my $p (splitpackages($data->{package})) {
         $p =~ y/A-Z/a-z/;
        $p =~ /([a-z0-9.+-]+)/;
        $p = $1;
        next unless defined $p;
        if (defined $gSubscriptionDomain) {
-           if (defined($pkgsrc{$p})) {
-               push @addsrcaddrs, "$pkgsrc{$p}\@$gSubscriptionDomain";
+           my @source = binarytosource($p);
+           if (@source) {
+               push @addsrcaddrs,
+                   map {"$_\@$gSubscriptionDomain"} @source;
            } else {
                push @addsrcaddrs, "$p\@$gSubscriptionDomain";
            }
        }
-        if (defined($maintainerof{$p})) {
-           print DEBUG "maintainer add >$p|$maintainerof{$p}<\n";
-            my $addmaint= $maintainerof{$p};
-            push(@maintaddrs,$addmaint) unless
-                $addmaint eq $replyto || grep($_ eq $addmaint, @maintaddrs);
+       # this is utter hackery until we switch to Debbugs::Recipients
+       my @maints = package_maintainer(binary => $p);
+        if (@maints) {
+           print DEBUG "maintainer add >$p|".join(',',@maints)."<\n";
+           my %temp;
+           @temp{@maintaddrs} = @maintaddrs;
+            push(@maintaddrs,
+                grep {$_ ne $replyto and
+                          not exists $temp{$_}} @maints);
             $anymaintfound++;
         } else {
            print DEBUG "maintainer none >$p<\n";