1 package Packages::DoFilelist;
11 use Packages::Config qw( $DBDIR $ROOT @SUITES @ARCHIVES @SECTIONS
12 @ARCHITECTURES %FTP_SITES );
13 use Packages::I18N::Locale;
16 use Packages::Search qw( :all );
17 use Packages::Page ();
18 use Packages::SrcPage ();
20 our @ISA = qw( Exporter );
21 our @EXPORT = qw( do_filelist );
24 my ($params, $opts, $page_content) = @_;
25 my $cat = $opts->{cat};
27 if ($params->{errors}{package}) {
28 fatal_error( $cat->g( "package not valid or not specified" ) );
30 if ($params->{errors}{suite}) {
31 fatal_error( $cat->g( "suite not valid or not specified" ) );
33 if ($params->{errors}{arch}) {
34 fatal_error( $cat->g( "architecture not valid or not specified" ) );
37 my $pkg = $opts->{package};
38 my $suite = $opts->{suite}[0];
39 my $arch = $opts->{arch}[0] ||'';
40 $page_content->{pkg} = $pkg;
41 $page_content->{suite} = $suite;
42 $page_content->{arch} = $arch;
44 unless (@Packages::CGI::fatal_errors) {
45 if (tie my %contents, 'DB_File', "$DBDIR/contents/filelists_${suite}_${arch}.db",
46 O_RDONLY, 0666, $DB_BTREE) {
48 unless (exists $contents{$pkg}) {
49 fatal_error( $cat->g( "No such package in this suite on this architecture." ) );
51 my @files = unpack "L/(CC/a)", $contents{$pkg};
54 $page_content->{files} = [];
55 for (my $i=0; $i<scalar @files;) {
56 $file = substr($file, 0, $files[$i++]).$files[$i++];
57 push @{$page_content->{files}}, "/$file";
61 fatal_error( $cat->g( "Invalid suite/architecture combination" ) );