X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=lib%2FPackages%2FDoDownload.pm;h=89da639639cad7ced9e5f9352b2e191aeb6856a4;hb=a38d98d27880c8fc0f4d98646e318ecc1d39884f;hp=9cf75f51ba1103255fc8132a91576c8cdc776a61;hpb=ef769eaccb9ebf7f49b8c3240c9c4d6980072ee5;p=deb%2Fpackages.git
diff --git a/lib/Packages/DoDownload.pm b/lib/Packages/DoDownload.pm
index 9cf75f5..89da639 100644
--- a/lib/Packages/DoDownload.pm
+++ b/lib/Packages/DoDownload.pm
@@ -5,13 +5,14 @@ use warnings;
use CGI ();
use DB_File;
-use Benchmark;
+use Benchmark ':hireswallclock';
use Exporter;
use Deb::Versions;
+use Packages::I18N::Locale;
use Packages::HTML ();
use Packages::Search qw( :all );
-use Packages::Config qw( $HOME $DBDIR @SUITES @ARCHIVES @SECTIONS @ARCHITECTURES );
+use Packages::Config qw( $HOME $DBDIR @SUITES @ARCHIVES @SECTIONS @ARCHITECTURES $SEARCH_URL );
use Packages::CGI;
use Packages::DB;
@@ -132,7 +133,12 @@ our @kfreebsd_european_sites = (
"kfreebsd-gnu.debian.net/debian",
"ftp.easynet.be/ftp/gnuab/debian",
"ftp.de.debian.org/debian-kfreebsd",
+ "ftp.sh.cvut.cz/MIRRORS/debian-non-linux",
+ "ftp.eila.jussieu.fr/pub/Debian-gnuab",
);
+my @kfreebsd_asian_sites = (
+ "ftp.citkit.ru/pub/HURD/debian",
+ );
our @nonus_north_american_sites = (
# "ftp.ca.debian.org/debian-non-US",
"debian.yorku.ca/debian/non-US",
@@ -192,26 +198,27 @@ our %arches = (
s390 => 'IBM S/390',
"hurd-i386" => 'Hurd (i386)',
amd64 => 'AMD64',
- "kfreebsd-i386" => 'GNU/kFreeBSD (i386)'
+ "kfreebsd-i386" => 'GNU/kFreeBSD (i386)',
+ "kfreebsd-amd64" => 'GNU/kFreeBSD (amd64)'
);
sub do_download {
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 ($params->{errors}{arch}) {
- fatal_error( "arch not valid or not specified" );
+ fatal_error( _g( "architecture not valid or not specified" ) );
}
if (@{$opts->{suite}} > 1) {
- fatal_error( "more than one suite specified for download (@{$opts->{suite}})" );
+ fatal_error( sprintf( _g( "more than one suite specified for download (%s)" ), "@{$opts->{suite}}" ) );
}
if (@{$opts->{arch}} > 1) {
- fatal_error( "more than one architecture specified for download (@{$opts->{arch}})" );
+ fatal_error( sprintf( _g( "more than one architecture specified for download (%s)" ), "@{$opts->{arch}}" ) );
}
$opts->{h_sections} = { map { $_ => 1 } @SECTIONS };
@@ -223,8 +230,6 @@ sub do_download {
my (@results);
my ($final_result, $file, $filen, $md5sum, @file_components, $archive) = ("")x5;
- sub gettext { return $_[0]; };
-
my $st0 = new Benchmark;
unless (@Packages::CGI::fatal_errors) {
tie %packages_all, 'DB_File', "$DBDIR/packages_all_$suite.db",
@@ -233,9 +238,10 @@ sub do_download {
read_entry( \%packages, $pkg, \@results, $opts );
+ @results = grep { $_->[7] ne 'v' } @results;
unless (@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 $final_result = shift @results;
foreach (@results) {
@@ -244,6 +250,7 @@ sub do_download {
}
}
+ debug( "final_result=@$final_result", 1 );
$archive = $final_result->[1];
my %data = split /\000/, $packages_all{"$pkg $arch $final_result->[7]"};
$file = $data{filename};
@@ -254,139 +261,97 @@ sub do_download {
}
}
- my $arch_string = $arch ne 'all' ? "on $arches{$arch} machines" : "";
-
- %$html_header = ( title => "Package Download Selection",
- lang => "en",
+ %$html_header = ( title => _g( "Package Download Selection" ),
+ lang => $opts->{lang},
print_title => 1 );
if ($file) {
- $$page_content .= "
You can download the requested file from the "; - $$page_content .= join( '/', @file_components).'/'; - $$page_content .= " subdirectory at"; - $$page_content .= $archive ne 'security' ? " any of these sites:" : ":"; - $$page_content .= "
\n"; + if ($arch ne 'all') { + $$page_content .= '".sprintf( _g( 'You can download the requested file from the %s subdirectory at any of these sites:' ), $directory )."
\n"; + } else { + $$page_content .= "".sprintf( _g( 'You can download the requested file from the %s subdirectory at:' ), $directory )."
\n"; + } + + hint(sprintf(_g("If you are running Debian, it's strongly suggested to use a + package manager like aptitude or synaptic to download and install + packages, instead of doing so manually via this website."), + make_url('aptitude','',{arch=>undef}), + make_url('synaptic','',{arch=>undef}) ) ); if ($archive eq 'security') { - $$page_content .= <Debian security updates are currently officially distributed only via - security.debian.org.
-END -; - } elsif ($arch eq 'amd64') { + $$page_content .= ""; + $$page_content .= ''._g( 'Debian security updates are currently officially distributed only via security.debian.org.' ).'
'; + } elsif ($archive eq 'amd64') { - $$page_content .= print_links( "North America", $file, @amd64_north_american_sites ); - $$page_content .= print_links( "Europe", $file, @amd64_european_sites ); -# $$page_content .= print_links( "Australia and New Zealand", $file, -# @nonus_australian_sites ); - $$page_content .= print_links( "Asia", $file, @amd64_asian_sites ); -# $$page_content .= print_links( "South America", $file, @nonus_south_american_sites ); + $$page_content .= print_links( _g( "North America" ), $file, @amd64_north_american_sites ); + $$page_content .= print_links( _g( "Europe" ), $file, @amd64_european_sites ); + $$page_content .= print_links( _g( "Asia" ), $file, @amd64_asian_sites ); - $$page_content .= <'._g( 'Note that AMD64 is not officialy included in the Debian archive yet, but the AMD64 porter group keeps their archive in sync with the official archive as close as possible. See the AMD64 ports page for current information.' ).'
'; + } elsif ($archive eq 'kfreebsd') { - $$page_content .= print_links( "North America", $file, @kfreebsd_north_american_sites ); - $$page_content .= print_links( "Europe", $file, @kfreebsd_european_sites ); -# $$page_content .= print_links( "Australia and New Zealand", $file, -# @nonus_australian_sites ); -# $$page_content .= print_links( "Asia", $file, @amd64_asian_sites ); -# $$page_content .= print_links( "South America", $file, @nonus_south_american_sites ); + $$page_content .= print_links( _g( "North America" ), $file, @kfreebsd_north_american_sites ); + $$page_content .= print_links( _g( "Europe" ), $file, @kfreebsd_european_sites ); + $$page_content .= print_links( _g( "Asia" ), $file, @kfreebsd_asian_sites ); - $$page_content .= <'._g( 'Note that GNU/kFreeBSD is not officialy included in the Debian archive yet, but the GNU/kFreeBSD porter group keeps their archive in sync with the official archive as close as possible. See the GNU/kFreeBSD ports page for current information.' ).'
'; } elsif ($archive eq 'non-US') { - $$page_content .= print_links( "North America", $file, @nonus_north_american_sites ); - $$page_content .= print_links( "Europe", $file, @nonus_european_sites ); - $$page_content .= print_links( "Australia and New Zealand", $file, - @nonus_australian_sites ); - $$page_content .= print_links( "Asia", $file, @nonus_asian_sites ); - $$page_content .= print_links( "South America", $file, @nonus_south_american_sites ); - - $$page_content .= <'.sprintf( _g('If none of the above sites are fast enough for you, please see our complete mirror list.' ), 'http://www.debian.org/mirror/list-non-US' ).'
'; } elsif ($archive eq 'backports') { -# $$page_content .= print_links( "North America", $file, @nonus_north_american_sites ); $$page_content .= ''.sprintf( _g( 'If none of the above sites are fast enough for you, please see our complete mirror list.'), 'http://www.backports.org/debian/README.mirrors.html' ).'
'; } elsif ($archive eq 'volatile') { -# $$page_content .= print_links( "North America", $file, @nonus_north_american_sites ); - $$page_content .=_links( "Europe", $file, @volatile_european_sites ); -# $$page_content .= print_links( "Australia and New Zealand", $file, -# @nonus_australian_sites ); -# $$page_content .= print_links( "Asia", $file, @nonus_asian_sites ); -# $$page_content .= print_links( "South America", $file, @nonus_south_american_sites ); + $$page_content .= print_links( _g( "Europe" ), $file, @volatile_european_sites ); - $$page_content .= <'.sprintf( _g( 'If none of the above sites are fast enough for you, please see our complete mirror list.' ), 'http://volatile.debian.net/mirrors.html' ).'
'; } elsif ($archive eq 'us') { $$page_content .= ''.sprintf( _g( 'If none of the above sites are fast enough for you, please see our complete mirror list.' ), 'http://www.debian.org/mirror/list' ).'
'; } - $$page_content .= <The MD5sum for $filen is $md5sum
\n" - if $md5sum; + $$page_content .= ''._g( 'Note that in some browsers you will need to tell your browser you want the file saved to a file. For example, in Firefox or Mozilla, you should hold the Shift key when you click on the URL.' ).'
'; + $$page_content .= "".sprintf( _g( 'The MD5sum for %s is %s' ), $filen, $md5sum ).'
' + if $md5sum; } }