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