X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=lib%2FPackages%2FSearch.pm;h=3a204988504e95d144f23a1f5a31100883494b33;hb=2ba8772e72ef20f2486e86194c5862212a99ccbf;hp=ebb1b7d8f1e025ec4d5b48ab8b08877547e0126c;hpb=d833a5eed5296d1a24c35e8f0802f8291037198d;p=deb%2Fpackages.git diff --git a/lib/Packages/Search.pm b/lib/Packages/Search.pm index ebb1b7d..3a20498 100644 --- a/lib/Packages/Search.pm +++ b/lib/Packages/Search.pm @@ -101,13 +101,14 @@ sub read_entry { read_entry_all( $hash, $key, $results, \@non_results, $opts ); } -#FIXME: make configurable -my %fallback_suites = ( - 'oldstable-backports' => 'oldstable', - 'oldstable-volatile' => 'oldstable', - 'stable-backports' => 'stable', - 'stable-volatile' => 'stable', - experimental => 'unstable' ); +sub fallback_suite { + my $suite = shift; + if ($suite =~ /^(\S+)-(?:updates|backports)/) { + return $1; + } else { + return undef; + } +} sub read_entry_simple { my ($hash, $key, $archives, $suite) = @_; @@ -127,7 +128,7 @@ 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}) { + if (my $fb_suite = fallback_suite($suite)) { my $fb_result = read_entry_simple( $hash, $key, $archives, $fb_suite ); my $fb_virt = shift(@$fb_result); $virt{$suite} .= $virt{$suite} ? " $fb_virt" : $fb_virt if $fb_virt;