This post is the latest in my series, letting other high-release CPAN authors know about what I'm doing with my repository, in the hopes that they may find something useful and steal the idea for their own repository automation.
I'm going to start doing these as a monthly summary for simplicity.
-------------------------------------------------------
My rapidly maturing repository automation passed another milestone last month, when I finally managed to integrate the repository model code with both ORDB::CPANUploads and ORDB::CPANTesters.
This is of particular value to the ::Release object, which is now able to tell if and when it was actually uploaded to the CPAN, and what the CPAN Testers results for the release were (mostly of interest if it's the current release).
As I'd hoped, it turned out to be really easy to do the integration.
First, the CPAN Uploads data.
sub upload {
require ORDB::CPANUploads;
ORDB::CPANUploads->import;
ORDB::CPANUploads::Uploads->select('where filename = ?', $_[0]->file);
}
As you can see, I delay loading the class until it's needed, because the model classes auto-inflate at import time. The model name in this case doesn't read very well either, a good argument for naming your tables in the singular.##################################################################### # ORDB::CPANUploads Integration
sub uploads { require ORDB::CPANUploads; ORDB::CPANUploads->import; ORDB::CPANUploads::Uploads->select('where dist = ? order by released desc', $_[0]->name); }
sub maintainer { my @upload = $_[0]->uploads; @upload ? lc($upload[0]->author . '@cpan.org') : ''; }
sub mine { $_[0]->maintainer eq 'adamk@cpan.org' }
sub cpan_testers {
require ORDB::CPANTesters;
ORDB::CPANTesters->import;
my $rows = ORDB::CPANTesters->selectall_arrayref(
'SELECT state, COUNT(*) AS count FROM cpanstats WHERE dist = ? and version = ? group by state',
{}, $_[0]->distname, $_[0]->version,
);
my %hash = ( map { uc($_->[0]) => $_->[1] } @$rows );
delete $hash{CPAN};
return \%hash;
}
The main purpose of these extra calls, of course, is as more fodder for my repository analysis reports.D:\cpan\trunk\ADAMK-Repository>adamk report_module_install_versions --sort=2 --bad Preloading releases... Preloading distributions...
|----------------------|-------------|---------| | Name | Makefile.PL | Tarball | |----------------------|-------------|---------| | ORDB-CPANTesters | 0.86 | 0.85 | | CGI-Capture | 0.85 | 0.85 | | ORDB-CPANTS | 0.85 | 0.85 | | ORDB-CPANUploads | 0.85 | 0.85 | | ORLite-Mirror | 0.85 | 0.81 | | Task-CatInABox | 0.85 | 0.85 | | Test-XT | 0.85 | 0.85 | | Win32-Env-Path | 0.85 | 0.85 | | Win32-File-Object | 0.85 | 0.85 | | ADAMK-Repository | 0.83 | 0.85 | | Acme-Mom-Yours | 0.83 | 0.85 | | Aspect-Library-Trace | 0.83 | 0.85 | | Class-Inspector | 0.83 | 0.85 | | Data-JavaScript-Anon | 0.83 | 0.85 | | Module-Changes-ADAMK | 0.83 | 0.84 | | Module-Manifest | 0.83 | 0.85 | | ORLite-Migrate | 0.83 | 0.85 | | ORLite-Profile | 0.83 | 0.85 | | Test-Inline | 0.83 | 0.84 | | Test-SubCalls | 0.83 | 0.85 | | prefork | 0.83 | 0.85 | | PPI-Tester | 0.77 | 0.36 | | PPI-XS | 0.76 | 0.36 | |----------------------|-------------|---------|