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