2 # $Id: rebuild.in,v 1.6 2003/05/03 20:01:20 doogie Exp $
4 # Load modules and set envirnment
6 $config_path = '/etc/debbugs';
7 $lib_path = '/usr/lib/debbugs';
9 require("$config_path/config");
10 require("$lib_path/errorlib");
11 $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
13 chdir("$gSpoolDir") || die "chdir spool: $!\n";
20 $data = readbug($lref);
26 defined($startdate= time) || &quit("failed to get time: $!");
28 @ARGV==0 or &quit( "no archive given on the commandline" );
29 $archive= shift(@ARGV);
30 open IDXFILE, "> index.$archive" or &quit( "trying to reset index file: $!" );
33 if ( $archive eq 'db' )
35 opendir(DIR,'db') || next;
36 @list= grep(m/^\d+\.status$/,readdir(DIR));
38 grep(s/\.status$//,@list);
39 @list= sort { $a <=> $b } @list;
41 #process each bug (ie, status file)
42 while ( defined( $list[0] ))
43 { my $ref = shift @list;
44 print STDERR "$ref considering\n" if $debug;
45 readreport($ref, $path);
46 printf IDXFILE "%s %d %s\n", $data->{package}, $ref, $data->{subject};
52 #get list of bugs (ie, status files)
53 for ($subdir=0; $subdir<100; $subdir++ )
55 my $path = sprintf( "$archive/%.2d", $subdir );
56 opendir(DIR,$path) || next;
57 @list= grep(m/^\d+\.status$/,readdir(DIR));
59 grep(s/\.status$//,@list);
60 @list= sort { $a <=> $b } @list;
62 #process each bug (ie, status file)
63 while ( defined( $list[0] ))
64 { my $ref = shift @list;
65 print STDERR "$ref considering\n" if $debug;
66 readreport($ref, $path);
67 printf IDXFILE "%s %d %s\n", $data->{package}, $ref, $data->{subject};