source: server/trunk/web/lib/Sophie/Controller/Compat.pm @ 422

Last change on this file since 422 was 252, checked in by nanardon, 13 years ago
  • another compat fix
File size: 1.9 KB
Line 
1package Sophie::Controller::Compat;
2use Moose;
3use namespace::autoclean;
4
5BEGIN {extends 'Catalyst::Controller'; }
6
7=head1 NAME
8
9Sophie::Controller::Compat - Catalyst Controller
10
11=head1 DESCRIPTION
12
13Catalyst Controller.
14
15=head1 METHODS
16
17=cut
18
19sub viewrpm :Path('/viewrpm') :Args(0) {
20    my ($self, $c) = @_;
21    $c->res->redirect($c->uri_for('/rpms'));
22}
23
24sub viewrpms :Path('/viewrpm') :Args {
25    my ($self, $c, $pkgid, @args) = @_;
26
27    $c->res->redirect($c->uri_for('/rpms', $pkgid, @args));
28}
29
30sub rpm :Path('/rpm') :Args {
31    my ($self, $c, $dist, $rpm, @uargs) = @_;
32   
33    my @args = split(',', $dist, 3);
34    if (@args == 2) {
35        unshift(@args, '');
36    }
37    $c->forward('/distrib/exists', [ { distribution => $args[0], release =>
38            $args[1], arch => $args[2] } ]) or $c->go('/404/index');
39    $c->res->redirect($c->uri_for('/distrib', @args, 'rpms', $rpm, @uargs));
40}
41
42sub srpm :Path('/srpm') :Args {
43    my ($self, $c, $dist, $rpm, @uargs) = @_;
44   
45    my @args = split(',', $dist, 3);
46    if (@args == 2) {
47        unshift(@args, '');
48    }
49    $c->forward('/distrib/exists', [ { distribution => $args[0], release =>
50            $args[1], arch => $args[2] } ]) or $c->go('/404/index');
51    $c->res->redirect($c->uri_for('/distrib', @args, 'srpms', $rpm, @uargs));
52}
53
54# /distrib/foo,bar,baz/RPM
55sub distrib :Private {
56    my ($self, $c, $distrib, $rpm) = @_;
57
58    my @args = split(',', $distrib);
59    if (@args == 2) {
60        unshift(@args, '');
61    }
62    $c->forward('/distrib/exists', [ { distribution => $args[0], release =>
63            $args[1], arch => $args[2] } ]) or $c->go('/404/index');
64    $c->res->redirect($c->uri_for('/distrib', @args, 'rpms', $rpm));
65}
66
67=head1 AUTHOR
68
69Olivier Thauvin
70
71=head1 LICENSE
72
73This library is free software. You can redistribute it and/or modify
74it under the same terms as Perl itself.
75
76=cut
77
78__PACKAGE__->meta->make_immutable;
79
801;
Note: See TracBrowser for help on using the repository browser.