]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2005-10-06 03:32:13 by ajt]
authorajt <>
Thu, 6 Oct 2005 10:32:13 +0000 (02:32 -0800)
committerajt <>
Thu, 6 Oct 2005 10:32:13 +0000 (02:32 -0800)
add "list" support
remove redundant IO::File
add kthxbye
add blocking support to scripts

scripts/errorlib.in
scripts/process.in
scripts/processall.in
scripts/service.in

index 9143cfe2a502167871ddd87fe0f3bb89cc992b2e..92dd76f1bf49c5ec0bc2f4939a0b7e8f552751b2 100755 (executable)
@@ -1,5 +1,5 @@
 # -*- perl -*-
-# $Id: errorlib.in,v 1.49 2005/07/29 16:53:38 cjwatson Exp $
+# $Id: errorlib.in,v 1.50 2005/10/06 03:32:13 ajt Exp $
 
 use Mail::Address;
 use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522);
@@ -88,6 +88,8 @@ my %fields = (originator => 'submitter',
               owner => 'owner',
               found_versions => 'found-in',
               fixed_versions => 'fixed-in',
+              blocks => 'blocks',
+              blockedby => 'blocked-by',
              );
 
 # Fields which need to be RFC1522-decoded in format versions earlier than 3.
index a215aaab31dc896208672607421816afc3da7b2c..d46cda9eedb963f6714418ddd512365c3a68a5c0 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: process.in,v 1.103 2005/08/19 05:44:28 don Exp $
+# $Id: process.in,v 1.104 2005/10/06 03:32:13 ajt Exp $
 #
 # Usage: process nn
 # Temps:  incoming/Pnn
@@ -8,7 +8,6 @@ use POSIX qw(strftime tzset);
 $ENV{"TZ"} = 'UTC';
 tzset();
 
-use IO::File;
 use MIME::Parser;
 use Debbugs::MIME qw(decode_rfc1522);
 use Debbugs::Mail qw(send_mail_message encode_headers);
