Fix download locations for source packages
authorFrank Lichtenheld <frank@lichtenheld.de>
Fri, 24 Feb 2006 01:56:46 +0000 (01:56 +0000)
committerFrank Lichtenheld <frank@lichtenheld.de>
Fri, 24 Feb 2006 01:56:46 +0000 (01:56 +0000)
Introduce fallback suites in read_entry_simple so that
 we can e.g. look up the dependencies for experimental in unstable

lib/Packages/DoShow.pm
lib/Packages/HTML.pm
lib/Packages/Search.pm

index 7d5c16b3e4f71b609f12f655b9634e900b6eed9c..076e11f7c3826a909ed459b412eb7a2e898c6b3f 100644 (file)
@@ -145,20 +145,20 @@ sub do_show {
                        $long_desc =~ s/(((\n|\A) [^\n]*)+)/\n<pre>$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 .= "<div id=\"pdeps\">\n";
                            $package_page .= sprintf( "<h2>"._g( "Other Packages Related to %s" )."</h2>\n", $pkg );
-                           if ($suite eq "experimental") {
-                               note( sprintf( _g( 'Note that the <strong>experimental</strong> distribution is not self-contained; missing dependencies are likely found in the <a href="%s">unstable</a> distribution.' ), "$ROOT/unstable/" ) );
-                           }
                            
                            $package_page .= pdeplegend( [ 'dep',  _g( 'depends' ) ],
                                                         [ 'rec',  _g( 'recommends' ) ],
@@ -356,10 +353,6 @@ sub do_show {
                    if ( $dep_list ) {
                        $package_page .= "<div id=\"pdeps\">\n";
                        $package_page .= sprintf( "<h2>"._g( "Other Packages Related to %s" )."</h2>\n", $pkg );
-                       if ($suite eq "experimental") {
-                           note( sprintf( _g( 'Note that the <strong>experimental</strong> distribution is not self-contained; missing dependencies are likely found in the <a href="%s">unstable</a> 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 {
index 4aeb675cae42f879356f0bdea0541d75543a8b65..620053405de9a0b6e6ff5c61ffb4549c3125ccf7 100644 (file)
@@ -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 .= "<a href=\"$env->{security}/$src_dir/$src_file_name\">["; last };
                    /volatile/o && do {
@@ -145,7 +145,7 @@ sub pmoreinfo {
                    /backports/o && do {
                        $str .= "<a href=\"$env->{backports}/$src_dir/$src_file_name\">["; last };
                    /non-us/io && do {
-                       $str .= "<a href=\"$env->{nonus_site}/$src_dir/$src_file_name\">["; last };
+                       $str .= "<a href=\"$env->{'non-US'}/$src_dir/$src_file_name\">["; last };
                    $str .= "<a href=\"$env->{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" );
index d8d559a188929f0060f2416b81810dbafe477a53..b2f4e2c700eeaf9a8b99009eb9174e81a0e37402 100644 (file)
@@ -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} ];
 }