X-Git-Url: https://git.deb.at/?a=blobdiff_plain;ds=sidebyside;f=lib%2FPackages%2FDoShow.pm;h=5b22552f348a79906045128eb63ab589df46c331;hb=411dd86a5f305fcce69912b47f84dc16914d2da1;hp=076e11f7c3826a909ed459b412eb7a2e898c6b3f;hpb=dc1f8cc1360f5abb632e30e72753e2e132ff9290;p=deb%2Fpackages.git diff --git a/lib/Packages/DoShow.pm b/lib/Packages/DoShow.pm index 076e11f..5b22552 100644 --- a/lib/Packages/DoShow.pm +++ b/lib/Packages/DoShow.pm @@ -1,6 +1,7 @@ package Packages::DoShow; use strict; +use warnings; use POSIX; use URI::Escape; @@ -69,7 +70,7 @@ sub do_show { unless (@results || @non_results ) { fatal_error( _g( "No such package." )."
". - sprintf( _g( 'Search for the package' ), "$SEARCH_URL/$pkg" ) ); + sprintf( _g( 'Search for the package' ), make_search_url('','keywords='.uri_escape($pkg)) ) ); } else { my %all_suites; foreach (@results, @non_results) { @@ -81,7 +82,7 @@ sub do_show { if ($suite eq $_) { $$menu .= "[ $_ ] "; } else { - $$menu .= "[ $_ ] "; + $$menu .= "[ $_})."\">$_ ] "; } } $$menu .= '
'; @@ -121,6 +122,7 @@ sub do_show { debug( "Data search and merging took ".timestr($std) ) if DEBUG; my $did = $page->get_newest( 'description' ); + my @tags = split(/, /, $page->get_newest( 'tag' )); $section = $page->get_newest( 'section' ); $subsection = $page->get_newest( 'subsection' ); my $filenames = $page->get_arch_field( 'filename' ); @@ -143,20 +145,17 @@ sub do_show { $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 @menu = ( [ _g( "Distribution:" ),
 				       _g( "Overview over this suite" ),
-				       "$ROOT/$suite/",
+				       make_url("/",''),
 				       $suite ],
 				     [ _g( "Section:" ),
 				       _g( "All packages in this section" ),
-				       "$ROOT/$suite/$subsection/",
+				       make_url("$subsection/",''),
 				       $subsection ], );
-			my $source = $page->get_src('package');
 			push @menu, [ _g( "Source:" ),
 				      _g( "Source package building this package" ),
-				      "$ROOT/$suite/source/$source",
+				      make_url($source,'',{source=>'source'}),
 				      $source ] if $source;
 			$$menu .= simple_menu( @menu );
 
@@ -171,7 +170,7 @@ sub do_show {
 			$package_page .= title( $title );
 			
 			if (my $provided_by = $page->{provided_by}) {
-			    note( _g( "This is also a virtual package provided by ").join( ', ', map { "$_"  } @$provided_by) );
+			    note( _g( "This is also a virtual package provided by ").join( ', ', map { "$_"  } @$provided_by) );
 			}
 			
 			if ($suite eq "experimental") {
@@ -185,6 +184,7 @@ sub do_show {
 				  );
 			}
 			$package_page .= pdesc( $short_desc, $long_desc );
+			$package_page .= ptags( $pkg, @tags ) if @tags;
 
 			#
 			# display dependencies
@@ -228,18 +228,23 @@ sub do_show {
 			$package_page .= ""._g( "Package Size").""._g("Installed Size").""._g("Files")."\n";
 			foreach my $a ( @archs ) {
 			    $package_page .= "\n";
-			    $package_page .=  "$a\n";
 			    $package_page .= "".$versions->{$a}.""
 				if $multiple_versions;
 			    $package_page .= '';
-			    $package_page .=  floor(($sizes_deb->{$a}/102.4)+0.5)/10 . " kB";
+			    # package size
+			    $package_page .=  sprintf(_g('%.1f kB'),
+						      floor(($sizes_deb->{$a}/102.4)+0.5)/10);
 			    $package_page .= '';
-			    $package_page .=  $sizes_inst->{$a} . " kB";
+			    # installed size
+			    $package_page .=  sprintf(_g('%d kB'),
+						      $sizes_inst->{$a});
 			    $package_page .= "\n";
-			    if ( $suite ne "experimental" ) {
+			    if ( ($suite ne "experimental")
+				 && ($subsection ne 'debian-installer')) {
 				$package_page .= sprintf( "["._g( "list of files" )."]\n",
-							  "$ROOT/$suite/$encodedpkg/$a/filelist", $pkg );
+							  make_url("$encodedpkg/$a/filelist",''), $pkg );
 			    } else {
 				$package_page .= _g( "no current information" );
 			    }
@@ -262,11 +267,11 @@ sub do_show {
 
 			$$menu .= simple_menu( [ _g( "Distribution:" ),
 						 _g( "Overview over this distribution" ),
-						 "$ROOT/",
+						 make_url('/',''),
 						 $suite ],
 					       [ _g( "Section:" ),
 						 _g( "All packages in this section" ),
-						 "$ROOT/$suite/virtual/",
+						 make_url("virtual/",''),
 						 
 						 'virtual' ], );
 
@@ -304,11 +309,11 @@ sub do_show {
 
 		    $$menu .= simple_menu( [ _g( "Distribution:" ),
 					     _g( "Overview over this suite" ),
-					     "$ROOT/$suite/",
+					     make_url('/',''),
 					     $suite ],
 					   [ _g( "Section:" ),
 					     _g( "All packages in this section" ),
-					     "$ROOT/$suite/$subsection/",
+					     make_url("$subsection/",''),
 					     $subsection ],
 					   );
 		    
@@ -380,19 +385,9 @@ sub do_show {
 		    foreach( @$source_files ) {
 			my ($src_file_md5, $src_file_size, $src_file_name)
 			    = split /\s+/, $_;
-			my $src_url;
-			for ("$suite/$archive") {
-			    /security/o &&  do {
-				$src_url = $FTP_SITES{security}; last };
-			    /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 };
-			    $src_url = $FTP_SITES{us};
-			}
+			(my $server = lc $archive) =~ s/-//go; # non-US hack
+			my $src_url = $FTP_SITES{$server}
+			    || $FTP_SITES{us};
 			$src_url .= "/$source_dir/$src_file_name";
 			
 			$package_page .= "$src_file_name\n"