[Bps-public-commit] cpan2rt branch, master, updated. 783e5ae797f7432aa3a3dd83a459be74dc387245

Dianne Skoll dianne at bestpractical.com
Fri Feb 26 08:29:06 EST 2021


The branch, master has been updated
       via  783e5ae797f7432aa3a3dd83a459be74dc387245 (commit)
      from  aed7138b92cbba5a299a5cc94bd355a846375796 (commit)

Summary of changes:
 lib/CPAN2RT.pm | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

- Log -----------------------------------------------------------------
commit 783e5ae797f7432aa3a3dd83a459be74dc387245
Author: Dianne Skoll <dianne at bestpractical.com>
Date:   Fri Feb 26 08:28:52 2021 -0500

    Pull only the fields of interest when syncing bugtrackers

diff --git a/lib/CPAN2RT.pm b/lib/CPAN2RT.pm
index bfadefd..41282b0 100644
--- a/lib/CPAN2RT.pm
+++ b/lib/CPAN2RT.pm
@@ -313,7 +313,12 @@ sub _sync_bugtracker_cpan2rt {
     require MetaCPAN::Client;
     my $mc = MetaCPAN::Client->new;
 
-    my $scroller = $mc->all('releases');
+    my $scroller = $mc->all('releases',
+                            { fields => ['distribution', 'maturity', 'status',
+                                         'resources.bugtracker.web',
+                                         'resources.bugtracker.mailto']
+                            }
+                           );
 
     unless ( defined($scroller) ) {
         die("Request to api.metacpan.org failed.\n");
@@ -325,28 +330,22 @@ sub _sync_bugtracker_cpan2rt {
 
     # Iterate the results from MetaCPAN
     while ( my $result = $scroller->next ) {
-        my $data = $result->{data};
+        my $data = $result->{fields};
 
         my $bugtracker = {};
 
         # Record data
-        my $dist   = $data->{distribution};
-        my $mailto;
-        my $web;
-        if ($data->{resources} && $data->{resources}->{bugtracker}) {
-            $mailto = $data->{resources}->{bugtracker}->{mailto};
-            $web = $data->{resources}->{bugtracker}->{web};
-        }
+        my $dist   = $data->{'distribution'};
+        my $mailto = $data->{'resources.bugtracker.mailto'};
+        my $web    = $data->{'resources.bugtracker.web'};
 
         if (!$dist) {
             #debug { "Result without distribution: " . Data::Dumper::Dumper($result) };
             next;
         }
 
-        next unless $data->{maturity};
-        next unless $data->{maturity} eq 'released';
-        next unless $data->{status};
-        next unless $data->{status} eq 'latest';
+        next unless ($data->{'maturity'} || '') eq 'released';
+        next unless ($data->{'status'}   || '') eq 'latest';
 
 
         debug { "Got '$dist' ($mailto, $web)" };

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list