From fbabb0938aee61956982eb95096b899e6313cf9c Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Sat, 14 Apr 2007 19:47:08 +0200 Subject: [PATCH] Search.pm: Fallback suites for Ubuntu Use a function+regex here because the ubuntu archive is way simpler here. --- lib/Packages/Search.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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; -- 2.39.2