From: Frank Lichtenheld Date: Sat, 14 Apr 2007 17:47:08 +0000 (+0200) Subject: Search.pm: Fallback suites for Ubuntu X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=fbabb0938aee61956982eb95096b899e6313cf9c;p=deb%2Fpackages.git Search.pm: Fallback suites for Ubuntu Use a function+regex here because the ubuntu archive is way simpler here. --- diff --git a/lib/Packages/Search.pm b/lib/Packages/Search.pm index fdd3a3a..68020f5 100644 --- a/lib/Packages/Search.pm +++ b/lib/Packages/Search.pm @@ -100,13 +100,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) = @_; @@ -126,7 +127,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;