]> git.donarmstrong.com Git - debbugs.git/blob - scripts/rebuild.in
[project @ 1999-09-20 05:40:06 by gecko]
[debbugs.git] / scripts / rebuild.in
1 #!/usr/bin/perl -w
2 # $Id: rebuild.in,v 1.1 1999/09/20 05:40:07 gecko Exp $
3
4 # Load modules and set envirnment
5 use File::Copy;
6 require('/etc/debbugs/config');
7 require('/usr/lib/debbugs/errorlib');
8 $ENV{'PATH'}= '/usr/lib/debbugs'.$ENV{'PATH'};
9 chdir("$gSpoolDir") || die "chdir spool: $!\n";
10
11 sub readreport {
12     my $lref = shift;
13         my $path = shift;
14         
15     open(S,"$path/$lref.status") || die "unable to open $path/$lref: $!\n";
16     chop($s_originator= <S>);
17     chop($s_date= <S>);
18     chop($s_subject= <S>);
19     chop($s_msgid= <S>);
20     chop($s_package= <S>);
21     chop($s_keywords= <S>);
22     chop($s_done= <S>);
23     chop($s_forwarded= <S>);
24     chop($s_mergedwith= <S>);
25     chop($s_severity= <S>);
26     close(S);
27     return 1;
28 }
29
30 #global variables
31 $debug = 0;
32 defined($startdate= time) || &quit("failed to get time: $!");
33
34 open IDXFILE, ">archive/index" or &quit( "trying to reset index file: $!" );
35
36 #get list of bugs (ie, status files)
37 for ($subdir=0; $subdir<100; $subdir++ )
38 {
39         my $path = sprintf( "archive/%.2d", $subdir );
40         opendir(DIR,$path) || next; 
41         @list= grep(m/^\d+\.status$/,readdir(DIR));
42         closedir DIR;
43         grep(s/\.status$//,@list);
44         @list= sort { $a <=> $b } @list;
45
46         #process each bug (ie, status file)
47         while ( defined( $list[0] )) 
48         {       my $ref = shift @list;
49                 print STDERR "$ref considering\n" if $debug;
50         readreport($ref, $path);
51                 printf IDXFILE "%s %d %s\n", $s_package, $ref, $s_subject;
52     }
53 }
54
55 close IDXFILE;