]> git.deb.at Git - deb/packages.git/blobdiff - bin/parse-packages
Unbuffered output, for tail -f'ing cron.log
[deb/packages.git] / bin / parse-packages
index 817f547e09d6c030259c583412e5971f11876b56..399a62ca060656a82314f4f80000a7462899b938 100755 (executable)
@@ -22,6 +22,8 @@
 use strict;
 use lib './lib';
 
+$| = 1;
+
 my $what = $ARGV[0] ? "non-free" : "*";
 # max. distinct results for a given package postfix
 my $MAX_PACKAGE_POSTFIXES = 100;
@@ -48,6 +50,7 @@ $/ = "";
 for my $archive (@ARCHIVES) {
     for my $suite (@SUITES) {
 
+       my %virtual_packages = ();
        print "Reading $archive/$suite...\n";
        my %packages_all_db;
        tie %packages_all_db, "DB_File", "$DBDIR/packages_all_$suite.db.new",
@@ -69,6 +72,11 @@ for my $archive (@ARCHIVES) {
                # Skip double package
                next if exists($packages_all_db{"$data{'package'} $data{'architecture'} $data{'version'}"});
 
+               if ($data{'provides'}) {
+                   foreach (split /\s*,\s*/, $data{'provides'}) {
+                       $virtual_packages{$_}{$data{'package'}}++;
+                   }
+               }
                $package_names{$data{'package'}} = 1;
                my $src = $data{'package'};
                my $src_version = '';
@@ -122,6 +130,11 @@ for my $archive (@ARCHIVES) {
                        = $data;
        }
 
+       foreach (keys %virtual_packages) {
+           my @provided_by = keys %{$virtual_packages{$_}};
+           $packages_small{$_} .= "$archive $suite virtual v v v v @provided_by\000";
+       }
+
        untie %packages_all_db;
     }
 }
@@ -173,8 +186,13 @@ tie %descriptions_db, "DB_File", "$DBDIR/descriptions.db.new",
 open DESCR, ">", "$DBDIR/descriptions.txt" or die "Error creating descriptions textfile";
 for (my $i=1; $i<= $#descriptions; $i++) {
        my $plain_description = $descriptions[$i];
-       $plain_description =~ s/\n .\n/ /og;
-       $plain_description =~ s/[\n \t]+/ /og;
+# WARNING: This needs to correspond with what happens in
+# Packages/Search.pm:do_fulltext_search
+       $plain_description =~ tr [A-Z] [a-z];
+       # ensure one space on both ends
+       $plain_description = " $plain_description ";
+       $plain_description =~ s/[(),.-]+//og;
+       $plain_description =~ s#[^a-z0-9_/+]+# #og;
        print DESCR "$plain_description\n";
        $descriptions_db{$i} = $descriptions[$i];
 }