]> git.donarmstrong.com Git - debbugs.git/blobdiff - scripts/gen-indices.in
merge changes from dla source tree
[debbugs.git] / scripts / gen-indices.in
index bd1766a635237f3086b1e5359fbd0d9435fc9782..14d7b1c131e92a8f229be595ef2bebc7db561bef 100755 (executable)
@@ -4,8 +4,6 @@
 # Copyright (c) 2005/08/03 Anthony Towns
 # GPL v2
 
-#use strict;
-
 use DB_File;
 use MLDBM qw(DB_FILE Storable);
 use Fcntl qw/O_RDWR O_CREAT O_TRUNC/;
@@ -77,16 +75,14 @@ GetOptions(\%options,'quick!','index_path|index-path=s','debug|d+','help|h|?','m
 pod2usage(1) if $options{help};
 pod2usage(-verbose=>2) if $options{man};
 
-{ no warnings;
-  no strict;
-require '/etc/debbugs/config';
-require '/org/bugs.debian.org/scripts/errorlib';
-}
+use Debbugs::Config qw(:config);
+use Debbugs::Common qw(getparsedaddrs getbugcomponent);
+use Debbugs::Status qw(readbug);
 
-chdir('/org/bugs.debian.org/spool') or die "chdir spool: $!\n";
+chdir($config{spool_dir}) or die "chdir $config{spool_dir} failed: $!";
 
 my $verbose = $options{debug};
-my $indexdest = $options{index_path} || "/org/bugs.debian.org/spool";
+my $indexdest = $options{index_path} || $config{spool_dir};
 
 my $initialdir = "db-h";
 my $suffix = "";
@@ -97,7 +93,7 @@ if (defined $ARGV[0] and $ARGV[0] eq "archive") {
 }
 
 # NB: The reverse index is special; it's used to clean up during updates to bugs
-my @indexes = ('package', 'tag', 'severity', 'submitter-email','reverse');
+my @indexes = ('package', 'tag', 'severity','owner','submitter-email','reverse');
 my $indexes;
 my %slow_index = ();
 my %fast_index = ();
@@ -186,8 +182,9 @@ while (my $dir = shift @dirs) {
                addbugtoindex("package", $bug, split /[\s,]+/, $fdata->{"package"});
                addbugtoindex("tag", $bug, split /[\s,]+/, $fdata->{"keywords"});
                addbugtoindex('submitter-email', $bug,
-                             emailfromrfc822($fdata->{"originator"}));
+                             map {$_->address} getparsedaddrs($fdata->{originator}));
                addbugtoindex("severity", $bug, $fdata->{"severity"});
+               addbugtoindex("owner", $bug, $fdata->{"owner"});
        }
 }
 
@@ -205,5 +202,7 @@ if (not $options{quick}) {
 for my $i (@indexes) {
        untie %{$slow_index{$i}};
        move("$indexdest/by-$i$suffix.idx.new", "$indexdest/by-$i$suffix.idx");
-       system('touch','-d',"1/1/1970 + ${start_time}secs","$indexdest/by-$i$suffix.idx");
+       # We do this, because old versions of touch don't support -d '@epoch'
+       system('touch','-d',"1/1/1970 UTC + ${start_time}secs","$indexdest/by-$i$suffix.idx");
 }
+