]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2003-05-25 13:13:18 by cjwatson]
authorcjwatson <>
Sun, 25 May 2003 20:13:18 +0000 (12:13 -0800)
committercjwatson <>
Sun, 25 May 2003 20:13:18 +0000 (12:13 -0800)
Make rebuild actually work (even its command-line processing was broken so
that it could never possibly work ...). Update index format to that
expected by the rest of debbugs.

scripts/rebuild.in

index 7646eae4ca4a06de79f1d956e56527937b3c1232..fd1dbfbc6b7e48525cfc0a8928ec2b0901e03943 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# $Id: rebuild.in,v 1.8 2003/05/25 12:38:58 cjwatson Exp $
+# $Id: rebuild.in,v 1.9 2003/05/25 13:13:18 cjwatson Exp $
 
 # Load modules and set environment
 use File::Copy;
@@ -11,42 +11,46 @@ require("$lib_path/errorlib");
 $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
 
 chdir("$gSpoolDir") || die "chdir spool: $!\n";
-my $data;
-
-sub readreport {
-    my $lref = shift;
-    my $path = shift;
-
-    $data = readbug($lref);
-    return 1;
-}
 
 #global variables
 $debug = 0;
-defined($startdate= time) || &quit("failed to get time: $!");
 
-@ARGV==0 or &quit( "no archive given on the commandline" );
+@ARGV==0 and &quit( "no archive given on the commandline" );
 $archive= shift(@ARGV);
 open IDXFILE, "> index.$archive" or &quit( "trying to reset index file: $!" );
 
 #get list of bugs (ie, status files)
+my @files;
 for ($subdir=0; $subdir<100; $subdir++ )
 {
     my $path = sprintf( "$archive/%.2d", $subdir );
     opendir(DIR,$path) || next; 
-    @list= grep(m/^\d+\.status$/,readdir(DIR));
+    my @list= grep(m/^\d+\.status$/,readdir(DIR));
     closedir DIR;
     grep(s/\.status$//,@list);
-    @list= sort { $a <=> $b } @list;
-
-    #process each bug (ie, status file)
-    while ( defined( $list[0] )) 
-    {
-       my $ref = shift @list;
-       print STDERR "$ref considering\n" if $debug;
-       readreport($ref, $path);
-       printf IDXFILE "%s %d %s\n", $data->{package}, $ref, $data->{subject};
-    }
+    push @files, @list;
+}
+
+@files = sort { $a <=> $b } @files;
+
+#process each bug (ie, status file)
+for my $ref (@files) 
+{
+    print STDERR "$ref considering\n" if $debug;
+    my $data = readbug($ref, $archive);
+    $data->{severity} =~ y/A-Z/a-z/;
+
+    (my $pkglist = $data->{package}) =~ s/[,\s]+/,/g;
+    $pkglist =~ s/^,+//;
+    $pkglist =~ s/,+$//;
+
+    my $whendone = 'open';
+    $whendone = 'forwarded' if length $data->{forwarded};
+    $whendone = 'done' if length $data->{done};
+
+    printf IDXFILE "%s %d %d %s [%s] %s %s\n",
+       $pkglist, $ref, $data->{date}, $whendone, $data->{originator},
+       $data->{severity}, $data->{keywords};
 }
 
 close IDXFILE;