File: testers

package info (click to toggle)
libberkeleydb-perl 0.66-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,996 kB
  • sloc: perl: 10,202; ansic: 6,484; makefile: 7
file content (94 lines) | stat: -rwxr-xr-x 2,450 bytes parent folder | download
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
#!env perl6

use HTTP::UserAgent;
use JSON::Fast;

my $module = 'BerkeleyDB';
my $version = '0.63';

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&#263; (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 @data = from-json($response.content)
                .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 ;

    my $summary = from-json($response.content) ;

    # say $summary<result><output><uncategorized>;

    my $text = $summary<result><output><uncategorized> // "";
    my $osname = $summary<environment><system><osname>;

# 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 / "db.h" .+? "No such file or directory"/
        {
            %reasons{$guid} = 'No db.h';
            # say "$osname: No db.h";
        }

        #  #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: other $user-url" ;
            # say $text
        }
    }
}