]> git.deb.at Git - deb/packages.git/blobdiff - lib/Packages/Search.pm
Merge branch 'master' of ssh://source/srv/source.djpig.de/git/packages into ubuntu...
[deb/packages.git] / lib / Packages / Search.pm
index 6c0d79997fd1fdbe0c0f43666f8417587c075314..3a204988504e95d144f23a1f5a31100883494b33 100644 (file)
@@ -1,8 +1,8 @@
 #
 # Packages::Search
 #
-# Copyright (C) 2004-2006 Frank Lichtenheld <frank@lichtenheld.de>
-# 
+# Copyright (C) 2004-2007 Frank Lichtenheld <frank@lichtenheld.de>
+#
 # The code is based on the old search_packages.pl script that
 # was:
 #
@@ -23,7 +23,7 @@
 #
 #    You should have received a copy of the GNU General Public License
 #    along with this program; if not, write to the Free Software
-#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 
 =head1 NAME
@@ -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;