]> git.deb.at Git - deb/packages.git/blob - cgi-bin/search_packages.pl
e5bcae588de9ea1205dda557e7831aeae86aeea9
[deb/packages.git] / cgi-bin / search_packages.pl
1 #!/usr/bin/perl -wT
2 #
3 # search_packages.pl -- CGI interface to the Packages files on packages.debian.org
4 #
5 # Copyright (C) 1998 James Treacy
6 # Copyright (C) 2000, 2001 Josip Rodin
7 # Copyright (C) 2001 Adam Heath
8 # Copyright (C) 2004 Martin Schulze
9 # Copyright (C) 2004-2006 Frank Lichtenheld
10 #
11 # use is allowed under the terms of the GNU Public License (GPL)                              
12 # see http://www.fsf.org/copyleft/gpl.html for a copy of the license
13
14 use strict;
15 use CGI qw( -oldstyle_urls );
16 use CGI::Carp qw( fatalsToBrowser );
17 use POSIX;
18 use URI::Escape;
19 use HTML::Entities;
20 use DB_File;
21 use Benchmark;
22
23 use lib "../lib";
24
25 use Deb::Versions;
26 use Packages::Search qw( :all );
27 use Packages::HTML ();
28
29 my $thisscript = $Packages::HTML::SEARCH_CGI;
30 my $HOME = "http://www.debian.org";
31 my $ROOT = "";
32 my $SEARCHPAGE = "http://packages.debian.org/";
33 my @SUITES = qw( oldstable stable testing unstable experimental );
34 my @DISTS = @SUITES;
35 my @SECTIONS = qw( main contrib non-free );
36 my @ARCHIVES = qw( us security installer );
37 my @ARCHITECTURES = qw( alpha amd64 arm hppa hurd-i386 i386 ia64
38                         kfreebsd-i386 mips mipsel powerpc s390 sparc );
39 my %SUITES = map { $_ => 1 } @SUITES;
40 my %SECTIONS = map { $_ => 1 } @SECTIONS;
41 my %ARCHIVES = map { $_ => 1 } @ARCHIVES;
42 my %ARCHITECTURES = map { $_ => 1 } @ARCHITECTURES;
43
44 $ENV{PATH} = "/bin:/usr/bin";
45
46 # Read in all the variables set by the form
47 my $input;
48 if ($ARGV[0] eq 'php') {
49         $input = new CGI(\*STDIN);
50 } else {
51         $input = new CGI;
52 }
53
54 my $pet0 = new Benchmark;
55 # use this to disable debugging in production mode completly
56 my $debug_allowed = 1;
57 my $debug = $debug_allowed && $input->param("debug");
58 $debug = 0 if not defined($debug);
59 $Search::Param::debug = 1 if $debug > 1;
60
61 # If you want, just print out a list of all of the variables and exit.
62 print $input->header if $debug;
63 # print $input->dump;
64 # exit;
65
66 if (my $path = $input->param('path')) {
67     my @components = map { lc $_ } split /\//, $path;
68
69     foreach (@components) {
70         if ($SUITES{$_}) {
71             $input->param('suite', $_);
72         } elsif ($SECTIONS{$_}) {
73             $input->param('section', $_);
74         } elsif ($ARCHIVES{$_}) {
75             $input->param('archive', $_);
76         }elsif ($ARCHITECTURES{$_}) {
77             $input->param('arch', $_);
78         }
79     }
80 }
81
82 my %params_def = ( keywords => { default => undef, match => '^\s*([-+\@\w\/.:]+)\s*$' },
83                    suite => { default => 'stable', match => '^(\w+)$',
84                               alias => 'version', array => ',',
85                               replace => { all => \@SUITES } },
86                    case => { default => 'insensitive', match => '^(\w+)$' },
87                    official => { default => 0, match => '^(\w+)$' },
88                    use_cache => { default => 1, match => '^(\w+)$' },
89                    subword => { default => 0, match => '^(\w+)$' },
90                    exact => { default => undef, match => '^(\w+)$' },
91                    searchon => { default => 'all', match => '^(\w+)$' },
92                    section => { default => 'all', match => '^([\w-]+)$',
93                                 alias => 'release', array => ',',
94                                 replace => { all => \@SECTIONS } },
95                    arch => { default => 'any', match => '^(\w+)$',
96                              array => ',', replace =>
97                              { any => \@ARCHITECTURES } },
98                    archive => { default => 'all', match => '^(\w+)$',
99                                 array => ',', replace =>
100                                 { all => \@ARCHIVES } },
101                    format => { default => 'html', match => '^(\w+)$' },
102                    );
103 my %params = Packages::Search::parse_params( $input, \%params_def );
104
105 my $format = $params{values}{format}{final};
106 #XXX: Don't use alternative output formats yet
107 $format = 'html';
108
109 if ($format eq 'html') {
110     print $input->header;
111 } elsif ($format eq 'xml') {
112 #    print $input->header( -type=>'application/rdf+xml' );
113     print $input->header( -type=>'text/plain' );
114 }
115
116 if ($params{errors}{keywords}) {
117     print "Error: keyword not valid or missing" if $format eq 'html';
118     exit 0;
119 }
120 my $keyword = $params{values}{keywords}{final};
121 my @suites = @{$params{values}{suite}{final}};
122 my $official = $params{values}{official}{final};
123 my $use_cache = $params{values}{use_cache}{final};
124 my $case = $params{values}{case}{final};
125 my $case_bool = ( $case !~ /insensitive/ );
126 my $subword = $params{values}{subword}{final};
127 my $exact = $params{values}{exact}{final};
128 $exact = !$subword unless defined $exact;
129 my $searchon = $params{values}{searchon}{final};
130 my @sections = @{$params{values}{section}{final}};
131 my @archs = @{$params{values}{arch}{final}};
132 my $page = $params{values}{page}{final};
133 my $results_per_page = $params{values}{number}{final};
134
135 # for URL construction
136 my $suites_param = join ',', @{$params{values}{suite}{no_replace}};
137 my $sections_param = join ',', @{$params{values}{section}{no_replace}};
138 my $archs_param = join ',', @{$params{values}{arch}{no_replace}};
139
140 # for output
141 my $keyword_enc = encode_entities $keyword;
142 my $searchon_enc = encode_entities $searchon;
143 my $suites_enc = encode_entities join ', ', @{$params{values}{suite}{no_replace}};
144 my $sections_enc = encode_entities join ', ', @{$params{values}{section}{no_replace}};
145 my $archs_enc = encode_entities join ', ',  @{$params{values}{arch}{no_replace}};
146 my $pet1 = new Benchmark;
147 my $petd = timediff($pet1, $pet0);
148 print "DEBUG: Parameter evaluation took ".timestr($petd)."<br>" if $debug;
149
150 if ($format eq 'html') {
151 print Packages::HTML::header( title => 'Package Search Results' ,
152                               lang => 'en',
153                               title_tag => 'Debian Package Search Results',
154                               print_title_above => 1,
155                               print_search_field => 'packages',
156                               search_field_values => { 
157                                   keywords => $keyword_enc,
158                                   searchon => $searchon,
159                                   arch => $archs_enc,
160                                   suite => $suites_enc,
161                                   section => $sections_enc,
162                                   subword => $subword,
163                                   exact => $exact,
164                                   case => $case,
165                                   },
166                               );
167 }
168
169 # read the configuration
170 my $topdir;
171 if (!open (C, "../config.sh")) {
172     print "\nInternal Error: Cannot open configuration file.\n\n"
173 if $format eq 'html';
174     exit 0;
175 }
176 while (<C>) {
177     $topdir = $1 if (/^\s*topdir="?(.*)"?\s*$/);
178 }
179 close (C);
180
181 my $DBDIR = $topdir . "/files/db";
182 my $search_on_sources = 0;
183
184 my $st0 = new Benchmark;
185 my @results;
186 my $too_many_hits;
187 if ($searchon eq 'sourcenames') {
188     $search_on_sources = 1;
189 }
190
191 my %suites = map { $_ => 1 } @suites;
192 my %sections = map { $_ => 1 } @sections;
193 my %archs = map { $_ => 1 } @archs;
194
195 print "DEBUG: suites=@suites, sections=@sections, archs=@archs<br>" if $debug > 2;
196
197 sub read_entry {
198     my ($hash, $key, $results) = @_;
199     my $result = $hash->{$key};
200     foreach (split /\000/, $result) {
201         my @data = split ( /\s/, $_, 7 );
202         print "DEBUG: Considering entry ".join( ':', @data)."<br>" if $debug > 2;
203         if ($suites{$data[0]} && ($archs{$data[1]} || $data[1] eq 'all')
204             && $sections{$data[2]}) {
205             print "DEBUG: Using entry ".join( ':', @data)."<br>" if $debug > 2;
206             push @$results, [ $key, @data ];
207         }
208     }
209 }
210 sub read_src_entry {
211     my ($hash, $key, $results) = @_;
212     my $result = $hash->{$key};
213
214     foreach (split /\000/, $result) {
215         my @data = split ( /\s/, $_, 5 );
216         print "DEBUG: Considering entry ".join( ':', @data)."<br>" if $debug > 2;
217         if ($suites{$data[0]} && $sections{$data[1]}) {
218             print "DEBUG: Using entry ".join( ':', @data)."<br>" if $debug > 2;
219             push @$results, [ $key, @data ];
220         }
221     }
222 }
223 sub do_names_search {
224     my ($keyword, $file, $postfix_file, $read_entry) = @_;
225
226     $keyword = lc $keyword unless $case_bool;
227     
228     my $obj = tie my %packages, 'DB_File', "$DBDIR/$file", O_RDONLY, 0666, $DB_BTREE
229         or die "couldn't tie DB $DBDIR/$file: $!";
230     
231     if ($exact) {
232         &$read_entry( \%packages, $keyword, \@results );
233     } else {
234         my ($key, $prefixes) = ($keyword, '');
235         my %pkgs;
236         my $p_obj = tie my %pref, 'DB_File', "$DBDIR/$postfix_file", O_RDONLY, 0666, $DB_BTREE
237             or die "couldn't tie postfix db $DBDIR/$postfix_file: $!";
238         $p_obj->seq( $key, $prefixes, R_CURSOR );
239         while (index($key, $keyword) >= 0) {
240             if ($prefixes =~ /^\001(\d+)/o) {
241                 $too_many_hits += $1;
242             } else {
243                 foreach (split /\000/o, $prefixes) {
244                     $_ = '' if $_ eq '^';
245                     print "DEBUG: add word $_$key<br>" if $debug > 2;
246                     $pkgs{$_.$key}++;
247                 }
248             }
249             last if $p_obj->seq( $key, $prefixes, R_NEXT ) != 0;
250             last if $too_many_hits or keys %pkgs >= 100;
251         }
252         
253         my $no_results = keys %pkgs;
254         if ($too_many_hits || ($no_results >= 100)) {
255             $too_many_hits += $no_results;
256             %pkgs = ( $keyword => 1 );
257         }
258         foreach my $pkg (sort keys %pkgs) {
259             &$read_entry( \%packages, $pkg, \@results );
260         }
261     }
262 }
263
264 if ($searchon eq 'names') {
265     do_names_search( $keyword, 'packages_small.db',
266                      'package_postfixes.db', \&read_entry );
267 } elsif ($searchon eq 'sourcenames') {
268     do_names_search( $keyword, 'sources_small.db',
269                      'source_postfixes.db', \&read_src_entry );
270 } else {
271
272     my @lines;
273     my $regex;
274     if ($case_bool) {
275         if ($exact) {
276             $regex = qr/\b\Q$keyword\E\b/o;
277         } else {
278             $regex = qr/\Q$keyword\E/o;
279         }
280     } else {
281         if ($exact) {
282             $regex = qr/\b\Q$keyword\E\b/io;
283         } else {
284             $regex = qr/\Q$keyword\E/io;
285         }
286     }
287
288     open DESC, '<', "$DBDIR/descriptions.txt" or die "couldn't open $DBDIR/descriptions.txt: $!";
289     while (<DESC>) {
290         $_ =~ $regex or next;
291         print "DEBUG: Matched line $.<br>" if $debug > 2;
292         push @lines, $.;
293     }
294     close DESC;
295
296     my $obj = tie my %packages, 'DB_File', "$DBDIR/packages_small.db", O_RDONLY, 0666, $DB_BTREE
297         or die "couldn't tie DB $DBDIR/packages_small.db: $!";
298     my $obj = tie my %did2pkg, 'DB_File', "$DBDIR/descriptions_packages.db", O_RDONLY, 0666, $DB_BTREE
299         or die "couldn't tie DB $DBDIR/descriptions_packages.db: $!";
300
301     my %tmp_results;
302     foreach my $l (@lines) {
303         my $result = $did2pkg{$l};
304         foreach (split /\000/o, $result) {
305             my @data = split /\s/, $_, 3;
306             next unless $archs{$data[2]};
307             $tmp_results{$data[0]}++;
308         }
309     }
310     foreach my $pkg (keys %tmp_results) {
311         read_entry( \%packages, $pkg, \@results ); 
312     }
313 }
314
315 my $st1 = new Benchmark;
316 my $std = timediff($st1, $st0);
317 print "DEBUG: Search took ".timestr($std)."<br>" if $debug;
318
319 if ($format eq 'html') {
320     my $suite_wording = $suites_enc eq "all" ? "all suites"
321         : "suite(s) <em>$suites_enc</em>";
322     my $section_wording = $sections_enc eq 'all' ? "all sections"
323         : "section(s) <em>$sections_enc</em>";
324     my $arch_wording = $archs_enc eq 'any' ? "all architectures"
325         : "architecture(s) <em>$archs_enc</em>";
326     if (($searchon eq "names") || ($searchon eq 'sourcenames')) {
327         my $source_wording = $search_on_sources ? "source " : "";
328         my $exact_wording = $exact ? "named" : "that names contain";
329         print "<p>You have searched for ${source_wording}packages $exact_wording <em>$keyword_enc</em> in $suite_wording, $section_wording, and $arch_wording.</p>";
330     } else {
331         my $exact_wording = $exact ? "" : " (including subword matching)";
332         print "<p>You have searched for <em>$keyword_enc</em> in packages names and descriptions in $suite_wording, $section_wording, and $arch_wording$exact_wording.</p>";
333     }
334 }
335
336 if ($too_many_hits) {
337 print "<p><strong>Your search was too wide so we will only display exact matches. At least <em>$too_many_hits</em> results have been omitted and will not be displayed. Please consider using a longer keyword or more keywords.</strong></p>";
338 }
339
340 if (!@results) {
341     if ($format eq 'html') {
342         my $keyword_esc = uri_escape( $keyword );
343         my $printed = 0;
344         if (($searchon eq "names") || ($searchon eq 'sourcenames')) {
345             if (($suites_enc eq 'all')
346                 && ($archs_enc eq 'any')
347                 && ($sections_enc eq 'all')) {
348                 print "<p><strong>Can't find that package.</strong></p>\n";
349             } else {
350                 print "<p><strong>Can't find that package, at least not in that suite ".
351                     ( $search_on_sources ? "" : " and on that architecture" ).
352                     ".</strong></p>\n";
353             }
354             
355             if ($exact) {
356                 $printed = 1;
357                 print "<p>You have searched only for exact matches of the package name. You can try to search for <a href=\"$thisscript?exact=0&amp;searchon=$searchon&amp;suite=$suites_param&amp;case=$case&amp;section=$sections_param&amp;keywords=$keyword_esc&amp;arch=$archs_param\">package names that contain your search string</a>.</p>";
358             }
359         } else {
360             if (($suites_enc eq 'all')
361                 && ($archs_enc eq 'any')
362                 && ($sections_enc eq 'all')) {
363                 print "<p><strong>Can't find that string.</strong></p>\n";
364             } else {
365                 print "<p><strong>Can't find that string, at least not in that suite ($suites_enc, section $sections_enc) and on that architecture ($archs_enc).</strong></p>\n";
366             }
367             
368             unless ($subword) {
369                 $printed = 1;
370                 print "<p>You have searched only for words exactly matching your keywords. You can try to search <a href=\"$thisscript?subword=1&amp;searchon=$searchon&amp;suite=$suites_param&amp;case=$case&amp;section=$sections_param&amp;keywords=$keyword_esc&amp;arch=$archs_param\">allowing subword matching</a>.</p>";
371             }
372         }
373         print "<p>".( $printed ? "Or you" : "You" )." can try a different search on the <a href=\"$SEARCHPAGE#search_packages\">Packages search page</a>.</p>";
374         
375         &printfooter;
376     }
377     exit;
378 }
379
380 my (%pkgs, %sect, %part, %desc, %binaries);
381
382 unless ($search_on_sources) {
383     foreach (@results) {
384         my ($pkg_t, $suite, $arch, $section, $subsection,
385             $priority, $version, $desc) = @$_;
386         
387         my ($package) = $pkg_t =~ m/^(.+)/; # untaint
388         $pkgs{$package}{$suite}{$version}{$arch} = 1;
389         $sect{$package}{$suite}{$version} = $subsection;
390         $part{$package}{$suite}{$version} = $section unless $section eq 'main';
391         
392         $desc{$package}{$suite}{$version} = $desc;
393
394     }
395
396     if ($format eq 'html') {
397         my ($start, $end) = multipageheader( scalar keys %pkgs );
398         my $count = 0;
399         
400         foreach my $pkg (sort keys %pkgs) {
401             $count++;
402             next if $count < $start or $count > $end;
403             printf "<h3>Package %s</h3>\n", $pkg;
404             print "<ul>\n";
405             foreach my $ver (@SUITES) {
406                 if (exists $pkgs{$pkg}{$ver}) {
407                     my @versions = version_sort keys %{$pkgs{$pkg}{$ver}};
408                     my $part_str = "";
409                     if ($part{$pkg}{$ver}{$versions[0]}) {
410                         $part_str = "[<span style=\"color:red\">$part{$pkg}{$ver}{$versions[0]}</span>]";
411                     }
412                     printf "<li><a href=\"$ROOT/%s/%s/%s\">%s</a> (%s): %s   %s\n",
413                     $ver, $sect{$pkg}{$ver}{$versions[0]}, $pkg, $ver, $sect{$pkg}{$ver}{$versions[0]}, $desc{$pkg}{$ver}{$versions[0]}, $part_str;
414                     
415                     foreach my $v (@versions) {
416                         printf "<br>%s: %s\n",
417                         $v, join (" ", (sort keys %{$pkgs{$pkg}{$ver}{$v}}) );
418                     }
419                     print "</li>\n";
420                 }
421             }
422             print "</ul>\n";
423         }
424     } elsif ($format eq 'xml') {
425         require RDF::Simple::Serialiser;
426         my $rdf = new RDF::Simple::Serialiser;
427         $rdf->addns( debpkg => 'http://packages.debian.org/xml/01-debian-packages-rdf' );
428         my @triples;
429         foreach my $pkg (sort keys %pkgs) {
430             foreach my $ver (@DISTS) {
431                 if (exists $pkgs{$pkg}{$ver}) {
432                     my @versions = version_sort keys %{$pkgs{$pkg}{$ver}};
433                     foreach my $version (@versions) {
434                         my $id = "$ROOT/$ver/$sect{$pkg}{$ver}{$version}/$pkg/$version";
435                         push @triples, [ $id, 'debpkg:package', $pkg ];
436                         push @triples, [ $id, 'debpkg:version', $version ];
437                         push @triples, [ $id, 'debpkg:section', $sect{$pkg}{$ver}{$version}, ];
438                         push @triples, [ $id, 'debpkg:suite', $ver ];
439                         push @triples, [ $id, 'debpkg:shortdesc', $desc{$pkg}{$ver}{$version} ];
440                         push @triples, [ $id, 'debpkg:part', $part{$pkg}{$ver}{$version} || 'main' ];
441                         foreach my $arch (sort keys %{$pkgs{$pkg}{$ver}{$version}}) {
442                             push @triples, [ $id, 'debpkg:architecture', $arch ];
443                         }
444                     }
445                 }
446             }
447         }
448         
449         print $rdf->serialise(@triples);
450     }
451 } else {
452     foreach (@results) {
453         my ($package, $suite, $section, $subsection, $priority,
454             $version, $binaries) = @$_;
455         
456         $pkgs{$package}{$suite} = $version;
457         $sect{$package}{$suite}{source} = $subsection;
458         $part{$package}{$suite}{source} = $section unless $section eq 'main';
459
460         $binaries{$package}{$suite} = [ sort split( /\s*,\s*/, $binaries ) ];
461     }
462
463     if ($format eq 'html') {
464         my ($start, $end) = multipageheader( scalar keys %pkgs );
465         my $count = 0;
466         
467         foreach my $pkg (sort keys %pkgs) {
468             $count++;
469             next if ($count < $start) or ($count > $end);
470             printf "<h3>Source package %s</h3>\n", $pkg;
471             print "<ul>\n";
472             foreach my $ver (@SUITES) {
473                 if (exists $pkgs{$pkg}{$ver}) {
474                     my $part_str = "";
475                     if ($part{$pkg}{$ver}{source}) {
476                         $part_str = "[<span style=\"color:red\">$part{$pkg}{$ver}{source}</span>]";
477                     }
478                     printf "<li><a href=\"$ROOT/%s/source/%s\">%s</a> (%s): %s   %s", $ver, $pkg, $ver, $sect{$pkg}{$ver}{source}, $pkgs{$pkg}{$ver}, $part_str;
479                     
480                     print "<br>Binary packages: ";
481                     my @bp_links;
482                     foreach my $bp (@{$binaries{$pkg}{$ver}}) {
483                         my $sect = 'section';
484                         
485                         my $bp_link;
486                         if ($sect) {
487                             $bp_link = sprintf( "<a href=\"$ROOT/%s/%s/%s\">%s</a>",
488                                                 $ver, $sect, uri_escape( $bp ),  $bp );
489                         } else {
490                             $bp_link = $bp;
491                         }
492                         push @bp_links, $bp_link;
493                     }
494                     print join( ", ", @bp_links );
495                     print "</li>\n";
496                 }
497             }
498             print "</ul>\n";
499         }
500     } elsif ($format eq 'xml') {
501         require RDF::Simple::Serialiser;
502         my $rdf = new RDF::Simple::Serialiser;
503         $rdf->addns( debpkg => 'http://packages.debian.org/xml/01-debian-packages-rdf' );
504         my @triples;
505         foreach my $pkg (sort keys %pkgs) {
506             foreach my $ver (@SUITES) {
507                 if (exists $pkgs{$pkg}{$ver}) {
508                     my $id = "$ROOT/$ver/source/$pkg";
509
510                     push @triples, [ $id, 'debpkg:package', $pkg ];
511                     push @triples, [ $id, 'debpkg:type', 'source' ];
512                     push @triples, [ $id, 'debpkg:section', $sect{$pkg}{$ver}{source} ];
513                     push @triples, [ $id, 'debpkg:version', $pkgs{$pkg}{$ver} ];
514                     push @triples, [ $id, 'debpkg:part', $part{$pkg}{$ver}{source} || 'main' ];
515                     
516                     foreach my $bp (@{$binaries{$pkg}{$ver}}) {
517                         push @triples, [ $id, 'debpkg:binary', $bp ];
518                     }
519                 }
520             }
521         }
522         print $rdf->serialise(@triples);
523     }
524 }
525
526 if ($format eq 'html') {
527     &printindexline( scalar keys %pkgs );
528     &printfooter;
529 }
530
531 exit;
532
533 sub printindexline {
534     my $no_results = shift;
535
536     my $index_line;
537     if ($no_results > $results_per_page) {
538         
539         $index_line = prevlink($input,\%params)." | ".
540             indexline( $input, \%params, $no_results)." | ".
541             nextlink($input,\%params, $no_results);
542         
543         print "<p style=\"text-align:center\">$index_line</p>";
544     }
545 }
546
547 sub multipageheader {
548     my $no_results = shift;
549
550     my ($start, $end);
551     if ($results_per_page =~ /^all$/i) {
552         $start = 1;
553         $end = $no_results;
554         $results_per_page = $no_results;
555     } else {
556         $start = Packages::Search::start( \%params );
557         $end = Packages::Search::end( \%params );
558         if ($end > $no_results) { $end = $no_results; }
559     }
560
561     print "<p>Found <em>$no_results</em> matching packages,";
562     if ($end == $start) {
563         print " displaying package $end.</p>";
564     } else {
565         print " displaying packages $start to $end.</p>";
566     }
567
568     printindexline( $no_results );
569
570     if ($no_results > 100) {
571         print "<p>Results per page: ";
572         my @resperpagelinks;
573         for (50, 100, 200) {
574             if ($results_per_page == $_) {
575                 push @resperpagelinks, $_;
576             } else {
577                 push @resperpagelinks, resperpagelink($input,\%params,$_);
578             }
579         }
580         if ($params{values}{number}{final} =~ /^all$/i) {
581             push @resperpagelinks, "all";
582         } else {
583             push @resperpagelinks, resperpagelink($input, \%params,"all");
584         }
585         print join( " | ", @resperpagelinks )."</p>";
586     }
587     return ( $start, $end );
588 }
589
590 sub printfooter {
591 print <<END;
592 </div>
593
594 <hr class="hidecss">
595 <p style="text-align:right;font-size:small;font-stlye:italic"><a href="$SEARCHPAGE">Packages search page</a></p>
596
597 </div>
598 END
599
600 my $pete = new Benchmark;
601 my $petd = timediff($pete, $pet0);
602 print "Total page evaluation took ".timestr($petd)."<br>"
603     if $debug_allowed;
604 print $input->end_html;
605 }
606
607 # vim: ts=8 sw=4