@@ -1087,8 +1086,7 @@ sub checkmaintainers {
            print DEBUG "maintainer add >$p|$maintainerof{$p}<\n";
             $addmaint= $maintainerof{$p};
             push(@maintaddrs,$addmaint) unless
-                ($addmaint eq $replyto and $codeletter ne 'M') || 
-                    grep($_ eq $addmaint, @maintaddrs);
+                $addmaint eq $replyto || grep($_ eq $addmaint, @maintaddrs);
             $anymaintfound++;
         } else {
            print DEBUG "maintainer none >$p<\n";
@@ -1136,15 +1134,11 @@ sub bug_list_forward{
          $envelope_from =~ s/^.+?<([^>]+)>.+$/$1/;
      }
      my ($header,$body) = split /\n\n/, $bug_message, 2;
-     # Add X-$gProject-PR-Message: list bug_number and package name headers
-     if (defined $data and $bfound) {
-         $header .= qq(\nX-$gProject-PR-Message: list $bug_number\n).
-              qq(X-$gProject-PR-Package: $data->{package}\n).
-                   qq(X-$gProject-PR-Title: $data->{subject});
-     }
-     else {
-         $header .= qq(\nX-$gProject-PR-Message: list inactivebug);
-     }
+     # Add X-$gProject-PR-Message: list bug_number, package name, and bug title headers
+     $header .= qq(\nX-$gProject-PR-Message: list $bug_number\n).
+         qq(X-$gProject-PR-Package: $data->{package}\n).
+              qq(X-$gProject-PR-Title: $data->{subject})
+              if defined $data;
      print STDERR "Tried to loop me with $envelope_from\n"
          and exit 1 if $envelope_from =~ /\Q$gListDomain\E|\Q$gEmailDomain\E/;
      print DEBUG $envelope_from,qq(\n);
index 1f4069a636b6b0157f16fac1d0e04dfa5e8352d1..6ce4fe9e80c76029ca8fea785a4112cffac5cc31 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: processall.in,v 1.10 2004/03/20 15:13:52 cjwatson Exp $
+# $Id: processall.in,v 1.11 2005/10/06 03:32:13 ajt Exp $
 #
 # Usage: processall
 #
@@ -53,7 +53,7 @@ for (;;) {
         print(STDOUT "[$nf] $id service ...") || die $!;
         defined($c=fork) || die $!;
         if (!$c) { exec("$lib_path/service",$id); die $!; }
-    } elsif ($id =~ m/^[BMQFDU]/) {
+    } elsif ($id =~ m/^[BMQFDUL]/) {
         print(STDOUT "[$nf] $id process ...") || die $!;
         defined($c=fork) || die $!;
         if (!$c) { exec("$lib_path/process",$id); die $!; }
index d00ab8d8a185978c298ef81733b2e5ef33567f47..dd895dff8986735b830129aa043877209ca0935d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: service.in,v 1.112 2005/08/17 21:46:17 don Exp $
+# $Id: service.in,v 1.113 2005/10/06 03:32:13 ajt Exp $
 #
 # Usage: service <code>.nn
 # Temps:  incoming/P<code>.nn
@@ -160,7 +160,7 @@ for ($procline=0; $procline<=$#bodylines; $procline++) {
     &transcript("> $_\n");
     next if m/^\s*\#/;
     $action= '';
-    if (m/^stop/i || m/^quit/i || m/^--/ || m/^thank/i) {
+    if (m/^stop/i || m/^quit/i || m/^--/ || m/^thank/i || m/^kthxbye/i) {
        &transcript("Stopping processing here.\n\n");
         last;
     } elsif (m/^debug\s+(\d+)$/i && $1 >= 0 && $1 <= 1000) {
@@ -580,6 +580,102 @@ END
                $data->{keywords} =~ s/\s*$//;
             } while (&getnextbug);
        }
+    } elsif (m/^(un)?block\s+\#?(-?\d+)\s+(by|with)\s+\s*(\S.*)?$/i) {
+       $ok++;
+       my $bugnum = $2; my $blockers = $4;
+       $addsub = "add";
+       $addsub = "sub" if ($1 eq "un");
+       
+       my @okayblockers;
+       my @badblockers;
+       foreach my $b (split /[\s,]+/, $blockers) {
+           $b=~s/^\#//;
+           if ($b=~/[0-9]+/) {
+               $ref=$b;
+               if (&getbug) {
+                   push @okayblockers, $b;
+
+                   # add to the list all bugs that are merged with $b,
+                   # because all of their data must be kept in sync
+                   @thisbugmergelist= split(/ /,$data->{mergedwith});
+                   &cancelbug;
+
+                   foreach $ref (@thisbugmergelist) {
+                       if (&getbug) {
+                          push @okayblockers, $ref;
+                          &cancelbug;
+                       }
+                   }
+               }
+               else {
+                   &notfoundbug;
+                    push @badblockers, $b;
+               }
+           }
+           else {
+                push @badblockers, $b;
+           }
+       }
+       if (@badblockers) {
+            &transcript("Unknown blocking bug/s: ".join(', ', @badblockers).".\n");
+       }
+       
+       $ref=$bugnum;
+       if (&setbug) {
+           if ($data->{blockedby} eq '') {
+               &transcript("Was not blocked by any bugs.\n");
+           } else {
+               &transcript("Was blocked by: $data->{blockedby}\n");
+           }
+           if ($addsub eq "set") {
+               $action= "Blocking bugs set to: " . join(", ", @okayblockers);
+           } elsif ($addsub eq "add") {
+               $action= "Blocking bugs added: " . join(", ", @okayblockers);
+           } elsif ($addsub eq "sub") {
+               $action= "Blocking bugs removed: " . join(", ", @okayblockers);
+           }
+           my %removedblocks;
+           my %addedblocks;
+           do {
+                &addmaintainers($data);
+               my @oldblockerlist = split ' ', $data->{blockedby};
+               $data->{blockedby} = '' if ($addsub eq "set");
+               foreach my $b (@okayblockers) {
+                       $data->{blockedby} = manipset($data->{blockedby}, $b,
+                               ($addsub ne "sub"));
+               }
+
+               foreach my $b (@oldblockerlist) {
+                       if (! grep { $_ eq $b } split ' ', $data->{blockedby}) {
+                               push @{$removedblocks{$b}}, $ref;
+                       }
+               }
+               foreach my $b (split ' ', $data->{blockedby}) {
+                       if (! grep { $_ eq $b } @oldblockerlist) {
+                               push @{$addedblocks{$b}}, $ref;
+                       }
+               }
+            } while (&getnextbug);
+
+           # Now that the blockedby data is updated, change blocks data
+           # to match the changes.
+           foreach $ref (keys %addedblocks) {
+               if (&getbug) {
+                   foreach my $b (@{$addedblocks{$ref}}) {
+                       $data->{blocks} = manipset($data->{blocks}, $b, 1);
+                   }
+                   &savebug;
+                }
+           }
+           foreach $ref (keys %removedblocks) {
+               if (&getbug) {
+                   foreach my $b (@{$removedblocks{$ref}}) {
+                       $data->{blocks} = manipset($data->{blocks}, $b, 0);
+                   }
+                   &savebug;
+                }
+           }
+       }
     } elsif (m/^retitle\s+\#?(-?\d+)\s+(\S.*\S)\s*$/i) {
         $ok++;
         $ref= $1; $newtitle= $2;
@@ -650,6 +746,8 @@ END
            &checkmatch('forwarded addr','m_forwarded',$data->{forwarded});
            $data->{severity} = '$gDefaultSeverity' if $data->{severity} eq '';
            &checkmatch('severity','m_severity',$data->{severity});
+           &checkmatch('blocks','m_blocks',$data->{blocks});
+           &checkmatch('blocked-by','m_blockedby',$data->{blockedby});
            &checkmatch('done mark','m_done',length($data->{done}) ? 'done' : 'open');
            &checkmatch('owner','m_owner',$data->{owner});
            foreach my $t (split /\s+/, $data->{keywords}) { $tags{$t} = 1; }
@@ -709,21 +807,38 @@ END
                } else {
                    $action= "$gBug $origref cloned as bugs $firstref-$lastref.";
                }
+
+               my $blocks = $data->{blocks};
+               my $blockedby = $data->{blockedby};
+               
                &getnextbug;
                my $ohash = get_hashname($origref);
-               $ref = $firstref;
-               @bug_affected{@newclonedids} = 1 x @newclonedids;
+               my $clone = $firstref;
+                @bug_affected{@newclonedids} = 1 x @newclonedids;
                for $newclonedid (@newclonedids) {
-                   $clonebugs{$newclonedid} = $ref;
+                   $clonebugs{$newclonedid} = $clone;
            
-                   my $hash = get_hashname($ref);
-                   copy("db-h/$ohash/$origref.log", "db-h/$hash/$ref.log");
-                   copy("db-h/$ohash/$origref.status", "db-h/$hash/$ref.status");
-                   copy("db-h/$ohash/$origref.summary", "db-h/$hash/$ref.summary");
-                   copy("db-h/$ohash/$origref.report", "db-h/$hash/$ref.report");
-                   &bughook('new', $ref, $data);
-
-                   $ref++;
+                   my $hash = get_hashname($clone);
+                   copy("db-h/$ohash/$origref.log", "db-h/$hash/$clone.log");
+                   copy("db-h/$ohash/$origref.status", "db-h/$hash/$clone.status");
+                   copy("db-h/$ohash/$origref.summary", "db-h/$hash/$clone.summary");
+                   copy("db-h/$ohash/$origref.report", "db-h/$hash/$clone.report");
+                   &bughook('new', $clone, $data);
+               
+                   # Update blocking info of bugs blocked by or blocking the
+                   # cloned bug.
+                   foreach $ref (split ' ', $blocks) {
+                       &getbug;
+                       $data->{blockedby} = manipset($data->{blockedby}, $clone, 1);
+                       &savebug;
+                   }
+                   foreach $ref (split ' ', $blockedby) {
+                       &getbug;
+                       $data->{blocks} = manipset($data->{blocks}, $clone, 1);
+                       &savebug;
+                   }
+
+                   $clone++;
                }
            }
        }
@@ -909,6 +1024,21 @@ sub checkpkglimit {
     return 1;
 }
 
+sub manipset {
+    my $list = shift;
+    my $elt = shift;
+    my $add = shift;
+
+    my %h = map { $_ => 1 } split ' ', $list;
+    if ($add) {
+        $h{$elt}=1;
+    }
+    else {
+       delete $h{$elt};
+    }
+    return join ' ', sort keys %h;
+}
+
 # High-level bug manipulation calls
 # Do announcements themselves
 #