Commit 90e47d785b509dbe7b89b05318e966a2e72bd561

Authored by Athos
1 parent 3e4616c3
Exists in master

Fix download_specs()

This subroutine used to depend on the %info hash or on Copr downloaded
JSON files, now it just uses Copr::Api to fetch the data it needs
Showing 1 changed file with 2 additions and 8 deletions   Show diff stats
lib/CoprStatus.pm
@@ -25,18 +25,12 @@ sub git_url { @@ -25,18 +25,12 @@ sub git_url {
25 25
26 sub download_specs { 26 sub download_specs {
27 my ( $branch, $user, $repo ) = @_; 27 my ( $branch, $user, $repo ) = @_;
28 - return unless -e "data/copr/$user/$repo/monitor.json";  
29 my $ua = LWP::UserAgent->new; 28 my $ua = LWP::UserAgent->new;
30 $ua->timeout(300); 29 $ua->timeout(300);
31 $ua->env_proxy; 30 $ua->env_proxy;
32 $ua->ssl_opts(SSL_verify_mode => 0x00); 31 $ua->ssl_opts(SSL_verify_mode => 0x00);
33 - open(my $fh, "<", "data/copr/$user/$repo/monitor.json") or die;  
34 - my $result = do { local $/; <$fh> };  
35 - close($fh);  
36 - my $json = JSON->new->allow_nonref;  
37 - my $dec_result = $json->decode($result);  
38 - foreach(@{$dec_result->{'packages'}}) {  
39 - my $package = $_->{'pkg_name'}; 32 + my %latest_packages = Copr::Api::get_latest_packages($user, $repo);
  33 + foreach my $package (keys %latest_packages) {
40 my $git_url = git_url($config->{GitDomain}, 34 my $git_url = git_url($config->{GitDomain},
41 $config->{GitSpecPath}, 35 $config->{GitSpecPath},
42 $branch, $package); 36 $branch, $package);