-my (%pkgs, %sect, %part, %desc, %binaries);
-my (@colon, $package, $pkg_t, $section, $ver, $arch, $foo, $binaries);
-
-unless ($search_on_sources) {
- foreach my $line (@results) {
- @colon = split (/:/, $line);
- ($pkg_t, $section, $ver, $arch, $foo) = split (/ /, $#colon >1 ? $colon[1].":".$colon[2]:$colon[1], 5);
- $section =~ s,^(non-free|contrib)/,,;
- $section =~ s,^non-US.*$,non-US,,;
- my ($dist,$part,undef) = $colon[0] =~ m,.*/([^/]+)/([^/]+)/Packages-([^\.]+)\.,; #$1=stable, $2=main, $3=alpha
-
- ($package) = $pkg_t =~ m/^(.+)/; # untaint
- $pkgs{$package}{$dist}{$ver}{$arch} = 1;
- $sect{$package}{$dist}{$ver} = $section;
- $part{$package}{$dist}{$ver} = $part unless $part eq 'main';
-
- $desc{$package}{$dist}{$ver} = find_desc ($package, $dist, $part) if (! exists $desc{$package}{$dist}{$ver});
-
- }
-
- if ($format eq 'html') {
- my ($start, $end) = multipageheader( scalar keys %pkgs );
- my $count = 0;
-
- foreach my $pkg (sort keys %pkgs) {
- $count++;
- next if $count < $start or $count > $end;
- printf "<h3>Package %s</h3>\n", $pkg;
- print "<ul>\n";
- foreach $ver (@SUITES) {
- if (exists $pkgs{$pkg}{$ver}) {
- my @versions = version_sort keys %{$pkgs{$pkg}{$ver}};
- my $part_str = "";
- if ($part{$pkg}{$ver}{$versions[0]}) {
- $part_str = "[<span style=\"color:red\">$part{$pkg}{$ver}{$versions[0]}</span>]";
- }
- printf "<li><a href=\"$ROOT/%s/%s/%s\">%s</a> (%s): %s %s\n",
- $ver, $sect{$pkg}{$ver}{$versions[0]}, $pkg, $ver, $sect{$pkg}{$ver}{$versions[0]}, $desc{$pkg}{$ver}{$versions[0]}, $part_str;
-
- foreach my $v (@versions) {
- printf "<br>%s: %s\n",
- $v, join (" ", (sort keys %{$pkgs{$pkg}{$ver}{$v}}) );
- }
- print "</li>\n";
- }
- }
- print "</ul>\n";
- }
- } elsif ($format eq 'xml') {
- require RDF::Simple::Serialiser;
- my $rdf = new RDF::Simple::Serialiser;
- $rdf->addns( debpkg => 'http://packages.debian.org/xml/01-debian-packages-rdf' );
- my @triples;
- foreach my $pkg (sort keys %pkgs) {
- foreach $ver (@DISTS) {
- if (exists $pkgs{$pkg}{$ver}) {
- my @versions = version_sort keys %{$pkgs{$pkg}{$ver}};
- foreach my $version (@versions) {
- my $id = "$ROOT/$ver/$sect{$pkg}{$ver}{$version}/$pkg/$version";
- push @triples, [ $id, 'debpkg:package', $pkg ];
- push @triples, [ $id, 'debpkg:version', $version ];
- push @triples, [ $id, 'debpkg:section', $sect{$pkg}{$ver}{$version}, ];
- push @triples, [ $id, 'debpkg:suite', $ver ];
- push @triples, [ $id, 'debpkg:shortdesc', $desc{$pkg}{$ver}{$version} ];
- push @triples, [ $id, 'debpkg:part', $part{$pkg}{$ver}{$version} || 'main' ];
- foreach my $arch (sort keys %{$pkgs{$pkg}{$ver}{$version}}) {
- push @triples, [ $id, 'debpkg:architecture', $arch ];
- }
- }
+print Packages::HTML::header( title => 'Package Search Results' ,
+ lang => 'en',
+ title_tag => 'Debian Package Search Results',
+ print_title_above => 1,
+ print_search_field => 'packages',
+ search_field_values => {
+ keywords => $keyword_enc,
+ searchon => $searchon,
+ arch => $archs_enc,
+ suite => $suites_enc,
+ section => $sections_enc,
+ subword => $subword,
+ exact => $exact,
+ case => $case,
+ debug => $debug,
+ },
+ );
+print_msgs();
+print_errors();
+print_hints();
+print_debug();
+if (@results) {
+ my (%pkgs, %subsect, %sect, %archives, %desc, %binaries, %provided_by);
+
+ unless ($opts{searchon} eq 'sourcenames') {
+ foreach (@results) {
+ my ($pkg_t, $archive, $suite, $arch, $section, $subsection,
+ $priority, $version, $desc) = @$_;
+
+ my ($pkg) = $pkg_t =~ m/^(.+)/; # untaint
+ if ($arch ne 'virtual') {
+ my $real_archive;
+ if ($archive =~ /^(security|non-US)$/) {
+ $real_archive = $archive;
+ $archive = 'us';