]> git.deb.at Git - deb/packages.git/commitdiff
- Add working debugging mode (1 as parameter -> do only non-free)
authorJeroen van Wolffelaar <jeroen@wolffelaar.nl>
Wed, 1 Feb 2006 21:29:41 +0000 (21:29 +0000)
committerJeroen van Wolffelaar <jeroen@wolffelaar.nl>
Wed, 1 Feb 2006 21:29:41 +0000 (21:29 +0000)
- Add sources_small.db
- Split section also in sources_all

bin/parse-packages
bin/parse-sources

index b5c2cebac67eddae65c50ceafc1ca4a3d743736c..1c671e5076754c1019943248a0f23e9bb69a3bfe 100755 (executable)
@@ -21,7 +21,7 @@
 
 use strict;
 
 
 use strict;
 
-my $what = $1 ? "non-free" : "*";
+my $what = $ARGV[0] ? "non-free" : "*";
 # max. distinct results for a given package postfix
 my $MAX_PACKAGE_POSTFIXES = 100;
 
 # max. distinct results for a given package postfix
 my $MAX_PACKAGE_POSTFIXES = 100;
 
@@ -99,7 +99,7 @@ for my $suite (@suites) {
                $packages_small{$data{'package'}} .= "$suite $data{'architecture'} ".
                        "$section $subsection $data{'priority'} $data{'version'} $sdescr\000";
                $sources_packages{$src} .=
                $packages_small{$data{'package'}} .= "$suite $data{'architecture'} ".
                        "$section $subsection $data{'priority'} $data{'version'} $sdescr\000";
                $sources_packages{$src} .=
-                       "$data{'package'} $data{'architecture'} $data{'version'}\000";
+                       "$suite $data{'package'} $data{'version'} $data{'architecture'}\000";
        }
 
        untie %packages_all_db;
        }
 
        untie %packages_all_db;
index 4a419058c93e647f2154409d00c69174ec9df47b..77c7da542d6ec564b5b304124dc3ea6c1221a398 100755 (executable)
 
 use strict;
 
 
 use strict;
 
+my $what = $ARGV[0] ? "non-free" : "*";
+
 use DB_File;
 use DB_File;
+my %sources_small = ();
 
 my @suites = ('oldstable', 'stable', 'testing', 'unstable', 'experimental');
 
 
 my @suites = ('oldstable', 'stable', 'testing', 'unstable', 'experimental');
 
@@ -34,7 +37,7 @@ for my $suite (@suites) {
        tie %sources_all_db, "DB_File", "sources_all_$suite.db.new",
                O_RDWR|O_CREAT, 0666, $DB_BTREE
                or die "Error creating DB: $!";
        tie %sources_all_db, "DB_File", "sources_all_$suite.db.new",
                O_RDWR|O_CREAT, 0666, $DB_BTREE
                or die "Error creating DB: $!";
-       open PKG, "zcat /org/ftp.debian.org/ftp/dists/$suite/*/source/Sources.gz|";
+       open PKG, "zcat /org/ftp.debian.org/ftp/dists/$suite/$what/source/Sources.gz|";
        while (<PKG>) {
                next if /^\s*$/;
                my $data = "";
        while (<PKG>) {
                next if /^\s*$/;
                my $data = "";
@@ -50,11 +53,30 @@ for my $suite (@suites) {
                }
                $sources_all_db{"$data{'package'} $data{'version'}"}
                        = $data;
                }
                $sources_all_db{"$data{'package'} $data{'version'}"}
                        = $data;
+               my $section = 'main';
+               my $subsection = $data{section};
+               if ($data{section} && ($data{section} =~ m=/=o)) {
+                   ($section, $subsection) = split m=/=o, $data{section}, 2;
+               }
+               $sources_small{$data{'package'}} .=
+                       "$suite $section $subsection $data{'priority'} $data{'version'}\000";
        }
 
        untie %sources_all_db;
 }
 
        }
 
        untie %sources_all_db;
 }
 
+print "Writing databases...\n";
+my %sources_small_db;
+tie %sources_small_db, "DB_File", "sources_small.db.new",
+       O_RDWR|O_CREAT, 0666, $DB_BTREE
+       or die "Error creating DB: $!";
+while (my ($k, $v) = each(%sources_small)) {
+       $v =~ s/.$//s;
+       $sources_small_db{$k} = $v;
+}
+untie %sources_small_db;
+
 for my $suite (@suites) {
        rename("sources_all_$suite.db.new", "sources_all_$suite.db");
 }
 for my $suite (@suites) {
        rename("sources_all_$suite.db.new", "sources_all_$suite.db");
 }
+rename("sources_small.db.new", "sources_small.db");