2 # $Id: rebuild.in,v 1.2 1999/10/25 06:18:14 gecko Exp $
4 # Load modules and set envirnment
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";
15 open(S,"$path/$lref.status") || die "unable to open $path/$lref: $!\n";
16 chop($s_originator= <S>);
18 chop($s_subject= <S>);
20 chop($s_package= <S>);
21 chop($s_keywords= <S>);
23 chop($s_forwarded= <S>);
24 chop($s_mergedwith= <S>);
25 chop($s_severity= <S>);
32 defined($startdate= time) || &quit("failed to get time: $!");
34 @ARGV==0 or &quit( "no archive given on the commandline" );
35 $archive= shift(@ARGV);
36 open IDXFILE, "> index.$archive" or &quit( "trying to reset index file: $!" );
39 if ( $archive eq 'db' )
41 opendir(DIR,'db') || next;
42 @list= grep(m/^\d+\.status$/,readdir(DIR));
44 grep(s/\.status$//,@list);
45 @list= sort { $a <=> $b } @list;
47 #process each bug (ie, status file)
48 while ( defined( $list[0] ))
49 { my $ref = shift @list;
50 print STDERR "$ref considering\n" if $debug;
51 readreport($ref, $path);
52 printf IDXFILE "%s %d %s\n", $s_package, $ref, $s_subject;
58 #get list of bugs (ie, status files)
59 for ($subdir=0; $subdir<100; $subdir++ )
61 my $path = sprintf( "$archive/%.2d", $subdir );
62 opendir(DIR,$path) || next;
63 @list= grep(m/^\d+\.status$/,readdir(DIR));
65 grep(s/\.status$//,@list);
66 @list= sort { $a <=> $b } @list;
68 #process each bug (ie, status file)
69 while ( defined( $list[0] ))
70 { my $ref = shift @list;
71 print STDERR "$ref considering\n" if $debug;
72 readreport($ref, $path);
73 printf IDXFILE "%s %d %s\n", $s_package, $ref, $s_subject;