2 # Convert Sources.gz files into Sleepycat db files for efficient usage of
7 # Copyright (C) 2006 Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 my @suites = ('oldstable', 'stable', 'testing', 'unstable', 'experimental');
30 for my $suite (@suites) {
32 print "Reading $suite...\n";
34 tie %sources_all_db, "DB_File", "sources_all_$suite.db.new",
35 O_RDWR|O_CREAT, 0666, $DB_BTREE
36 or die "Error creating DB: $!";
37 open PKG, "zcat /org/ftp.debian.org/ftp/dists/$suite/*/source/Sources.gz|";
44 while (/^(\S+):\s*(.*)\s*$/mg) {
45 my ($key, $value) = ($1, $2);
46 $value =~ s/\377/\n /g;
47 $data .= "$key: $value\n";
48 $key =~ tr [A-Z] [a-z];
51 $sources_all_db{"$data{'package'} $data{'version'}"}
55 untie %sources_all_db;
58 for my $suite (@suites) {
59 rename("sources_all_$suite.db.new", "sources_all_$suite.db");