pod2usage(-verbose=>2) if $options{man};
use Debbugs::Config qw(:config);
-use Debbugs::Common qw(getparsedaddrs getbugcomponent);
+use Debbugs::Common qw(getparsedaddrs getbugcomponent lockpid);
use Debbugs::Status qw(readbug);
chdir($config{spool_dir}) or die "chdir $config{spool_dir} failed: $!";
$suffix = "-arc";
}
+if (not lockpid($config{spool_dir}.'/lock/gen-indices')) {
+ if ($options{quick}) {
+ # If this is a quick run, just exit
+ print STDERR "Another gen-indices is running; stopping\n" if $verbose;
+ exit 0;
+ }
+ print STDERR "Another gen-indices is running; stopping\n";
+ exit 1;
+}
+
# NB: The reverse index is special; it's used to clean up during updates to bugs
-my @indexes = ('package', 'tag', 'severity','owner','submitter-email','reverse');
+my @indexes = ('package', 'tag', 'severity','owner','submitter-email','status','reverse');
my $indexes;
my %slow_index = ();
my %fast_index = ();
while (my $dir = shift @dirs) {
printf "Doing dir %s ...\n", $dir if $verbose;
- opendir(DIR, "$dir/.") or die "opendir $dir: $!\n";
+ opendir(DIR, "$dir/.") or die "opendir $dir: $!";
my @subdirs = readdir(DIR);
closedir(DIR);
for my $bug (@list) {
print "Up to $cnt bugs...\n" if (++$cnt % 100 == 0 && $verbose);
- my $stat = stat(getbugcomponent($bug,'summary'));
+ my $stat = stat(getbugcomponent($bug,'summary',$initialdir));
+ if (not defined $stat) {
+ print STDERR "Unable to stat $bug $!\n";
+ next;
+ }
next if $stat->mtime < $time;
my $fdata = readbug($bug, $initialdir);
addbugtoindex("package", $bug, split /[\s,]+/, $fdata->{"package"});
system('touch','-d',"1/1/1970 UTC + ${start_time}secs","$indexdest/by-$i$suffix.idx");
}
+unlink($config{spool_dir}.'/lock/gen-indices')