]> git.donarmstrong.com Git - debbugs.git/blobdiff - scripts/gen-indices.in
don't use ::Usertags ::Status et al. in soap.cgi anymore
[debbugs.git] / scripts / gen-indices.in
index 59e0fe9ed396c2c133e248223ff23570e2a38f78..73243b8e5119b0d6cc9ee3a6432c36d88abe6157 100755 (executable)
@@ -76,7 +76,7 @@ pod2usage(1) if $options{help};
 pod2usage(-verbose=>2) if $options{man};
 
 use Debbugs::Config qw(:config);
-use Debbugs::Common qw(getparsedaddrs);
+use Debbugs::Common qw(getparsedaddrs getbugcomponent);
 use Debbugs::Status qw(readbug);
 
 chdir($config{spool_dir}) or die "chdir $config{spool_dir} failed: $!";
@@ -167,7 +167,7 @@ my @dirs = ($initialdir);
 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);
 
@@ -176,15 +176,20 @@ while (my $dir = shift @dirs) {
 
        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"});
                addbugtoindex("tag", $bug, split /[\s,]+/, $fdata->{"keywords"});
                addbugtoindex('submitter-email', $bug,
-                             map {$_->address} getparsedaddrs($fdata->{originator}));
+                             map {lc($_->address)} getparsedaddrs($fdata->{originator}));
                addbugtoindex("severity", $bug, $fdata->{"severity"});
-               addbugtoindex("owner", $bug, $fdata->{"owner"});
+               addbugtoindex("owner", $bug,
+                             map {lc($_->address)} getparsedaddrs($fdata->{"owner"}));
        }
 }