From: Frank Lichtenheld Date: Fri, 24 Feb 2006 01:56:46 +0000 (+0000) Subject: Fix download locations for source packages X-Git-Tag: switch-to-templates~39 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=dc1f8cc1360f5abb632e30e72753e2e132ff9290;p=deb%2Fpackages.git Fix download locations for source packages Introduce fallback suites in read_entry_simple so that we can e.g. look up the dependencies for experimental in unstable --- diff --git a/lib/Packages/DoShow.pm b/lib/Packages/DoShow.pm index 7d5c16b..076e11f 100644 --- a/lib/Packages/DoShow.pm +++ b/lib/Packages/DoShow.pm @@ -145,20 +145,20 @@ sub do_show { $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 );
-
-			$$menu .= simple_menu( [ _g( "Distribution:" ),
-						 _g( "Overview over this suite" ),
-						 "$ROOT/$suite/",
-						 $suite ],
-					       [ _g( "Section:" ),
-						 _g( "All packages in this section" ),
-						 "$ROOT/$suite/$subsection/",
-						 $subsection ],
-					       [ _g( "Source:" ),
-						 _g( "Source package building this package" ),
-						 "$ROOT/$suite/source/".$page->get_src('package'),
-						 $page->get_src('package') ],
-					       );
+			my @menu = ( [ _g( "Distribution:" ),
+				       _g( "Overview over this suite" ),
+				       "$ROOT/$suite/",
+				       $suite ],
+				     [ _g( "Section:" ),
+				       _g( "All packages in this section" ),
+				       "$ROOT/$suite/$subsection/",
+				       $subsection ], );
+			my $source = $page->get_src('package');
+			push @menu, [ _g( "Source:" ),
+				      _g( "Source package building this package" ),
+				      "$ROOT/$suite/source/$source",
+				      $source ] if $source;
+			$$menu .= simple_menu( @menu );
 
 			my $v_str = $version;
 			my $multiple_versions = grep { $_ ne $version } values %$versions;
@@ -203,9 +203,6 @@ sub do_show {
 			if ( $dep_list ) {
 			    $package_page .= "
\n"; $package_page .= sprintf( "

"._g( "Other Packages Related to %s" )."

\n", $pkg ); - if ($suite eq "experimental") { - note( sprintf( _g( 'Note that the experimental distribution is not self-contained; missing dependencies are likely found in the unstable distribution.' ), "$ROOT/unstable/" ) ); - } $package_page .= pdeplegend( [ 'dep', _g( 'depends' ) ], [ 'rec', _g( 'recommends' ) ], @@ -356,10 +353,6 @@ sub do_show { if ( $dep_list ) { $package_page .= "
\n"; $package_page .= sprintf( "

"._g( "Other Packages Related to %s" )."

\n", $pkg ); - if ($suite eq "experimental") { - note( sprintf( _g( 'Note that the experimental distribution is not self-contained; missing dependencies are likely found in the unstable distribution.' ), "$ROOT/unstable/" ) ); - - } $package_page .= pdeplegend( [ 'adep', _g( 'build-depends' ) ], [ 'idep', _g( 'build-depends-indep' ) ], @@ -388,7 +381,7 @@ sub do_show { my ($src_file_md5, $src_file_size, $src_file_name) = split /\s+/, $_; my $src_url; - for ($archive) { + for ("$suite/$archive") { /security/o && do { $src_url = $FTP_SITES{security}; last }; /volatile/o && do { diff --git a/lib/Packages/HTML.pm b/lib/Packages/HTML.pm index 4aeb675..6200534 100644 --- a/lib/Packages/HTML.pm +++ b/lib/Packages/HTML.pm @@ -137,7 +137,7 @@ sub pmoreinfo { } else { foreach( @$files ) { my ($src_file_md5, $src_file_size, $src_file_name) = split /\s/o, $_; - for ($page->get_newest('archive')) { + for ("$suite/".$page->get_newest('archive')) { /security/o && do { $str .= "{security}/$src_dir/$src_file_name\">["; last }; /volatile/o && do { @@ -145,7 +145,7 @@ sub pmoreinfo { /backports/o && do { $str .= "{backports}/$src_dir/$src_file_name\">["; last }; /non-us/io && do { - $str .= "{nonus_site}/$src_dir/$src_file_name\">["; last }; + $str .= "{'non-US'}/$src_dir/$src_file_name\">["; last }; $str .= "{us}/$src_dir/$src_file_name\">["; } if ($src_file_name =~ /dsc$/) { @@ -300,8 +300,8 @@ sub print_deps { my $short_desc = $entry->[-1]; my $arch = $entry->[3]; my $archive = $entry->[1]; + my $path = $entry->[2]; if ( $short_desc ) { - my $path = $suite; if ( $is_old_pkgs ) { push @res_pkgs, dep_item( "$ROOT/$path/$p_name", $p_name, "$pkg_version$arch_str" ); diff --git a/lib/Packages/Search.pm b/lib/Packages/Search.pm index d8d559a..b2f4e2c 100644 --- a/lib/Packages/Search.pm +++ b/lib/Packages/Search.pm @@ -372,6 +372,13 @@ sub read_entry { my @non_results; read_entry_all( $hash, $key, $results, \@non_results, $opts ); } + +#FIXME: make configurable +my %fallback_suites = ( + 'stable-backports' => 'stable', + 'stable-volatile' => 'stable', + experimental => 'unstable' ); + sub read_entry_simple { my ($hash, $key, $archives, $suite) = @_; # FIXME: drop $archives @@ -386,6 +393,12 @@ sub read_entry_simple { debug( "use entry: @data", 2 ) if DEBUG && $data[1] eq $suite; return [ $virt{$suite}, @data ] if $data[1] eq $suite; } + if (my $fb_suite = $fallback_suites{$suite}) { + my $fb_result = read_entry_simple( $hash, $key, $archives, $fb_suite ); + my $fb_virt = shift(@$fb_result); + $virt{$suite} .= $fb_virt if $fb_virt; + return [ $virt{$suite}, @$fb_result ] if @$fb_result; + } return [ $virt{$suite} ]; }