]> git.donarmstrong.com Git - debbugs.git/blobdiff - scripts/gen-indices
the datastructure needs to be encoded before gen-indices uses it
[debbugs.git] / scripts / gen-indices
index c929db6544565649c3b7a2d85c30232a2fc81fdc..7a8670d96ffb8c69fe90e73185e78a156792183b 100755 (executable)
@@ -20,6 +20,8 @@ use Pod::Usage;
 use File::stat;
 use List::Util qw(min);
 
+use Debbugs::Common qw(make_list);
+
 =head1 NAME
 
 gen-indices - Generates index files for the cgi scripts
@@ -39,7 +41,7 @@ gen-indices - Generates index files for the cgi scripts
 
 =over
 
-=itme B<--quick>
+=item B<--quick>
 
 Only update changed bugs
 
@@ -79,8 +81,9 @@ pod2usage(-verbose=>2) if $options{man};
 
 use Debbugs::Config qw(:config);
 use Debbugs::Common qw(getparsedaddrs getbugcomponent lockpid);
-use Debbugs::Status qw(readbug);
+use Debbugs::Status qw(readbug split_status_fields);
 use Debbugs::Log;
+use Debbugs::UTF8 qw(encode_utf8_structure);
 
 chdir($config{spool_dir}) or die "chdir $config{spool_dir} failed: $!";
 
@@ -106,7 +109,7 @@ if (not lockpid($config{spool_dir}.'/lock/gen-indices')) {
 }
 
 # NB: The reverse index is special; it's used to clean up during updates to bugs
-my @indexes = ('package', 'tag', 'severity','owner','submitter-email','status','correspondent','reverse');
+my @indexes = ('package', 'tag', 'severity','owner','submitter-email','status','correspondent','affects','reverse');
 my $indexes;
 my %slow_index = ();
 my %fast_index = ();
@@ -196,10 +199,11 @@ while (my $dir = shift @dirs) {
                     next;
                }
                next if $stat->mtime < $time;
-               my $fdata = readbug($bug, $initialdir);
+               my ($fdata) = encode_utf8_structure(split_status_fields(readbug($bug, $initialdir)));
                $modification_made = 1;
-               addbugtoindex("package", $bug, split /[\s,]+/, $fdata->{"package"});
-               addbugtoindex("tag", $bug, split /[\s,]+/, $fdata->{"keywords"});
+               addbugtoindex("package", $bug, make_list($fdata->{package}));
+               addbugtoindex("tag", $bug, make_list($fdata->{keywords}));
+               addbugtoindex("affects", $bug, make_list($fdata->{"affects"}));
                addbugtoindex('submitter-email', $bug,
                              map {lc($_->address)} getparsedaddrs($fdata->{originator}));
                addbugtoindex("severity", $bug, $fdata->{"severity"});