1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
#!env perl6
use HTTP::UserAgent;
use JSON::Fast;
my $module = 'Archive-Zip';
my $version = '1.64';
my $cpanTesters = 'http://api.cpantesters.org/v3/';
my $summary-url = $cpanTesters ~ "summary/{$module}/{ $version }";
my $report-url = $cpanTesters ~ "report/";
my $user-report-url = "http://www.cpantesters.org/cpan/report/";
say $summary-url;
my $ua = HTTP::UserAgent.new;
my $response = $ua.get: $summary-url ;
if $response.is-success {
# say $response.content;
} else {
die $response.status-line;
}
# {
# "date": "2020-07-24T15:14:00Z",
# "reporter": "\"Slaven Rezić (SREZIC)\" <srezic@iconmobile.net (Slaven Rezic)>",
# "osname": "freebsd",
# "dist": "BerkeleyDB",
# "guid": "b0769d86-ae25-11e9-8dc0-e4741f24ea8f",
# "grade": "pass",
# "perl": "5.26.1",
# "platform": "amd64-freebsd",
# "osvers": "10.3-release-p11",
# "version": "0.63"
# }
my $results = from-json($response.content) ;
# for $results.list -> $r
# {
# say "xx"
# }
# exit;
# say $results.elems; exit;
my %reference = $results.map: { $_.<guid> => $_} ;
my @data = $results
# .grep( *<osname> eq 'netbsd')
.grep( *<grade> eq 'fail')
.map: { .<guid> };
# say to-json @data;
my %reasons;
for @data -> $guid
{
my $url = $report-url ~ $guid;
my $user-url = $user-report-url ~ $guid;
my $response = $ua.get: $url ;
# say $response.content; exit;
my $summary = from-json($response.content) ;
# say $summary; exit;
# say $summary<result><output><uncategorized>;
my $text = $summary<result><output><uncategorized> // "";
my $osname = $summary<environment><system><osname>;
my $version = $summary<environment><system><osversion>;
$version = %reference{$guid}<osvers>;
# BerkeleyDB::db_ver $BerkeleyDB::db_ver
# say "match" if $text ~~ / "BerkeleyDB::db_ver" \s+ (\S+)/;
# my $bdb-version = $0 // "Unknown" ;
# say $bdb-version ; exit;
given $text
{
when "" { say "empty $user-url" ; exit }
# when / "at t/22_deflated_dir.t line 25" /
# {
# %reasons{$guid} = 'Fail';
# say "{ $osname } { $version }: fail line 87 ";
# }
when / "t/22_deflated_dir.t" .+ "Failed" /
{
%reasons{$guid} = 'Fail';
say "{ $osname } { $version }: fail 22_deflated_dir $user-url";
}
# # #error db.h is from Berkeley DB 1.x - need at least Berkeley DB 2.6.4
# when / "#error db.h is from Berkeley DB 1.x - need at least Berkeley DB 2.6.4" /
# {
# say "$osname: Berkeley DB 1.x $user-url"
# }
# # error db.h is from Berkeley DB 2.0-2.5 - need at least Berkeley DB 2.6.4
# when / "$osname: error db.h is from Berkeley DB 2.0-2.5 - need at least Berkeley DB 2.6.4" /
# {
# say "Have Berkeley DB 2.0-2.5 $user-url"
# }
# default
# {
# say "{ $osname } { $version } $user-url" ;
# # say $text
# }
}
}
|