Changeset 229
- Timestamp:
- 12/29/10 21:37:10 (13 years ago)
- Location:
- server/trunk/web
- Files:
-
- 2 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
server/trunk/web/lib/Sophie/Controller/Rpms.pm
r223 r229 67 67 } 68 68 69 sub basicinfo : XMLRPCLocal { 69 =head2 rpms.basicinfo( PKGID ) 70 71 Return a struct about basic informations about rpm having pkgid C<PKGID>. 72 73 Example of information return: 74 75 { 76 'arch' => 'x86_64', 77 'version' => '0.0.3', 78 'src' => '1', 79 'issrc' => '1', 80 'name' => 'ecap-samples', 81 'release' => '1mdv2010.2', 82 'description' => 'The sample contains three basic adapters.', 83 'pkgid' => 'aa17ce95dd816e0817da78d7af54abdb', 84 'summary' => 'Simple ecap samples', 85 'filename' => 'ecap-samples-0.0.3-1mdv2010.2.src.rpm', 86 'evr' => '0.0.3-1mdv2010.2' 87 }; 88 89 =head2 Url: /rpms/<PKGID>/basicinfo?json 90 91 Return a struct about basic informations about rpm having pkgid C<PKGID>. 92 93 Example of information return: 94 95 { 96 'arch' => 'x86_64', 97 'version' => '0.0.3', 98 'src' => '1', 99 'issrc' => '1', 100 'name' => 'ecap-samples', 101 'release' => '1mdv2010.2', 102 'description' => 'The sample contains three basic adapters.', 103 'pkgid' => 'aa17ce95dd816e0817da78d7af54abdb', 104 'summary' => 'Simple ecap samples', 105 'filename' => 'ecap-samples-0.0.3-1mdv2010.2.src.rpm', 106 'evr' => '0.0.3-1mdv2010.2' 107 }; 108 109 NB: This url works only in JSON format. 110 111 =cut 112 113 sub basicinfo :XMLRPCLocal :Chained('rpms_') :PathPart('basicinfo') :Args(0) { 70 114 my ($self, $c, $pkgid) = @_; 115 $pkgid ||= $c->stash->{pkgid}; 71 116 72 117 my $rpm = $c->model('base::Rpms')->find( … … 96 141 } 97 142 98 99 sub info : XMLRPCLocal { 143 =head2 rpms.info( PKGID ) 144 145 Like rpms.basicinfo return a struct containing single information about the request rpm. 146 147 =head2 Url: /rpms/<PKGID>/info?json 148 149 Like rpms/<PKGID>basicinfo return a struct containing single information about the request rpm. 150 151 NB: This url works only in JSON format. 152 153 =cut 154 155 sub info : XMLRPCLocal :Chained('rpms_') :PathPart('info') :Args(0) { 100 156 my ($self, $c, $pkgid) = @_; 101 157 $pkgid ||= $c->stash->{pkgid}; 102 158 103 159 my $info = $c->forward('basicinfo', [ $pkgid ]); … … 120 176 } 121 177 122 sub deps : XMLRPCLocal { 178 =head2 rpms.dependency(PKGID, DEPTYPE) 179 180 Return a list of C<DEPTYPE> dependencies for package C<PKGID> where C<DEPTYPE> 181 is one of: 182 183 =over 4 184 185 =item C<P> for Provides 186 187 =item C<R> for Requires 188 189 =item C<C> for Conflicts 190 191 =item C<O> for Obsoletes 192 193 =item C<E> for Enhanced 194 195 =item C<S> for Suggests 196 197 =back 198 199 =cut 200 201 sub xmlrpc_dependency : XMLRPCPath('dependency') { 202 my ($self, $c, @args) = @_; 203 $c->forward('dependency', [ @args ]); 204 } 205 206 =head2 Url: /rpms/<PKGID>/dependency/<DEPTYPE>?json 207 208 Return a list of C<DEPTYPE> dependencies for package C<PKGID> where C<DEPTYPE> 209 is one of: 210 211 =over 4 212 213 =item C<P> for Provides 214 215 =item C<R> for Requires 216 217 =item C<C> for Conflicts 218 219 =item C<O> for Obsoletes 220 221 =item C<E> for Enhanced 222 223 =item C<S> for Suggests 224 225 =back 226 227 =cut 228 229 sub dependency :XMLRPC :Chained('rpms_') :PathPart('dependency') :Args(1) { 123 230 my ($self, $c, $pkgid, $deptype) = @_; 231 if (!$deptype) { 232 $deptype = $pkgid; 233 $pkgid = $c->stash->{pkgid}; 234 } 124 235 125 236 $c->stash->{xmlrpc} = [ … … 263 374 $c->forward('rpms_', [ $pkgid ]); 264 375 for ($subpart || '') { 265 /^deps$/ and $c->go('alldeps', [ $pkgid, @args ]); 266 /^files$/ and $c->go('files', [ $pkgid, @args ]); 267 /^changelog$/ and $c->go('changelog', [ $pkgid, @args ]); 268 /^location$/ and $c->go('location', [ $pkgid, @args ]); 269 /^analyse$/ and $c->go('analyse', [ $pkgid, @args ]); 270 /./ and $c->go('/404/index'); # other subpart dont exists 376 /^deps$/ and $c->go('deps', [ $pkgid, @args ]); 377 /^files$/ and $c->go('files', [ $pkgid, @args ]); 378 /^changelog$/ and $c->go('changelog', [ $pkgid, @args ]); 379 /^location$/ and $c->go('location', [ $pkgid, @args ]); 380 /^basicinfo$/ and $c->go('basicinfo', [ $pkgid, @args ]); 381 /^info$/ and $c->go('info', [ $pkgid, @args ]); 382 /^analyse$/ and $c->go('analyse', [ $pkgid, @args ]); 383 /^dependency$/ and $c->go('dependency', [ $pkgid, @args ]); 384 /./ and $c->go('/404/index'); # other subpart dont exists 271 385 } 272 386 $c->stash->{rpmurl} = $c->req->path; … … 282 396 283 397 284 sub alldeps :Chained('rpms_') :PathPart('deps') :Args(0) :XMLRPCLocal {398 sub deps :Chained('rpms_') :PathPart('deps') :Args(0) :XMLRPCLocal { 285 399 my ( $self, $c, $pkgid ) = @_; 286 400 $c->stash->{rpmurl} = ($c->req->path =~ m:(.*)/[^/]+:)[0]; … … 441 555 my @deplist = map { 442 556 [ $_->{name}, $_->{sense}, $_->{evr} ] 443 } @{ $c->forward('dep s', [ $pkgid, 'R' ]) };557 } @{ $c->forward('dependency', [ $pkgid, 'R' ]) }; 444 558 445 559 $c->stash->{xmlrpc} = $c->forward( -
server/trunk/web/root/templates/html/rpms/deps.html
r228 r229 3 3 [% INCLUDE 'rpms/menu.tt' %] 4 4 5 [% INCLUDE 'rpms/ alldeps.tt' %]5 [% INCLUDE 'rpms/deps.tt' %] -
server/trunk/web/t/controller_Rpms.t
r183 r229 2 2 use warnings; 3 3 use Test::More; 4 use FindBin; 5 require "$FindBin::Bin/xml.pl"; 4 6 5 7 BEGIN { use_ok 'Catalyst::Test', 'Sophie' } … … 14 16 ok( request("/rpms/$pkgid/changelog")->is_success, 'Request a pkgid/changelog should succeed' ); 15 17 ok( request("/rpms/$pkgid/location")->is_success, 'Request a pkgid/location should succeed' ); 18 19 ok( xmlrequest_ok('rpms.basicinfo', $pkgid), 'XMLRPC rpms.basicinfo' ); 20 ok( request("/rpms/$pkgid/basicinfo?json"), "rpms/basicinfo?json" ); 21 ok( xmlrequest_ok('rpms.info', $pkgid), 'XMLRPC rpms.basicinfo' ); 22 ok( request("/rpms/$pkgid/info?json"), "rpms/basicinfo?json" ); 23 ok( xmlrequest_ok('rpms.dependency', $pkgid, 'R'), 'XMLRPC rpms.dependency' ); 24 ok( request("/rpms/$pkgid/dependency/R?json"), "rpms/dependency?json" ); 25 16 26 done_testing();
Note: See TracChangeset
for help on using the changeset viewer.