X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=lib%2FPackages%2FDoShow.pm;h=08eb376d236ddb237999af2258cae7048eabb64d;hb=b21dd56695db580574c998f2f9ca59e18d168c06;hp=1b6979996a639a80477fa069c01c9f9f032e6f67;hpb=e6999b858367d9d83e0fa2c32cddfd31b4416486;p=deb%2Fpackages.git
diff --git a/lib/Packages/DoShow.pm b/lib/Packages/DoShow.pm
index 1b69799..08eb376 100644
--- a/lib/Packages/DoShow.pm
+++ b/lib/Packages/DoShow.pm
@@ -11,7 +11,8 @@ use Exporter;
use Deb::Versions;
use Packages::Config qw( $DBDIR $ROOT @SUITES @ARCHIVES @SECTIONS
- @ARCHITECTURES %FTP_SITES );
+ @ARCHITECTURES %FTP_SITES $SEARCH_URL );
+use Packages::I18N::Locale;
use Packages::CGI;
use Packages::DB;
use Packages::Search qw( :all );
@@ -26,13 +27,13 @@ sub do_show {
my ($params, $opts, $html_header, $menu, $page_content) = @_;
if ($params->{errors}{package}) {
- fatal_error( "package not valid or not specified" );
+ fatal_error( _g( "package not valid or not specified" ) );
}
if ($params->{errors}{suite}) {
- fatal_error( "suite not valid or not specified" );
+ fatal_error( _g( "suite not valid or not specified" ) );
}
if (@{$opts->{suite}} > 1) {
- fatal_error( "more than one suite specified for show (@{$opts->{suite}})" );
+ fatal_error( sprintf( _g( "more than one suite specified for show (%s)" ), "@{$opts->{suite}}" ) );
}
my $pkg = $opts->{package};
@@ -51,8 +52,6 @@ sub do_show {
my $package_page = "";
my ($short_desc, $version, $section, $subsection) = ("")x5;
- sub gettext { return $_[0]; };
-
my $st0 = new Benchmark;
unless (@Packages::CGI::fatal_errors) {
tie %packages_all, 'DB_File', "$DBDIR/packages_all_$suite.db",
@@ -69,8 +68,8 @@ sub do_show {
}
unless (@results || @non_results ) {
- fatal_error( "No such package".
- "{insert link to search page with substring search}" );
+ fatal_error( _g( "No such package." )."
".
+ sprintf( _g( 'Search for the package' ), "$SEARCH_URL/$pkg" ) );
} else {
my %all_suites;
foreach (@results, @non_results) {
@@ -94,11 +93,11 @@ sub do_show {
$$menu .= '
';
unless (@results) {
- fatal_error( "Package not available in this suite" );
+ fatal_error( _g( "Package not available in this suite." ) );
} else {
unless ($opts->{source}) {
for my $entry (@results) {
- debug( join(":", @$entry), 1 );
+ debug( join(":", @$entry), 1 ) if DEBUG;
my (undef, $archive, undef, $arch, $section, $subsection,
$priority, $version, $provided_by) = @$entry;
@@ -107,7 +106,7 @@ sub do_show {
$data{package} = $pkg;
$data{architecture} = $arch;
$data{version} = $version;
- $page->merge_package(\%data) or debug( "Merging $pkg $arch $version FAILED", 2 );
+ $page->merge_package(\%data) or debug( "Merging $pkg $arch $version FAILED", 2 ) if DEBUG;
} else {
$page->add_provided_by([split /\s+/, $provided_by]);
}
@@ -117,22 +116,22 @@ sub do_show {
$version = $page->{newest};
my $source = $page->get_newest( 'source' );
$archive = $page->get_newest( 'archive' );
- debug( "find source package: source=$source", 1);
+ debug( "find source package: source=$source", 1) if DEBUG;
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) );
+ debug( "Data search and merging took ".timestr($std) ) if DEBUG;
- 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 $versions = $page->get_arch_field( 'version' );
my $sizes_inst = $page->get_arch_field( 'installed-size' );
my $sizes_deb = $page->get_arch_field( 'size' );
my @archs = sort $page->get_architectures;
@@ -152,38 +151,38 @@ sub do_show {
# $long_desc = conv_desc( $lang, $long_desc );
# $short_desc = conv_desc( $lang, $short_desc );
- $$menu .= simple_menu( [ gettext( "Distribution:" ),
- gettext( "Overview over this suite" ),
+ $$menu .= simple_menu( [ _g( "Distribution:" ),
+ _g( "Overview over this suite" ),
"$ROOT/$suite/",
$suite ],
- [ gettext( "Section:" ),
- gettext( "All packages in this section" ),
+ [ _g( "Section:" ),
+ _g( "All packages in this section" ),
"$ROOT/$suite/$subsection/",
$subsection ],
);
- my $title .= sprintf( gettext( "Package: %s (%s)" ), $pkg, $v_str );
+ my $v_str = $version;
+ my $multiple_versions = grep { $_ ne $version } values %$versions;
+ $v_str .= " (and others)" if $multiple_versions;
+ my $title .= sprintf( _g( "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( "Users of experimental packages are encouraged to contact the package maintainers directly in case of problems." ) + note( _g( "Experimental package"), + _g( "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.")."
" ); } 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." ) + note( _g( "debian-installer udeb package"), + _g( '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 ); @@ -204,14 +203,14 @@ sub do_show { if ( $dep_list ) { $package_page .= "".gettext("Architecture")." | ".gettext("Files")." | ".gettext( "Package Size")." | ".gettext("Installed Size")." | "._g("Architecture")." | "; + $package_page .= ""._g("Version")." | " + if $multiple_versions; + $package_page .= ""._g( "Package Size")." | "._g("Installed Size")." | "._g("Files")." | \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 .= " | ".$versions->{$a}." | " + if $multiple_versions; $package_page .= ''; $package_page .= floor(($sizes_deb->{$a}/102.4)+0.5)/10 . " kB"; $package_page .= ' | '; $package_page .= $sizes_inst->{$a} . " kB"; + $package_page .= " | \n"; + if ( $suite ne "experimental" ) { + $package_page .= sprintf( "["._g( "list of files" )."]\n", + "$ROOT/$suite/$encodedpkg/$a/filelist", $pkg ); + } else { + $package_page .= _g( "no current information" ); + } $package_page .= " | \n
". - gettext( "Users of experimental packages are encouraged to contact the package maintainers directly in case of problems." ) + note( _g( "Experimental package"), + _g( "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.")."
" ); } 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." ) + note( _g( "debian-installer udeb package"), + _g( 'Warning: This package is intended for the use in building debian-installer images only. Do not install it on a normal Debian system.' ) ); } my $binaries = find_binaries( $pkg, $archive, $suite, \%src2bin ); if ($binaries && @$binaries) { $package_page .= '%s | %s | %s | ", - gettext("File"), - gettext("Size (in kB)"), - gettext("md5sum") ); + $package_page .= sprintf( '
---|
%s | %s | %s | ", + _g("File"), + _g("Size (in kB)"), + _g("md5sum") ); foreach( @$source_files ) { my ($src_file_md5, $src_file_size, $src_file_name) = split /\s+/, $_; @@ -392,6 +395,7 @@ sub do_show { /volatile/o && do { $src_url = $FTP_SITES{volatile}; last }; /backports/o && do { + $src_url = $FTP_SITES{backports}; last }; /non-us/io && do { $src_url = $FTP_SITES{'non-US'}; last }; @@ -422,19 +426,19 @@ sub do_show { } # use Data::Dumper; -# debug( "Final page object:\n".Dumper($page), 3 ); +# debug( "Final page object:\n".Dumper($page), 3 ) if DEBUG; my $title = $opts->{source} ? - "Details of source package $pkg in $suite" : - "Details of package $pkg in $suite" ; + _g( "Details of source package %s in %s" ) : + _g( "Details of package %s in %s" ) ; my $title_tag = $opts->{source} ? - "Details of source package $pkg in $suite" : - "Details of package $pkg in $suite" ; - %$html_header = ( title => $title , - lang => 'en', + _g( "Details of source package %s in %s" ) : + _g( "Details of package %s in %s" ) ; + %$html_header = ( title => sprintf( $title, $pkg, $suite ) , + lang => $opts->{lang}, desc => $short_desc, keywords => "$suite, $archive, $section, $subsection, $version", - title_tag => "Details of package $pkg in $suite", + title_tag => sprintf( $title_tag, $pkg, $suite ), print_search_field => 'packages', search_field_values => { keywords => '',
---|