X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=lib%2FPackages%2FSearch.pm;h=e863717b97b2e795683a6dd8850bb8f8a84f8f07;hb=48d5454d1a9475bff05c755aed312f991dcb2aed;hp=d8d559a188929f0060f2416b81810dbafe477a53;hpb=c6b61e4d05ebeccd211fbd2bbf333ffddab3b649;p=deb%2Fpackages.git diff --git a/lib/Packages/Search.pm b/lib/Packages/Search.pm index d8d559a..e863717 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 @@ -380,12 +387,21 @@ sub read_entry_simple { my %virt = split /\01/o, $virt; debug( "read_entry_simple: key=$key, archives=". join(" ",(keys %$archives)).", suite=$suite", 1) if DEBUG; + # FIXME: not all of the 2^4=16 combinations of empty(results), + # empty(virt{suite}), empty(fb_result), empty(virt{fb_suite}) are dealt + # with correctly, but it's adequate enough for now return [ $virt{$suite} ] unless defined $result; foreach (split /\000/o, $result) { my @data = split ( /\s/o, $_, 8 ); 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} ]; }