2 # $Id: rebuild.in,v 1.9 2003/05/25 13:13:18 cjwatson Exp $
4 # Load modules and set environment
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";
18 @ARGV==0 and &quit( "no archive given on the commandline" );
19 $archive= shift(@ARGV);
20 open IDXFILE, "> index.$archive" or &quit( "trying to reset index file: $!" );
22 #get list of bugs (ie, status files)
24 for ($subdir=0; $subdir<100; $subdir++ )
26 my $path = sprintf( "$archive/%.2d", $subdir );
27 opendir(DIR,$path) || next;
28 my @list= grep(m/^\d+\.status$/,readdir(DIR));
30 grep(s/\.status$//,@list);
34 @files = sort { $a <=> $b } @files;
36 #process each bug (ie, status file)
39 print STDERR "$ref considering\n" if $debug;
40 my $data = readbug($ref, $archive);
41 $data->{severity} =~ y/A-Z/a-z/;
43 (my $pkglist = $data->{package}) =~ s/[,\s]+/,/g;
47 my $whendone = 'open';
48 $whendone = 'forwarded' if length $data->{forwarded};
49 $whendone = 'done' if length $data->{done};
51 printf IDXFILE "%s %d %d %s [%s] %s %s\n",
52 $pkglist, $ref, $data->{date}, $whendone, $data->{originator},
53 $data->{severity}, $data->{keywords};