- if ($params_def->{$param}{match} && defined $p_value_orig) {
- @p_value = map
- { $_ =~ m/$params_def->{$param}{match}/; $_ = $1 }
- @p_value;
- }
- @p_value = grep { defined $_ } @p_value;
-
- print "DEBUG: Value (Match) ".
- join('##',@p_value)."<br>" if $debug;
-
- unless (@p_value) {
- if (defined $params{$param}{default}) {
- @p_value = ($params{$param}{default});
- } else {
- @p_value = undef;
- $params_ret{errors}{$param} = "undef";
- next;
- }
- }
+#FIXME: make configurable
+my %fallback_suites = (
+ 'sarge-backports' => 'sarge',
+ 'sarge-volatile' => 'sarge',
+ 'etch-backports' => 'etch',
+ 'etch-volatile' => 'etch',
+ experimental => 'sid' );
+
+sub read_entry_simple {
+ my ($hash, $key, $archives, $suite) = @_;
+ # FIXME: drop $archives
+
+ my ($virt, $result) = split /\000/o, $hash->{$key} || "-\01-\0", 2;
+ my %virt = split /\01/o, $virt;
+ debug( "read_entry_simple: key=$key, archives=".
+ join(" ",(keys %$archives)).", suite=$suite", 1) if DEBUG;
+ debug( "read_entry_simple: virt=".join(" ",(%virt)), 2) if DEBUG;
+ # FIXME: not all of the 2^4=16 combinations of empty(results),
+ # empty(virt{suite}), empty(fb_result), empty(virt{fb_suite}) are dealt
+ # with correctly, but it's adequate enough for now
+ return [ $virt{$suite} ] unless defined $result;
+ foreach (split /\000/o, $result) {
+ my @data = split ( /\s/o, $_, 8 );
+ 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}) {
+ 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;
+ return [ $virt{$suite}, @$fb_result ] if @$fb_result;
+ }
+ return [ $virt{$suite} ];
+}