]> git.deb.at Git - deb/packages.git/blobdiff - bin/parse-packages
parse-packages: be friendlier to syntax highlighting
[deb/packages.git] / bin / parse-packages
index b0883a279da39798715b9b9a0a67eb73527ecd45..3c783234ed9bef24fc59fa5c4a35426e72a5d06a 100755 (executable)
@@ -2,9 +2,9 @@
 # Convert Packages.gz files into Sleepycat db files for efficient usage of
 # data
 #
-# $Id$
-#
 # Copyright (C) 2006  Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
+# Copyright (C) 2006-2007 Frank Lichtenheld <frank@lichtenheld.de>
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -17,7 +17,7 @@
 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
 use warnings;
@@ -149,8 +149,6 @@ for my $suite (@SUITES) {
                my $subsection = $data{section} || '-';
                if ($data{section} && ($data{section} =~ m=/=o)) {
                    ($section, $subsection) = split m=/=o, $data{section}, 2;
-                   ($subsection, $section) = split m=/=o, $data{section}, 2
-                       if $section eq 'non-US';
                }
                $data{'section'} = $section;
                $data{'subsection'} = $subsection;
@@ -269,6 +267,7 @@ print "Index $#descriptions descriptions\n";
 for (my $i=1; $i<= $#descriptions; $i++) {
        # strip away additional data
        my ($only_desc, $pkg, $tags) = split /\000/o, $descriptions[$i], 3;
+       my $orig_desc = $only_desc;
 # WARNING: This needs to correspond with what happens in
 # Packages/Search.pm:do_xapian_search
        $only_desc =~ s#[^\w/+]+# #og;
@@ -304,7 +303,7 @@ for (my $i=1; $i<= $#descriptions; $i++) {
                }
            }
            if ($tags) {
-               foreach my $t (split /, /, $tags) {
+               foreach my $t (split m/, /, $tags) {
                    if ($doc->add_term($t)) {
                        warn "can't add term $t: $!\n";
                    }
@@ -316,7 +315,7 @@ for (my $i=1; $i<= $#descriptions; $i++) {
        };
        die $@ if $@;
 
-       $descriptions_db{$i} = $only_desc;
+       $descriptions_db{$i} = $orig_desc;
 }
 untie %descriptions_db;
 $xapian_db->flush;