| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | ctgetreports - Quickly fetch cpantesters results with all reports | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | ctgetreports [options] distroname | ||||||||||||||||||||||||||||
| 10 | ctgetreports [options] --report number ... | ||||||||||||||||||||||||||||
| 11 | ctgetreports [options] --reportfiles path ... | ||||||||||||||||||||||||||||
| 12 | ctgetreports -h | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =head1 OPTIONS | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | A distroname is unversioned, e.g. C<IPC-Run>. For versioned names as | ||||||||||||||||||||||||||||
| 17 | in C<IPC-Run-0.80> see C<--vdistro>. | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =over 2 | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =cut | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 2 | my $optpod = <<'=back'; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =item B<--cachedir=s> | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | Directory to keep mirrored data in. Defaults to | ||||||||||||||||||||||||||||
| 28 | C<$HOME/var/cpantesters>. This directory will get populated by | ||||||||||||||||||||||||||||
| 29 | CPAN::Testers::ParseReport with two subdirectories | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | directory contains | ||||||||||||||||||||||||||||
| 32 | ---------------------------------- | ||||||||||||||||||||||||||||
| 33 | cpantesters-show/ data by distro | ||||||||||||||||||||||||||||
| 34 | nntp-testers/ reports | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =item B<--ctdb=s> | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | If you have your own copy of the cpan testers I<cpanstats> database | ||||||||||||||||||||||||||||
| 39 | you can use this to set the path to the database. Must not be used | ||||||||||||||||||||||||||||
| 40 | together with C<--cturl>. Requires | ||||||||||||||||||||||||||||
| 41 | C<CPAN::WWW::Testers::Generator::Database> and C<CPAN::DistnameInfo> | ||||||||||||||||||||||||||||
| 42 | installed. | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =item B<--cturl=s> | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | Base URL of the cpantesters API. Defaults to | ||||||||||||||||||||||||||||
| 47 | C<https://api.cpantesters.org>. | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =item B<--distrotransport=s> | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | Specifies transport to get the distro-data. Defaults to C<ctjson>. | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | C<ctjson> uses C<cturl> and downloads whole files. | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | C<ndjson> uses C<ndjsonurl> and downloads increments to append to existing files. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =item B<--dumpfile=s> | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | If dumpvars are specified, dump them into this file. Defaults to "ctgetreports.out". | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =item B<--dumpvars=s> | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | Dump all queryable variables matching the regular expression given as | ||||||||||||||||||||||||||||
| 64 | argument at the end of the loop for a distro. | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =item B<--filtercb=s> | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | A callback that is called at the end of parse_report(). It allows to | ||||||||||||||||||||||||||||
| 69 | manipulate the result, e.g. change the resulting values or add | ||||||||||||||||||||||||||||
| 70 | calculated values. The callback function gets a record (hashref) as | ||||||||||||||||||||||||||||
| 71 | the only argument. The return value is ignored. The callback is pure | ||||||||||||||||||||||||||||
| 72 | perl code without any surrounding sub declaration. | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | Compared to the C<--ycb> callback described below C<--filtercb> is | ||||||||||||||||||||||||||||
| 75 | considered easier to use. | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | The following example excludes reports by the user C<jack.blacksmoke> | ||||||||||||||||||||||||||||
| 78 | from regression testing: | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | ctgetreport --solve --filtercb ' | ||||||||||||||||||||||||||||
| 81 | my $rec = shift; | ||||||||||||||||||||||||||||
| 82 | $rec->{"meta:ok"}="FILTERED" if $rec->{"meta:from"} =~ /jack.blacksmoke/; | ||||||||||||||||||||||||||||
| 83 | ' String-RewritePrefix-0.005 | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | The following example excludes reports that contain the string | ||||||||||||||||||||||||||||
| 86 | C<Perl_sv_2pv_flags>: | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | ctgetreport --q "qr:Perl_sv_2pv_flags" \ | ||||||||||||||||||||||||||||
| 89 | --filtercb 'my $rec = shift; | ||||||||||||||||||||||||||||
| 90 | $rec->{"meta:ok"}="FILTERED" if $rec->{"qr:Perl_sv_2pv_flags"} | ||||||||||||||||||||||||||||
| 91 | ' --solve Text-MiniTmpl-v2.0.0 | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | =item B<--help|h> | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | Prints a brief message and exists. | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =item B<--interactive|i> | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | After every parsed report asks if you want to see it in a pager. | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | =item B<--local> | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | Do not mirror, use a local C<*.yaml> file. Dies if the YAML file | ||||||||||||||||||||||||||||
| 104 | is missing, skips missing report files. | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =item B<--minfail=i> | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | Same thing as C<--minpass> but for fail reports. | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | Default value is the value of C<--minpass>; if this is missing, no | ||||||||||||||||||||||||||||
| 111 | default applies. | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =item B<--minpass=i> | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | If C<--sample> is set, then it could happen that randomness strikes | ||||||||||||||||||||||||||||
| 116 | unluckily and the sample ends without a pass report. For the --solve | ||||||||||||||||||||||||||||
| 117 | option this would then have the consequence that it cannot succeed. By | ||||||||||||||||||||||||||||
| 118 | setting a minpass, the sample size is iteratively increased by small | ||||||||||||||||||||||||||||
| 119 | steps until the number of passes is equal to this option or higher. | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | No default. | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | If C<--sample> is not set, C<--minpass> and C<--minfail> are ignored. | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | =item B<--ndjsonurl=s> | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | Base URL to request ndjson formatted per-distro data. At the time of | ||||||||||||||||||||||||||||
| 128 | this writing no stable such URL exists yet. | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | =item B<--pager=s> | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | Pager (needed when C<-i> is given). Defaults to C<less>. | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | =item B<--parse-common-errors|pce> | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | While the C<--q qr:...> syntax ultimately offers free parsing it is | ||||||||||||||||||||||||||||
| 137 | cumbersome to use. The C<--parse-common-errors> option is a | ||||||||||||||||||||||||||||
| 138 | placeholder for a variety of frequent errors to watch. Currently it | ||||||||||||||||||||||||||||
| 139 | stands for the following additional options: | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | -q qr:(Failed test\s+\S+.*) | ||||||||||||||||||||||||||||
| 142 | -q qr:(Failed to load .*) | ||||||||||||||||||||||||||||
| 143 | -q qr:(Can't load .*) | ||||||||||||||||||||||||||||
| 144 | -q qr:((?i:.*could.?n.t find.*)) | ||||||||||||||||||||||||||||
| 145 | -q qr:(Can't locate object method .+) | ||||||||||||||||||||||||||||
| 146 | -q qr:(Can't locate \S+pm) | ||||||||||||||||||||||||||||
| 147 | -q qr:(Please\s+install\s+\S+) | ||||||||||||||||||||||||||||
| 148 | -q qr:(You tried to run a test without a plan.*) | ||||||||||||||||||||||||||||
| 149 | -q qr:(.*Server didn't start.*) | ||||||||||||||||||||||||||||
| 150 | -q qr:(You planned.*) | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | This list is subject to change in future releases. | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | =item B<--prefer-local-reports|plr> | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | Boolean. If true, we skip downloading of reports from cpantesters when | ||||||||||||||||||||||||||||
| 157 | the file that is designated to be the local target of the mirror | ||||||||||||||||||||||||||||
| 158 | command already exists. This is highly recommended since it has been | ||||||||||||||||||||||||||||
| 159 | observed (2011-11) that cpantesters is not sending Last-Modified | ||||||||||||||||||||||||||||
| 160 | headers for reports and does not send a 304 on requests with an | ||||||||||||||||||||||||||||
| 161 | If-Modified-Since header. But even when the HTTP handling becomes more | ||||||||||||||||||||||||||||
| 162 | efficient at cpantesters main site, this parameter should lower the | ||||||||||||||||||||||||||||
| 163 | burden on them and reduce the latency on the mirror side considerably. | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | =item B<--q=s@> | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | Query, may be repeated. | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | Example: C<--q mod:Clone --q meta:writer> | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | =item B<--quiet!> | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | Do not output the usual query lines per parsed report. Quiet | ||||||||||||||||||||||||||||
| 174 | overrules verbose. | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =item B<--raw!> | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | Boolean which, if set, causes the full (HTML) report to be | ||||||||||||||||||||||||||||
| 179 | concatenated to STDOUT after every status line. | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | =item B<--report=s@> | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | Avert going through a cpan testers index, go straight to the report | ||||||||||||||||||||||||||||
| 184 | with this guid. | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | Example: C<--report 12386732-1234-1231-8172-178918728017> | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | If report is set and dumpvars is not set, dumpvars will be set to a | ||||||||||||||||||||||||||||
| 189 | dot (meaning that all variables shall be dumped into dumpfile). | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | =item B<--reportfiles=s@{1,}> | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | Specify file names for local report files. One to many files may be given. | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | Example: C<--reportfiles pass.Foo-Bar-0.01.i386-linux.123456789.12345.rpt fail.Foo-Bar-0.01.i386-linux.123456788.12344.rpt> | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | =item B<--sample=i> | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | Limit the number of reports to be analyzed. If the total number of | ||||||||||||||||||||||||||||
| 200 | reports is lower than or equal to the value specifed here then the | ||||||||||||||||||||||||||||
| 201 | option is ignored and all available reports will be used. Only if the | ||||||||||||||||||||||||||||
| 202 | total number of reports is larger than specified then the number of | ||||||||||||||||||||||||||||
| 203 | reports will be sampled randomly to the demanded sample size. Useful | ||||||||||||||||||||||||||||
| 204 | to limit the computing power needed for a result. | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | See also C<--minpass> and C<--minfail>. | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | =item B<--solve!> | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | Calls the solve function which tries to identify the best contenders | ||||||||||||||||||||||||||||
| 211 | for a blame using Statistics::Regression. Currently only limited to | ||||||||||||||||||||||||||||
| 212 | single variables and with simple heuristics. Implies C<--dumpvars=.> | ||||||||||||||||||||||||||||
| 213 | unless the caller sets dumpvars himself. | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | The function prints at the moment to STDOUT the top 3 (set with | ||||||||||||||||||||||||||||
| 216 | C<--solvetop>) candidates according to R^2 with their regression | ||||||||||||||||||||||||||||
| 217 | analysis. | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | A few words of advise: do not take the results as a prove ever. Take | ||||||||||||||||||||||||||||
| 220 | them just as a hint where you can most probably prove a causal | ||||||||||||||||||||||||||||
| 221 | relationship. And keep in mind that causal relationships can be the | ||||||||||||||||||||||||||||
| 222 | other direction as well. | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | If you want to extend on that approach, I recommend you study the | ||||||||||||||||||||||||||||
| 225 | ctgetreports.out file where you find all the data you'd need and feed | ||||||||||||||||||||||||||||
| 226 | your assumptions to Statistics::Regression. | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | =item B<--solvetop=i> | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | The number of top candidates from the C<--solve> regression analysis | ||||||||||||||||||||||||||||
| 231 | to display. | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | =item B<--transport=s> | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | Specifies transport to get the reports. Defaults to C<http_cpantesters>. | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | C<http_cpantesters> uses LWP::UserAgent at api.cpantesters.org. | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | C<http_cpantesters_gzip> also uses LWP::UserAgent at | ||||||||||||||||||||||||||||
| 240 | api.cpantesters.org but compresses the fetched result after fetching | ||||||||||||||||||||||||||||
| 241 | and decompresses cached results before mirroring. This option | ||||||||||||||||||||||||||||
| 242 | requires that C<Compress::Zlib> is installed. | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | =item B<--vdistro=s> | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | Versioned distro, e.g. | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | IPC-Run-0.80 | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | or | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | Moose-2.1103-TRIAL | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | This is the way to target a version different from the most recent | ||||||||||||||||||||||||||||
| 255 | one. | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | In the case that the command line argument already contains an easy to | ||||||||||||||||||||||||||||
| 258 | recognize version as in C<IPC-Run-0.80>, that argument is split and | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | ctgetreports Foo-Bar-3.14 | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | is equivalent to | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | ctgetreports --vdistro=Foo-Bar-3.14 Foo-Bar | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | Note, that there may be distributions on CPAN where the trivial | ||||||||||||||||||||||||||||
| 267 | splitting implemented in ctgetreports does not work. | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | =item B<--verbose|v+> | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | Feedback during download. | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | =item B<--ycb=s> | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | Only used during C<--solve>. Provides perl code to be used as a callback | ||||||||||||||||||||||||||||
| 276 | from the regression to determine the I<Y> of the regression equation. | ||||||||||||||||||||||||||||
| 277 | The callback function gets a record (hashref) as the only argument and | ||||||||||||||||||||||||||||
| 278 | must return a value or undefined. If it returns undefined, the record | ||||||||||||||||||||||||||||
| 279 | is skipped, otherwise this record is processed with the returned | ||||||||||||||||||||||||||||
| 280 | value. The callback is pure perl code without any surrounding sub | ||||||||||||||||||||||||||||
| 281 | declaration. | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | The following example analyses diagnostic output from Acme-Study-Perl: | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | ctgetreports --q qr:"#(.*native big math float/int.*)" --solve \ | ||||||||||||||||||||||||||||
| 286 | --ycb 'my $rec = shift; | ||||||||||||||||||||||||||||
| 287 | my $nbfi = $rec->{"qr:#(.*native big math float/int.*)"}; | ||||||||||||||||||||||||||||
| 288 | return undef unless defined $nbfi; | ||||||||||||||||||||||||||||
| 289 | my $VAR1 = eval($nbfi); | ||||||||||||||||||||||||||||
| 290 | return $VAR1->{">"}' Acme-Study-Perl | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | =back | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | The intent is to get at both the summary at cpantesters and the | ||||||||||||||||||||||||||||
| 297 | individual reports and parse the reports and collect the data for | ||||||||||||||||||||||||||||
| 298 | further inspection. | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | We always only fetch the reports for the most recent (optionally | ||||||||||||||||||||||||||||
| 301 | picked) release. Target root directory is C<$HOME/var/cpantesters> | ||||||||||||||||||||||||||||
| 302 | (can be overridden with the C<--cachedir> option). | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | The C<--q> parameter can be repeated. It takes one argument which | ||||||||||||||||||||||||||||
| 305 | stands for a query. This query must consist of two parts, a qualifier | ||||||||||||||||||||||||||||
| 306 | and the query itself. Qualifiers are one of the following | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | conf parameters from the output of 'perl -V' | ||||||||||||||||||||||||||||
| 309 | e.g.: conf:usethreads, conf:cc | ||||||||||||||||||||||||||||
| 310 | mod for installed modules, either from prerequisites or from the toolchain | ||||||||||||||||||||||||||||
| 311 | e.g.: mod:Test::Simple, mod:Imager | ||||||||||||||||||||||||||||
| 312 | env environment variables | ||||||||||||||||||||||||||||
| 313 | e.g.: env:TERM | ||||||||||||||||||||||||||||
| 314 | meta all other parameters | ||||||||||||||||||||||||||||
| 315 | e.g.: meta:perl, meta:from, meta:date, meta:writer | ||||||||||||||||||||||||||||
| 316 | qr boolean set if the appended regexp matches the report | ||||||||||||||||||||||||||||
| 317 | e.g.: qr:'division by zero' | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | The conf parameters specify a word used by the C<Config> module. | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | The mod parameters consist of a package name. | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | The meta parameters are the following: C<perl> for the perl version, | ||||||||||||||||||||||||||||
| 324 | C<from> for the sender of the report, C<date> for the date in the mail | ||||||||||||||||||||||||||||
| 325 | header, C<writer> for the module that produced the report, | ||||||||||||||||||||||||||||
| 326 | C<output_from> for the line that is reported to have produced the output. | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | =head2 Examples | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | This gets all recent reports for Object-Relation and outputs the | ||||||||||||||||||||||||||||
| 332 | version number of the prerequisite Clone: | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | $0 --q mod:Clone Object-Relation | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | Collects reports about Clone and reports the default set of metadata: | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | $0 Clone | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | Collect reports for Devel-Events and report the version number of | ||||||||||||||||||||||||||||
| 341 | Moose in these reports and sort by success/failure. If Moose broke | ||||||||||||||||||||||||||||
| 342 | Devel-Events it becomes pretty obvious: | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | $0 --q mod:Moose Devel-Events |sort | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | Which tool was used to write how many reports, sorted by frequency: | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | $0 --q meta:writer Template-Timer | sed -e 's/.*meta:writer//' | sort | uniq -c | sort -n | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | Who was in the From field of the mails whose report writer was not determined: | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | $0 --q meta:writer --q meta:from Template-Timer | grep 'UNDEF' | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | At the time of this writing this collected the results of | ||||||||||||||||||||||||||||
| 355 | IPC-Run-0.80_91 which was not really the latest release. In this case | ||||||||||||||||||||||||||||
| 356 | manual investigations were necessary to find out that 0.80 was the | ||||||||||||||||||||||||||||
| 357 | most recent: | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | $0 IPC-Run | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | Pick the specific release IPC-Run-0.80: | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | $0 IPC-Run-0.80 | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | The following displays in its own column if the report contains the | ||||||||||||||||||||||||||||
| 366 | regexp C<division by zero>: | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | $0 --q qr:"division by zero" CPAN-Testers-ParseReport-0.0.7 | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | =cut | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 373 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | 2 | ▶ | use CPAN::Testers::ParseReport; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 376 | 2 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 377 | 2 | ▶ | use Hash::Util qw(lock_keys); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 378 | 2 | ▶ | use Pod::Usage qw(pod2usage); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | 2 | our %Opt; | |||||||||||||||||||||||||||
| 381 | 2 | my @opt = $optpod =~ /B<--(\S+)>/g; | |||||||||||||||||||||||||||
| 382 | 2 | for (@opt) { | |||||||||||||||||||||||||||
| 383 | 56 | ▶ | $_ .= "!" unless /[+!=]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||
| 385 | 2 | lock_keys %Opt, map { /([^=!\|]+)/ } @opt; | |||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | 2 | ▶ | GetOptions(\%Opt, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 388 | @opt, | ||||||||||||||||||||||||||||
| 389 | ) or pod2usage(2); | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 2 | ▶ | if ($Opt{help}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 392 | 1 | pod2usage(0); | |||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | 1 | ▶ | if ($Opt{report} || $Opt{reportfiles}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$main::Opt{"report"} or $main::Opt{"reportfiles"}
MC/DC0%0/2
$main::Opt{"report"} or $main::Opt{"reportfiles"}
$main::Opt{"report"}
$main::Opt{"reportfiles"}
Truth table33%1/3
A or B
A= $main::Opt{"report"}B= $main::Opt{"reportfiles"}
| |||||||||||||||||||||||||||||
| 396 | 0 | ▶ | if (@ARGV) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 397 | 0 | pod2usage(2); | |||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||
| 399 | } else { | ||||||||||||||||||||||||||||
| 400 | 1 | ▶ | if (1 != @ARGV) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 401 | 0 | pod2usage(2); | |||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | 1 | ▶ | if ($Opt{interactive}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 406 | 0 | ▶ | eval { require IO::Prompt; 1; } or | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 407 | die "Option '--interactive' requires IO::Prompt installed"; | ||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | 1 | ▶ | if ($Opt{solve}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 411 | 1 | eval { require Statistics::Regression }; | |||||||||||||||||||||||||||
| 412 | 1 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 413 | 0 | die "Statistics::Regression required for solved option: $@"; | |||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | 1 | ▶ | if ($Opt{report} || $Opt{reportfiles}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$main::Opt{"report"} or $main::Opt{"reportfiles"}
MC/DC0%0/2
$main::Opt{"report"} or $main::Opt{"reportfiles"}
$main::Opt{"report"}
$main::Opt{"reportfiles"}
Truth table33%1/3
A or B
A= $main::Opt{"report"}B= $main::Opt{"reportfiles"}
| |||||||||||||||||||||||||||||
| 417 | 0 | ▶ | $Opt{dumpvars} ||= "."; | ||||||||||||||||||||||||||
|
Condition0%0/2
$main::Opt{"dumpvars"} ||= "."
MC/DC0%0/1
$main::Opt{"dumpvars"} ||= "."
$main::Opt{"dumpvars"}
Truth table0%0/2
A
A= $main::Opt{"dumpvars"}
| |||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||
| 419 | 1 | ▶ | if ($Opt{dumpvars}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 420 | 0 | eval { require YAML::Syck }; | |||||||||||||||||||||||||||
| 421 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 422 | 0 | die "YAML::Syck required for dumpvars option: $@"; | |||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 1 | ▶ | if ($Opt{"parse-common-errors"}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 427 | 0 | ▶ | $Opt{q} ||= []; | ||||||||||||||||||||||||||
|
Condition0%0/2
$main::Opt{"q"} ||= []
MC/DC0%0/1
$main::Opt{"q"} ||= []
$main::Opt{"q"}
Truth table0%0/2
A
A= $main::Opt{"q"}
| |||||||||||||||||||||||||||||
| 428 | 0 | my($para) = grep {/^\s+-q qr:/} split /\n\n/, $optpod; | |||||||||||||||||||||||||||
| 429 | 0 | for my $line (split /\n/, $para) { | |||||||||||||||||||||||||||
| 430 | 0 | my($qr) = $line =~ /-q (qr:.*)/; | |||||||||||||||||||||||||||
| 431 | 0 | push @{$Opt{q}}, $qr; | |||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||
| 434 | 1 | ▶ | if (defined $Opt{minpass}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 435 | 0 | ▶ | if (! defined $Opt{minfail}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 436 | 0 | $Opt{minfail} = $Opt{minpass}; | |||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | 1 | $|=1; | |||||||||||||||||||||||||||
| 441 | 1 | ▶ | if ($Opt{report} || $Opt{reportfiles}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$main::Opt{"report"} or $main::Opt{"reportfiles"}
MC/DC0%0/2
$main::Opt{"report"} or $main::Opt{"reportfiles"}
$main::Opt{"report"}
$main::Opt{"reportfiles"}
Truth table33%1/3
A or B
A= $main::Opt{"report"}B= $main::Opt{"reportfiles"}
| |||||||||||||||||||||||||||||
| 442 | 0 | my $dumpvars = {}; | |||||||||||||||||||||||||||
| 443 | 0 | ▶ | if ($Opt{solve}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 444 | 0 | ▶ | $Opt{dumpvars} = "." unless defined $Opt{dumpvars}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||
| 446 | 0 | REPORT: for my $key (qw(report reportfiles)) { | |||||||||||||||||||||||||||
| 447 | 0 | my $reports = $Opt{$key}; | |||||||||||||||||||||||||||
| 448 | 0 | ▶ | if ($reports && @$reports) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$reports and @$reports
MC/DC0%0/2
$reports and @$reports
$reports
@$reports
Truth table0%0/3
A and B
A= $reportsB= @$reports
| |||||||||||||||||||||||||||||
| 449 | 0 | for my $report (@$reports) { | |||||||||||||||||||||||||||
| 450 | 0 | my $extract; | |||||||||||||||||||||||||||
| 451 | 0 | ▶ | if ($key eq 'report') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 452 | 0 | $extract = eval { CPAN::Testers::ParseReport::parse_single_report({id => $report},$dumpvars,%Opt) }; | |||||||||||||||||||||||||||
| 453 | } else { | ||||||||||||||||||||||||||||
| 454 | 0 | $extract = eval { CPAN::Testers::ParseReport::parse_report($report,$dumpvars,%Opt) }; | |||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||
| 456 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 457 | 0 | ▶ | if (ref $@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 458 | 0 | warn "Warning: error while parsing '$report': $@->{text}"; | |||||||||||||||||||||||||||
| 459 | } else { | ||||||||||||||||||||||||||||
| 460 | 0 | warn "Alert: error while parsing '$report': $@"; | |||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||
| 463 | 0 | ▶ | last REPORT if $CPAN::Testers::ParseReport::Signal; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||
| 467 | 0 | ▶ | if ($Opt{solve}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 468 | 0 | CPAN::Testers::ParseReport::solve($dumpvars,%Opt); | |||||||||||||||||||||||||||
| 469 | } else { | ||||||||||||||||||||||||||||
| 470 | 0 | ▶ | my $dumpfile = $Opt{dumpfile} || "ctgetreports.out"; | ||||||||||||||||||||||||||
|
Condition0%0/2
$main::Opt{'dumpfile'} || 'ctgetreports.out'
MC/DC0%0/1
$main::Opt{'dumpfile'} || 'ctgetreports.out'
$main::Opt{'dumpfile'}
Truth table0%0/2
A
A= $main::Opt{'dumpfile'}
| |||||||||||||||||||||||||||||
| 471 | 0 | YAML::Syck::DumpFile($dumpfile,$dumpvars); | |||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||
| 473 | } else { | ||||||||||||||||||||||||||||
| 474 | 1 | $ARGV[0] =~ s|.+/||; | |||||||||||||||||||||||||||
| 475 | 1 | CPAN::Testers::ParseReport::parse_distro($ARGV[0],%Opt); | |||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | __END__ | ||||||||||||||||||||||||||||