Changeset 462


Ignore:
Timestamp:
08/01/12 13:46:00 (12 years ago)
Author:
nanardon
Message:

Merge branch 'fixfile'

Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • tools/trunk/MANIFEST

    r427 r462  
    44README 
    55bin/sophie-notify 
     6bin/sophie 
    67bin/sophie-rpm 
    78bin/sophie-rpm2 
     
    1213lib/Sophie/Client/Transaction.pm 
    1314lib/Sophie/Client.pm 
     15lib/Sophie/Client/Functions/Help.pm 
    1416sophie-tools.spec.in 
    1517sysinit/sophie-notify 
  • tools/trunk/lib/Sophie/Client.pm

    r424 r462  
    66use RPC::XML; 
    77use base qw(RPC::XML::Client); 
    8 use Sophie::Client::Transaction; 
    98$RPC::XML::FORCE_STRING_ENCODING = 1; 
    109 
     
    7170} 
    7271 
    73 sub ts { 
    74     my ($self, $distrib) = @_; 
    75     return Sophie::Client::Transaction->new($self, $distrib); 
    76 } 
    77  
    78721; 
    7973 
  • web/lib/Sophie/Controller/Search.pm

    r460 r462  
    266266} 
    267267 
     268sub file_md5_rs : Private { 
     269    my ( $self, $c, $searchspec, $md5) = @_; 
     270    $searchspec ||= {}; 
     271 
     272    $md5 or return; 
     273 
     274    my $rs = $c->model('Base::Files')->search( 
     275        { 
     276            -and => [ 
     277                md5 => $md5, 
     278                ($searchspec->{content} ? { has_content => 1 } : ()), 
     279                ($searchspec->{pkgid} 
     280                    ? { 'pkgid' => { IN => $searchspec->{pkgid} } } 
     281                    : ()), 
     282            ], 
     283        }, 
     284        { 
     285            '+select' => [ 
     286                'contents is NOT NULL as has_content', 
     287                { rpmfilesmode => 'mode' }, 
     288            ], 
     289            '+as' => [ qw(has_content perm), ] 
     290        } 
     291    ); 
     292    if (exists($searchspec->{src})) { 
     293        $rs = $rs->search_related('Rpms', 
     294            { issrc => $searchspec->{src} ? 1 : 0 } 
     295        ) 
     296    } 
     297    return $c->model('BaseSearch')->apply_rpm_filter($rs, $searchspec); 
     298} 
     299 
    268300sub end : Private { 
    269301    my ($self, $c, $searchspec) = @_; 
  • web/lib/Sophie/Controller/Search/File.pm

    r147 r462  
    1818 
    1919 
    20 =head2 index 
    21  
    22 =cut 
    23  
    2420sub index :Path :Args(0) { 
    2521    my ( $self, $c ) = @_; 
     
    2723    $c->response->body('Matched Sophie::Controller::Search::File in Search::File.'); 
    2824} 
     25 
     26 
     27=head2 byname [ searchspec, Filename ] 
     28 
     29Return the list of file named C<Filename> where filename can be: 
     30 
     31=over 4 
     32 
     33=item the complete path F</usr/bin/perl> 
     34 
     35=item the basename F<perl> 
     36 
     37=item the basename with the end of the path (bin/perl). 
     38 
     39=back 
     40 
     41=cut 
    2942 
    3043sub byname : Private { 
     
    5265} 
    5366 
     67=head2 byname [ searchspec, Md5sum ] 
     68 
     69Return the list of file having content checksum equal to C<Md5sum> 
     70 
     71=cut 
     72 
     73sub bymd5 : Private { 
     74    my ( $self, $c, $searchspec, $md5) = @_; 
     75    $searchspec ||= {}; 
     76 
     77    my @col = qw(dirname basename md5 size pkgid count); 
     78    $c->stash->{column} = [ @col, qw(has_content perm user group) ]; 
     79 
     80    $c->stash->{xmlrpc} = [ 
     81       map { { $_->get_columns } } 
     82       $c->forward('/search/file_md5_rs', [ $searchspec, $md5 ])->all 
     83    ]; 
     84} 
     85 
     86sub bymd5_rpc : XMLRPCPath('bymd5') { 
     87    my ( $self, $c, $searchspec, $md5) = @_; 
     88    $searchspec ||= {}; 
     89 
     90    $c->stash->{rs} = $c->forward('/search/file_md5_rs', [ $searchspec, $md5 ]); 
     91     
     92    my @col = qw(dirname basename md5 size pkgid count); 
     93    $c->stash->{column} = [ @col, qw(has_content perm user group) ]; 
     94     
     95} 
    5496 
    5597=head1 AUTHOR 
  • web/lib/Sophie/Controller/Sources.pm

    r460 r462  
    8787        } 
    8888         
    89         $c->model('Base::Rpms') 
    90         ->search( 
    91             {  
    92                 name => $name, 
    93                 issrc => 1, 
    94                 $rpmrs 
    95                     ? (pkgid => { IN => $rpmrs->get_column('pkgid')->as_query },) 
    96                     : (), 
    97             }, 
    98             { 
    99                 select => [ 'evr' ], 
    100             } 
    101         )->search_related('SrcFiles')->search( 
     89        $c->model('Base::SrcFiles')->search( 
    10290            { 
    10391                has_content => 1, 
    10492                basename => $filename, 
     93                ($rpmrs 
     94                    ? ('me.pkgid' => { IN => $rpmrs->get_column('pkgid')->as_query },) 
     95                    : ()), 
     96                ($name 
     97                    ? ('me.pkgid' => { IN => $c->model('Base::Rpms')->search( 
     98                                { name => $name }, { select => ['Rpms.pkgid'] }) 
     99                                ->get_column('pkgid')->as_query }) 
     100                    : ()), 
    105101            }, 
    106102            { 
    107                     '+columns' => [ qw(me.evr) ], 
     103                    '+columns' => [ qw(Rpms.evr) ], 
    108104                    order_by => [ 'evr using >>' ], 
     105                    join => [ 'Rpms' ], 
    109106            } 
    110107        )->all ]; 
Note: See TracChangeset for help on using the changeset viewer.