2 # $Id: processall.in,v 1.13 2005/10/06 03:46:13 ajt Exp $
6 # Uses up: incoming/I<code><bugnum>.nn
7 # Temps: incoming/[GP].nn
8 # Creates: incoming/E.nn
15 use Debbugs::Config qw(:globals);
16 use Debbugs::Common qw(:lock);
18 my $lib_path = $gLibPath;
22 chdir( $gSpoolDir ) || die "chdir spool: $!\n";
33 &filelock('incoming-cleaner');
36 print(STDERR "stop file created\n") || die $!;
40 opendir(DIR,"incoming") || die $!;
41 while ( defined( $_= readdir(DIR) )) { push(@ids,$_) if s/^I//; }
45 stat("$gMaintainerFile") || die "stat $gMaintainerFile: $!\n";
48 unless (rename("incoming/I$id","incoming/G$id")) {
50 die "$id already fudged once! $!\n";
56 if ($id =~ m/^[RC]/) {
57 print(STDOUT "[$nf] $id service ...") || die $!;
58 defined($c=fork) || die $!;
59 if (!$c) { exec("$lib_path/service",$id); die "unable to execute $lib_path/service: $!"; }
60 } elsif ($id =~ m/^[BMQFDUL]/) {
61 print(STDOUT "[$nf] $id process ...") || die $!;
62 defined($c=fork) || die $!;
63 if (!$c) { exec("$lib_path/process",$id); die "unable to execute $lib_path/process: $!"; }
67 my $cc=waitpid($c,0); $cc == $c || die "$cc $c $!";
70 print(STDERR "$id: process failed ($status $!) - now in [PG]$id\n") || die $!;
72 print(STDOUT " done\n") || die $!;
73 rmtree("$gSpoolDir/mime.tmp",0,1);
78 system("$lib_path/gen-indices",'--quick') == 0 or print STDERR "gen-indices failed\n";
80 if (@gPostProcessall) {
81 system @gPostProcessall == 0 or print STDERR "\@gPostProcessall failed: ".join(' ',@gPostProcessall)."\n";