The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

ctgetreports - Quickly fetch cpantesters results with all reports

SYNOPSIS

  ctgetoptions [options] distroname ...
  ctgetoptions [options] --report number ...
  ctgetoptions -h

OPTIONS

--cachedir=s

Directory to keep mirrored data in. Defaults to $HOME/var/cpantesters.

--ctformat=s

Format of the cpan-testers file that should be downloaded. Default is html, alternative is yaml.

--dumpvars=s

Dump all queryable variables matching the regular expression given as argument at the end of the loop for a distro.

--help|h

Prints a brief message and exists.

--interactive|i

After every parsed report asks if you want to see it in a pager.

--local

Do not mirror more than neccessary. Use a local *.html file if present even if older than 24 hours.

--pager=s

Pager (needed when -i is given). Defaults to less.

--q=s@

Query, may be repeated.

Example: --q mod:Clone --q meta:writer

--raw!

Boolean which, if set, causes the full (HTML) report to be concatenated to STDOUT after every status line.

--report=s@

Avert going through a cpan testers index, go straight to the report with this number.

Example: --report 1238673

--vdistro=s

Versioned distro. Needed if we do not want the most recent. Makes no sense if there is more than one argument on the command line.

Example: --vdistro IPC-Run-0.80

--verbose|v+

Feedback during download.

DESCRIPTION

!!!!Alert: alpha quality software, subject to change without warning!!!!

The intent is to get at both the summary at cpantesters and the individual reports and parse the reports and collect the data for further inspection.

We always only fetch the reports for the most recent (optionally picked) release. Target root directory is $HOME/var/cpantesters

The --q paramater can be repeated. It takes one argument which stands for a query. This query must consist of two parts, a qualifier and the query itself. Qualifiers are one of the following

  conf       parameters from the output of 'perl -V'
             e.g.: conf:usethreads, conf:cc
  mod        for installed modules, either from prerequisites or from the toolchain
             e.g.: mod:Test::Simple, mod:Imager
  env        environment variables
             e.g.: env:TERM
  meta       all other parameters
             e.g.: meta:perl, meta:from
  qr         boolean set if the appended regexp matches the report
             e.g.: qr:'division by zero'

The conf parameters specify a word used by the Config module.

The mod parameters consist of a package name.

The meta parameters are the following: perl for the perl version, from for the sender of the report, date for the date in the mail header, writer for the module that produced the report, output_from for the line that is reported to have produced the output.

Examples

This gets all recent reports for Object-Relation and outputs the version number of the prerequisite Clone:

  $0 --q mod:Clone Object-Relation

Collects reports about Clone and reports the default set of metadata:

  $0 Clone

Collect reports for Devel-Events and report the version number of Moose in thses reports and sort by success/failure. If Moose broke Devel-Events is becomes pretty obvious:

  $0 --q mod:Moose Devel-Events |sort

Which tool was used to write how many reports, sorted by frequency:

  $0 --q meta:writer Template-Timer | sed -e 's/.*meta:writer//' | sort | uniq -c | sort -n

Who was in the From field of the mails whose report writer was not determined:

  $0 --q meta:writer --q meta:from Template-Timer | grep 'UNDEF'

At the time of this writing this collected the results of IPC-Run-0.80_91 which was not really the latest release. In this case manual investigations were necessary to find out that 0.80 was the most recent:

  $0 IPC-Run

Pick the specific release IPC-Run-0.80:

  $0 --vdistro IPC-Run-0.80 IPC-Run

The following displays in its own column if the report contains the regexp division by zero:

  $0 --q qr:"division by zero" --vdistro 'CPAN-Testers-ParseReport-0.0.7' CPAN-Testers-ParseReport

The following is a simple job to refresh all HTML pages we already have and fetch new reports referenced there too:

  perl -le '
  for my $dirent (glob "$ENV{HOME}/var/cpantesters/cpantesters-show/*.html"){
    my($distro) = $dirent =~ m|/([^/]+)\.html$| or next;
    print $distro;
    my $system = "ctgetreports --verbose --verbose $distro";
    0 == system $system or die;
  }'