#
# 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:
#
#
# 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
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) = @_;
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;