X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=bin%2Fparse-sources;h=8ec35dbb94d4cdeb7071564eb3dc7a25f7693f1d;hb=336dcafd70ea7f5b9bf4e2f30b6c44faf973c855;hp=89f071d42d389bf77c4f05d997ddce019b0060ca;hpb=9f26e8bcb912da43661983f13714c3e56f406007;p=deb%2Fpackages.git diff --git a/bin/parse-sources b/bin/parse-sources index 89f071d..8ec35db 100755 --- a/bin/parse-sources +++ b/bin/parse-sources @@ -22,11 +22,14 @@ 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; use DB_File; +use File::Path; use Packages::Config qw( $TOPDIR $DBDIR @ARCHIVES @SUITES ); &Packages::Config::init( './' ); my %sources_small = (); @@ -35,14 +38,21 @@ my %source_postfixes = (); $/ = ""; +-d $DBDIR || mkpath( $DBDIR ); + 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 or die "Error creating DB: $!"; + if (!-d "$TOPDIR/archive/$archive/$suite/") { + print "\tseems not to exist, skipping...\n"; + next; + } open PKG, "zcat $TOPDIR/archive/$archive/$suite/$what/source/Sources.gz|"; while () { next if /^\s*$/; @@ -57,6 +67,7 @@ for my $archive (@ARCHIVES) { $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; @@ -84,6 +95,12 @@ for my $archive (@ARCHIVES) { $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; } @@ -127,6 +144,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");