2 # $Id: rebuild.in,v 1.13 2003/08/23 15:12:57 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 use vars qw($gSpoolDir);
13 $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
15 chdir("$gSpoolDir") || die "chdir spool: $!\n";
20 @ARGV==0 and die "no archive given on the commandline" ;
21 my $archive = shift(@ARGV);
22 my $index = "index.$archive";
23 $index = 'index.db' if $archive eq 'db-h';
24 open IDXFILE, "> $index" or die "trying to reset index file: $!" ;
26 #get list of bugs (ie, status files)
28 for ($subdir=0; $subdir<100; $subdir++ )
30 my $path = sprintf( "$archive/%.2d", $subdir );
31 opendir(DIR,$path) || next;
32 my @list= grep(m/^\d+\.summary$/,readdir(DIR));
34 grep(s/\.summary$//,@list);
38 @files = sort { $a <=> $b } @files;
40 #process each bug (ie, status file)
43 print STDERR "$ref considering\n" if $debug;
44 my $data = readbug($ref, $archive);
45 $data->{severity} =~ y/A-Z/a-z/;
47 (my $pkglist = $data->{package}) =~ s/[,\s]+/,/g;
51 my $whendone = 'open';
52 $whendone = 'forwarded' if length $data->{forwarded};
53 $whendone = 'done' if length $data->{done};
55 printf IDXFILE "%s %d %d %s [%s] %s %s\n",
56 $pkglist, $ref, $data->{date}, $whendone, $data->{originator},
57 $data->{severity}, $data->{keywords};