]> git.deb.at Git - deb/packages.git/blobdiff - bin/parse-sources
Add mail stuff from old code
[deb/packages.git] / bin / parse-sources
index e640b9d3dfae2581421f77cd6ba75caaa567fb7c..732112658e74f236c6d8e4d9d459b5a67d277c8d 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_SOURCE_POSTFIXES = 100;
@@ -39,6 +41,7 @@ for my $archive (@ARCHIVES) {
     for my $suite (@SUITES) {
 
        print "Reading $archive/$suite...\n";
+       my %source_names_suite = ();
        my %sources_all_db;
        tie %sources_all_db, "DB_File", "$DBDIR/sources_all_$suite.db.new",
                O_RDWR|O_CREAT, 0666, $DB_BTREE
@@ -53,11 +56,15 @@ for my $archive (@ARCHIVES) {
                while (/^(\S+):\s*(.*)\s*$/mg) {
                        my ($key, $value) = ($1, $2);
                        $value =~ s/\377/\n /g;
-                       $data .= "$key: $value\n";
                        $key =~ tr [A-Z] [a-z];
                        $data{$key} = $value;
                }
                $source_names{$data{'package'}} = 1;
+               $source_names_suite{$data{'package'}} = 1;
+               delete $data{'binary'};
+
+               $data{files} =~ s/\s*\n\s*/\01/sog;
+               $data{files} =~ s/^\01//sg;
 
                my $section = 'main';
                my $subsection = $data{section} || '-';
@@ -72,15 +79,21 @@ for my $archive (@ARCHIVES) {
                $sources_small{$data{'package'}} .=
                        "$archive $suite $section $subsection $data{'priority'} $data{'version'}\000";
 
-               $data{archive} = $archive;
                while (my ($key, $value) = each (%data)) {
-                   next if $key eq 'package' or $key eq 'version';
+                   next if $key eq 'package' or $key eq 'archive' or $key eq 'suite';
                    print STDERR "WARN: $key ($suite/$archive/$data{package}/$data{architecture}\n" unless defined $value;
-                   $data .= "$key: $value\n";
+                   $data .= "$key\00$value\00";
                }
-               $sources_all_db{"$data{'package'} $data{'version'}"}
+               $data =~ s/.$//so;
+               $sources_all_db{"$archive $suite $data{'package'}"}
                        = $data;
        }
+       open NAMES, '>>', "$DBDIR/source_names_$suite.txt.new"
+           or die "Error creating source names list: $!";
+       foreach (sort keys %source_names_suite) {
+           print NAMES "$_\n";
+       }
+       close NAMES;
 
        untie %sources_all_db;
     }
@@ -124,6 +137,7 @@ untie %source_postfixes_db;
 
 for my $suite (@SUITES) {
        rename("$DBDIR/sources_all_$suite.db.new", "$DBDIR/sources_all_$suite.db");
+       rename("$DBDIR/source_names_$suite.txt.new", "$DBDIR/source_names_$suite.txt");
 }
 rename("$DBDIR/sources_small.db.new", "$DBDIR/sources_small.db");
 rename("$DBDIR/source_postfixes.db.new", "$DBDIR/source_postfixes.db");