- my $dbmodtime = (stat("$DBDIR/packages_small.db"))[9];
- if ($dbmodtime > $db_read_time) {
- tie %packages, 'DB_File', "$DBDIR/packages_small.db",
- O_RDONLY, 0666, $DB_BTREE
- or die "couldn't tie DB $DBDIR/packages_small.db: $!";
- tie %packages_all, 'DB_File', "$DBDIR/packages_all_$suite.db",
- O_RDONLY, 0666, $DB_BTREE
- or die "couldn't tie DB $DBDIR/packages_all_$suite.db: $!";
- tie %sources_all, 'DB_File', "$DBDIR/sources_all_$suite.db",
- O_RDONLY, 0666, $DB_BTREE
- or die "couldn't tie DB $DBDIR/sources_all_$suite.db: $!";
- tie %descriptions, 'DB_File', "$DBDIR/descriptions.db",
- O_RDONLY, 0666, $DB_BTREE
- or die "couldn't tie DB $DBDIR/descriptions.db: $!";
-
- debug( "tied databases ($dbmodtime > $db_read_time)" );
- $db_read_time = $dbmodtime;
- }
+ tie %packages_all, 'DB_File', "$DBDIR/packages_all_$suite.db",
+ O_RDONLY, 0666, $DB_BTREE
+ or die "couldn't tie DB $DBDIR/packages_all_$suite.db: $!";
+ tie %sources_all, 'DB_File', "$DBDIR/sources_all_$suite.db",
+ O_RDONLY, 0666, $DB_BTREE
+ or die "couldn't tie DB $DBDIR/sources_all_$suite.db: $!";
+
+ unless ($opts{source}) {
+ read_entry_all( \%packages, $pkg, \@results, \@non_results, \%opts );
+
+ unless (@results || @non_results ) {
+ fatal_error( "No such package".
+ "{insert link to search page with substring search}" );
+ } else {
+ unless (@results) {
+ fatal_error( "Package not available in this suite" );
+ } else {
+ for my $entry (@results) {
+ debug( join(":", @$entry), 1 );
+ my (undef, $archive, undef, $arch, $section, $subsection,
+ $priority, $version, $provided_by) = @$entry;
+
+ if ($arch ne 'virtual') {
+ my %data = split /\000/, $packages_all{"$pkg $arch $version"};
+ $data{package} = $pkg;
+ $data{architecture} = $arch;
+ $data{version} = $version;
+ $page->merge_package(\%data) or debug( "Merging $pkg $arch $version FAILED", 2 );
+ } else {
+ $page->add_provided_by([split /\s+/, $provided_by]);
+ }
+ }
+
+ unless ($page->is_virtual()) {
+ $version = $page->{newest};
+ my $source = $page->get_newest( 'source' );
+ $archive = $page->get_newest( 'archive' );
+ debug( "find source package: source=$source", 1);
+ my $src_data = $sources_all{"$archive $suite $source"};
+ $page->add_src_data( $source, $src_data )
+ if $src_data;
+
+ my $st1 = new Benchmark;
+ my $std = timediff($st1, $st0);
+ debug( "Data search and merging took ".timestr($std) );
+
+ my $encodedpkg = uri_escape( $pkg );
+ my ($v_str, $v_str_arch, $v_str_arr) = $page->get_version_string();
+ my $did = $page->get_newest( 'description' );
+ $section = $page->get_newest( 'section' );
+ $subsection = $page->get_newest( 'subsection' );
+ my $filenames = $page->get_arch_field( 'filename' );
+ my $file_md5sums = $page->get_arch_field( 'md5sum' );
+ my $archives = $page->get_arch_field( 'archive' );
+ my $sizes_inst = $page->get_arch_field( 'installed-size' );
+ my $sizes_deb = $page->get_arch_field( 'size' );
+ my @archs = sort $page->get_architectures;
+
+ # process description
+ #
+ my $desc = $descriptions{$did};
+ $short_desc = encode_entities( $1, "<>&\"" )
+ if $desc =~ s/^(.*)$//m;
+ my $long_desc = encode_entities( $desc, "<>&\"" );
+
+ $long_desc =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),<a href=\"$1\">$1</a>$3,go; # syntax highlighting -> '];
+ $long_desc =~ s/\A //o;
+ $long_desc =~ s/\n /\n/sgo;
+ $long_desc =~ s/\n.\n/\n<p>\n/go;
+ $long_desc =~ s/(((\n|\A) [^\n]*)+)/\n<pre>$1\n<\/pre>/sgo;
+# $long_desc = conv_desc( $lang, $long_desc );
+# $short_desc = conv_desc( $lang, $short_desc );