Changeset 168


Ignore:
Timestamp:
12/21/10 20:23:08 (13 years ago)
Author:
nanardon
Message:
  • add rpms.maintainers function
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Rpms.pm

    r123 r168  
    3131} 
    3232 
    33 =head2 rpms.queryformat PKGID, FORMAT 
     33=head2 rpms.queryformat( PKGID, FORMAT ) 
    3434 
    3535Perform an C<rpm -q --qf> on the package having C<PKGID>. 
     
    4949} 
    5050 
    51 =head2 rpms.tag PKGID, TAG 
     51=head2 rpms.tag( PKGID, TAG ) 
    5252 
    5353Return the list of C<TAG> values for package C<PKGID> 
     
    185185    )->get_column('pkgid')->all ]; 
    186186 
     187} 
     188 
     189 
     190=head2 rpms.maintainers( PKGID ) 
     191 
     192Return the maintainers for this package. 
     193 
     194The list of maintainers is limited to distribution where the package is located. 
     195 
     196If the package is a binary the C<SOURCERPM> tag is used to find the source rpm 
     197name. 
     198 
     199=cut 
     200 
     201sub maintainers : XMLRPCLocal { 
     202    my ($self, $c, $pkgid) = @_; 
     203 
     204    my $binfo = $c->forward('/rpms/basicinfo', [ $pkgid ]); 
     205    my $rpmname; 
     206    if ($binfo->{issrc}) { 
     207        $rpmname = $binfo->{name}; 
     208    } else { 
     209        my $sourcerpm = $c->forward('queryformat', [ $pkgid, '%{SOURCERPM}' ]); 
     210        $sourcerpm =~ /^(.*)-([^-]+)-([^-]+)\.[^\.]+.rpm$/; 
     211        $rpmname = $1; 
     212    } 
     213    my %dist; 
     214    foreach (@{ $c->forward('/rpms/location', [ $pkgid ]) }) { 
     215        $dist{$_->{distribution}} = 1; 
     216    } 
     217 
     218    $c->forward('/maintainers/byrpm', [ $rpmname, [ keys %dist ] ]); 
    187219} 
    188220 
     
    335367} 
    336368 
    337 =head2 rpms.location (PKGID) 
     369=head2 rpms.location( PKGID ) 
    338370 
    339371Return all distribution where the package having C<PKGID> can be found. 
Note: See TracChangeset for help on using the changeset viewer.