X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=cgi-bin%2Fshow_package.pl;h=5eaa73f0da6b6f58f97599b94fcc4734b7b2469d;hb=24ffc8c7b59a3323dcfae1ec99685c6b672ae28a;hp=747db62ada96ee2b29bd87695a7b2255c19befd3;hpb=2c68295edf18a88ff0e5437c6f7f9a67438fd65a;p=deb%2Fpackages.git diff --git a/cgi-bin/show_package.pl b/cgi-bin/show_package.pl index 747db62..5eaa73f 100755 --- a/cgi-bin/show_package.pl +++ b/cgi-bin/show_package.pl @@ -102,7 +102,7 @@ my %params = Packages::Search::parse_params( $input, \%params_def, \%opts ); #XXX: Don't use alternative output formats yet $format = 'html'; if ($format eq 'html') { - print $input->header; + print $input->header( -charset => 'utf-8' ); } if ($params{errors}{package}) { @@ -117,7 +117,7 @@ if ($params{errors}{suite}) { $opts{h_suites} = { $suite => 1 }; $opts{h_archs} = { map { $_ => 1 } @archs }; $opts{h_sections} = { map { $_ => 1 } @sections }; -$opts{h_archives} = { map { $_ => 1 } @archives };; +$opts{h_archives} = { map { $_ => 1 } @archives }; my $DL_URL = "$pkg/download"; my $FILELIST_URL = "$pkg/files"; @@ -154,179 +154,232 @@ unless (@Packages::CGI::fatal_errors) { for my $entry (@results) { debug( join(":", @$entry), 1 ); my (undef, $archive, undef, $arch, $section, $subsection, - $priority, $version) = @$entry; + $priority, $version, $provided_by) = @$entry; - 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 ); + 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]); + } } - - $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|$)),$1$3,go; # syntax highlighting -> ']; - $long_desc =~ s/\A //o; - $long_desc =~ s/\n /\n/sgo; - $long_desc =~ s/\n.\n/\n
\n/go; - $long_desc =~ s/(((\n|\A) [^\n]*)+)/\n
$1\n<\/pre>/sgo; + 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|$)),$1$3,go; # syntax highlighting -> ']; + $long_desc =~ s/\A //o; + $long_desc =~ s/\n /\n/sgo; + $long_desc =~ s/\n.\n/\n\n/go; + $long_desc =~ s/(((\n|\A) [^\n]*)+)/\n
$1\n<\/pre>/sgo; # $long_desc = conv_desc( $lang, $long_desc ); # $short_desc = conv_desc( $lang, $short_desc ); - my %all_suites; - foreach (@results, @non_results) { - my $a = $_->[1]; - my $s = $_->[2]; - if ($a =~ /^(?:us|security|non-US)$/o) { - $all_suites{$s}++; - } else { - $all_suites{"$s/$a"}++; + my %all_suites; + foreach (@results, @non_results) { + my $a = $_->[1]; + my $s = $_->[2]; + if ($a =~ /^(?:us|security|non-US)$/o) { + $all_suites{$s}++; + } else { + $all_suites{"$s/$a"}++; + } } - } - foreach (suites_sort(keys %all_suites)) { - if (("$suite/$archive" eq $_) - || (!$all_suites{"$suite/$archive"} && ($suite eq $_))) { - $package_page .= "[ $_ ] "; - } else { - $package_page .= - "[ $_ ] "; - } - } - $package_page .= '
'; - - $package_page .= simple_menu( [ gettext( "Distribution:" ), - gettext( "Overview over this suite" ), - "$ROOT/$suite/", - $suite ], - [ gettext( "Section:" ), - gettext( "All packages in this section" ), - "$ROOT/$suite/$subsection/", - $subsection ], - ); - - my $title .= sprintf( gettext( "Package: %s (%s)" ), $pkg, $v_str ); - $title .= " ".marker( $archive ) if $archive ne 'us'; - $title .= " ".marker( $subsection ) if $subsection eq 'non-US' - and $archive ne 'non-US'; # non-US/security - $title .= " ".marker( $section ) if $section ne 'main'; - $package_page .= title( $title ); - - $package_page .= "".gettext( "Versions:" )." $v_str_arch
\n" - unless $version eq $v_str; - - if ($suite eq "experimental") { - $package_page .= note( gettext( "Experimental package"), - gettext( "Warning: This package is from the experimental distribution. That means it is likely unstable or buggy, and it may even cause data loss. If you ignore this warning and install it nevertheless, you do it on your own risk.")."". - gettext( "Users of experimental packages are encouraged to contact the package maintainers directly in case of problems." ) - ); - } - if ($subsection eq "debian-installer") { - note( gettext( "debian-installer udeb package"), - gettext( "Warning: This package is intended for the use in building debian-installer images only. Do not install it on a normal Debian system." ) - ); - } - $package_page .= pdesc( $short_desc, $long_desc ); - - # - # display dependencies - # - my $dep_list; - $dep_list = print_deps( \%packages, \%opts, $pkg, - $page->get_dep_field('depends'), - 'depends' ); - $dep_list .= print_deps( \%packages, \%opts, $pkg, - $page->get_dep_field('recommends'), - 'recommends' ); - $dep_list .= print_deps( \%packages, \%opts, $pkg, - $page->get_dep_field('suggests'), - 'suggests' ); - - if ( $dep_list ) { - $package_page .= "
\n"; - $package_page .= sprintf( "\n"; - } + if ($suite eq "experimental") { + note( gettext( "Experimental package"), + gettext( "Warning: This package is from the experimental distribution. That means it is likely unstable or buggy, and it may even cause data loss. If you ignore this warning and install it nevertheless, you do it on your own risk.")."".gettext( "Other Packages Related to %s" )."
\n", $pkg ); - if ($suite eq "experimental") { - note( gettext( "Note that the \"experimental\" distribution is not self-contained; missing dependencies are likely found in the \"unstable\" distribution." ) ); + foreach (suites_sort(keys %all_suites)) { + if (("$suite/$archive" eq $_) + || (!$all_suites{"$suite/$archive"} && ($suite eq $_))) { + $package_page .= "[ $_ ] "; + } else { + $package_page .= + "[ $_ ] "; + } } + $package_page .= '
'; + + $package_page .= simple_menu( [ gettext( "Distribution:" ), + gettext( "Overview over this suite" ), + "$ROOT/$suite/", + $suite ], + [ gettext( "Section:" ), + gettext( "All packages in this section" ), + "$ROOT/$suite/$subsection/", + $subsection ], + ); + + my $title .= sprintf( gettext( "Package: %s (%s)" ), $pkg, $v_str ); + $title .= " ".marker( $archive ) if $archive ne 'us'; + $title .= " ".marker( $subsection ) if $subsection eq 'non-US' + and $archive ne 'non-US'; # non-US/security + $title .= " ".marker( $section ) if $section ne 'main'; + $package_page .= title( $title ); - $package_page .= pdeplegend( [ 'dep', gettext( 'depends' ) ], - [ 'rec', gettext( 'recommends' ) ], - [ 'sug', gettext( 'suggests' ) ], ); + $package_page .= "".gettext( "Versions:" )." $v_str_arch
\n" + unless $version eq $v_str; + if (my $provided_by = $page->{provided_by}) { + note( gettext( "This is also a virtual package provided by ").join( ', ', map { "$_" } @$provided_by) ); + } - $package_page .= $dep_list; - $package_page .= "". + gettext( "Users of experimental packages are encouraged to contact the package maintainers directly in case of problems." ) + ); + } + if ($subsection eq "debian-installer") { + note( gettext( "debian-installer udeb package"), + gettext( "Warning: This package is intended for the use in building debian-installer images only. Do not install it on a normal Debian system." ) + ); + } + $package_page .= pdesc( $short_desc, $long_desc ); + + # + # display dependencies + # + my $dep_list; + $dep_list = print_deps( \%packages, \%opts, $pkg, + $page->get_dep_field('depends'), + 'depends' ); + $dep_list .= print_deps( \%packages, \%opts, $pkg, + $page->get_dep_field('recommends'), + 'recommends' ); + $dep_list .= print_deps( \%packages, \%opts, $pkg, + $page->get_dep_field('suggests'), + 'suggests' ); + + if ( $dep_list ) { + $package_page .= "
\n"; + $package_page .= sprintf( "\n"; + } - # - # Download package - # - my $encodedpack = uri_escape( $pkg ); - $package_page .= "".gettext( "Other Packages Related to %s" )."
\n", $pkg ); + if ($suite eq "experimental") { + note( gettext( "Note that the \"experimental\" distribution is not self-contained; missing dependencies are likely found in the \"unstable\" distribution." ) ); + } + + $package_page .= pdeplegend( [ 'dep', gettext( 'depends' ) ], + [ 'rec', gettext( 'recommends' ) ], + [ 'sug', gettext( 'suggests' ) ], ); + + $package_page .= $dep_list; + $package_page .= ""; - $package_page .= sprintf( "\n"; + + # + # more information + # + $package_page .= pmoreinfo( name => $pkg, data => $page, + opts => \%opts, + env => \%FTP_SITES, + bugreports => 1, sourcedownload => 1, + changesandcopy => 1, maintainers => 1, + search => 1 ); + } else { # unless $page->is_virtual + $short_desc = gettext( "virtual package" ); + + my %all_suites; + foreach (@results, @non_results) { + my $a = $_->[1]; + my $s = $_->[2]; + if ($a =~ /^(?:us|security|non-US)$/o) { + $all_suites{$s}++; + } else { + $all_suites{"$s/$a"}++; + } + } + foreach (suites_sort(keys %all_suites)) { + if (("$suite/$archive" eq $_) + || (!$all_suites{"$suite/$archive"} && ($suite eq $_))) { + $package_page .= "[ $_ ] "; + } else { + $package_page .= + "[ $_ ] "; + } + } + $package_page .= '".gettext( "Download %s\n" )."
", - $pkg ) ; - $package_page .= "\n"; - $package_page .= "
\n"; + $package_page .= "".gettext("Download for all available architectures")." \n"; - $package_page .= "\n"; - $package_page .= " \n"; - foreach my $a ( @archs ) { + # + # Download package + # + my $encodedpack = uri_escape( $pkg ); + $package_page .= "".gettext("Architecture")." ".gettext("Files")." ".gettext( "Package Size")." ".gettext("Installed Size")." "; + $package_page .= sprintf( "\n"; - - # - # more information - # - $package_page .= pmoreinfo( name => $pkg, data => $page, - opts => \%opts, - env => \%FTP_SITES, - bugreports => 1, sourcedownload => 1, - changesandcopy => 1, maintainers => 1, - search => 1 ); - } - } + $package_page .= "".gettext( "Download %s\n" )."
", + $pkg ) ; + $package_page .= "\n"; + $package_page .= "
\n"; - $package_page .= "".gettext("Download for all available architectures")." \n"; $package_page .= "\n"; - $package_page .= " \n"; + foreach my $a ( @archs ) { + $package_page .= "$a \n"; - $package_page .= ""; - if ( $suite ne "experimental" ) { - $package_page .= sprintf( "[".gettext( "list of files" )."]\n", - "$ROOT/$suite/$encodedpkg/$a/filelist", $pkg ); - } else { - $package_page .= gettext( "no current information" ); + $package_page .= " ".gettext("Architecture")." ".gettext("Files")." ".gettext( "Package Size")." ".gettext("Installed Size")." \n"; + $package_page .= " "; } - $package_page .= "\n$a \n"; + $package_page .= ""; + if ( $suite ne "experimental" ) { + $package_page .= sprintf( "[".gettext( "list of files" )."]\n", + "$ROOT/$suite/$encodedpkg/$a/filelist", $pkg ); + } else { + $package_page .= gettext( "no current information" ); + } + $package_page .= " \n"; #FIXME: css + $package_page .= floor(($sizes_deb->{$a}/102.4)+0.5)/10 . " kB"; + $package_page .= " \n"; #FIXME: css + $package_page .= $sizes_inst->{$a} . " kB"; + $package_page .= " \n"; #FIXME: css - $package_page .= floor(($sizes_deb->{$a}/102.4)+0.5)/10 . " kB"; - $package_page .= " \n"; #FIXME: css - $package_page .= $sizes_inst->{$a} . " kB"; - $package_page .= " \n"; - } - $package_page .= "
'; + $package_page .= simple_menu( [ gettext( "Distribution:" ), + gettext( "Overview over this distribution" ), + "$ROOT/", + $suite ], + [ gettext( "Section:" ), + gettext( "All packages in this section" ), + "$ROOT/$suite/virtual/", + + 'virtual' ], ); + + $package_page .= title( sprintf( gettext( "Virtual Package: %s" ), + $pkg ) ); + + my $policy_url = 'http://www.debian.org/doc/debian-policy/'; + note( sprintf( gettext( "This is a virtual package. See the Debian policy for a definition of virtual packages." ), + $policy_url, $policy_url )); + + $package_page .= sprintf( "".gettext( "Packages providing %s" )."
", $pkg ); + my $provided_by = $page->{provided_by}; + $package_page .= pkg_list( \%packages, \%opts, $provided_by, 'en'); + + } # else (unless $page->is_virtual) + } # else (unless @results) + } # else (unless (@results || @non_results )) } else { read_src_entry_all( \%sources, $pkg, \@results, \@non_results, \%opts ); @@ -342,8 +395,8 @@ unless (@Packages::CGI::fatal_errors) { my (undef, $archive, undef, $section, $subsection, $priority, $version) = @$entry; - my $data = $sources_all{"$pkg $version"}; - $page->merge_data($pkg, $version, $data) or debug( "Merging $pkg $version FAILED", 2 ); + my $data = $sources_all{"$archive $suite $pkg"}; + $page->merge_data($pkg, $suite, $archive, $data) or debug( "Merging $pkg $version FAILED", 2 ); } $version = $page->{version}; @@ -459,7 +512,8 @@ unless (@Packages::CGI::fatal_errors) { gettext("Size (in kB)"), gettext("md5sum") ); foreach( @$source_files ) { - my ($src_file_md5, $src_file_size, $src_file_name) = @$_; + my ($src_file_md5, $src_file_size, $src_file_name) + = split /\s+/, $_; my $src_url; for ($archive) { /security/o && do { @@ -495,8 +549,8 @@ unless (@Packages::CGI::fatal_errors) { } } -#use Data::Dumper; -#debug( "Final page object:\n".Dumper($page), 3 ); +use Data::Dumper; +debug( "Final page object:\n".Dumper($page), 3 ); my $title = $opts{source} ? "Details of source package $pkg in $suite" :