]> git.deb.at Git - deb/packages.git/blobdiff - cgi-bin/dispatcher.pl
fun with module name differences between sarge and etch
[deb/packages.git] / cgi-bin / dispatcher.pl
index 22fc691c84dd33185ccb8bb69d5cacc805462aea..04d5acb74273f5aabc30a916d9cce450a8f84558 100755 (executable)
@@ -77,7 +77,7 @@ my $source = 0;
 if (my $path = $input->path_info() || $input->param('PATH_INFO')) {
     my @components = grep { $_ } map { lc $_ } split /\/+/, $path;
 
-    push @components, 'index' if $path =~ m,/$,;
+    push @components, 'index' if @components && $path =~ m,/$,;
 
     my %LANGUAGES = map { $_ => 1 } @LANGUAGES;
     if (@components > 0 and $LANGUAGES{$components[0]}) {
@@ -118,6 +118,7 @@ if (my $path = $input->path_info() || $input->param('PATH_INFO')) {
        my %params_set;
        sub set_param_once {
            my ($cgi, $params_set, $key, $val) = @_;
+           debug("set_param_once key=$key val=$val",4) if DEBUG;
            if ($params_set->{$key}++) {
                fatal_error( sprintf( _g( "%s set more than once in path" ), $key ) );
            } else {
@@ -129,6 +130,7 @@ if (my $path = $input->path_info() || $input->param('PATH_INFO')) {
        foreach (reverse @components) {
            $need_pkg = !@pkg
                && ($what_to_do !~ /^(index|allpackages|newpkg)$/);
+           debug("need_pkg=$need_pkg component=$_",4) if DEBUG;
            if (!$need_pkg && $SUITES{$_}) {
                set_param_once( $input, \%params_set, 'suite', $_);
            } elsif (!$need_pkg && (my $s = $SUITES_ALIAS{$_})) {
@@ -139,6 +141,8 @@ if (my $path = $input->path_info() || $input->param('PATH_INFO')) {
                set_param_once( $input, \%params_set, 'archive', $_);
            } elsif (!$need_pkg && $sections_descs{$_}) {
                set_param_once( $input, \%params_set, 'subsection', $_);
+           } elsif (!$need_pkg && ($_ eq 'non-us')) { # non-US hack
+               set_param_once( $input, \%params_set, 'subsection', 'non-US');
            } elsif (!$need_pkg && ($_ eq 'source')) {
                set_param_once( $input, \%params_set, 'source', 1);
            } elsif ($ARCHITECTURES{$_}) {
@@ -163,14 +167,16 @@ if (my $path = $input->path_info() || $input->param('PATH_INFO')) {
 my ( $pkg, @suites, @sections, @subsections, @archives, @archs );
 
 my %params_def = ( keywords => { default => undef,
-                                match => '^\s*([-+\@\s\w\/.:]+)\s*$',
+                                array => '\s+',
+                                match => '^([-+\@\w\/.:]+)$',
                             },
                   package => { default => undef,
                                match => '^([\w.+-]+)$',
                                var => \$pkg },
-                  suite => { default => 'all', match => '^([\w-]+)$',
+                  suite => { default => 'default', match => '^([\w-]+)$',
                              array => ',', var => \@suites,
-                             replace => { all => \@SUITES } },
+                             replace => { all => \@SUITES,
+                                          default => \@SUITES } },
                   archive => { default => ($what_to_do eq 'search') ?
                                    'all' : 'default',
                                    match => '^([\w-]+)$',
@@ -192,7 +198,7 @@ my %params_def = ( keywords => { default => undef,
                   arch => { default => 'any', match => '^([\w-]+)$',
                             array => ',', var => \@archs, replace =>
                             { any => \@ARCHITECTURES } },
-                  format => { default => 'html', match => '^(\w+)$',  },
+                  format => { default => 'html', match => '^([\w.]+)$',  },
                   mode => { default => undef, match => '^(\w+)$',  },
                   );
 my %opts;
@@ -275,7 +281,6 @@ print "Total page evaluation took ".timestr($tetd)."<br>"
     if DEBUG;
 
 my $trailer = Packages::HTML::trailer( $ROOT );
-$trailer =~ s/LAST_MODIFIED_DATE/gmtime()/e; #FIXME
 print $trailer;
 
 # vim: ts=8 sw=4