Subject: | New option --reportfiles |
The attached patches implement a new option --reportfiles for ctgetreports. With this option it's possible to parse and solve test reports found only on the local disk (i.e. reports which are cached locally and not yet in metabase). Real world usage example:
perl -Mblib blib/script/ctgetreports --reportfiles /home/e/eserte/var/cpansmoker/done/*/*.Config-INI-0.025.* --solve --solvetop 20 | less
Subject: | 0001-add-new-option-reportfiles.patch |
From 3dd0db28f72a352d789043e8656df35a8cee751e Mon Sep 17 00:00:00 2001
From: Slaven Rezic <slaven@rezic.de>
Date: Wed, 8 Apr 2015 21:43:10 +0200
Subject: [PATCH 1/2] add new option --reportfiles
---
bin/ctgetreports | 51 +++++++++++++++++++++++++++++++++++++--------------
1 file changed, 37 insertions(+), 14 deletions(-)
diff --git a/bin/ctgetreports b/bin/ctgetreports
index f9aa0d6..41091a7 100755
--- a/bin/ctgetreports
+++ b/bin/ctgetreports
@@ -159,6 +159,12 @@ Example: C<--report 1238673>
If report is set and dumpvars is not set, dumpvars will be set to a
dot (meaning that all variables shall be dumped into dumpfile).
+=item B<--reportfiles=s@{1,}>
+
+Specify file names for local report files. One to many files may be given.
+
+Example: C<--reportfiles pass.Foo-Bar-0.01.i386-linux.123456789.12345.rpt fail.Foo-Bar-0.01.i386-linux.123456788.12344.rpt>
+
=item B<--sample=i>
Limit the number of reports to be analyzed. If the total number of
@@ -368,7 +374,7 @@ if ($Opt{help}) {
pod2usage(0);
}
-if ($Opt{report}) {
+if ($Opt{report} || $Opt{reportfiles}) {
if (@ARGV) {
pod2usage(2);
}
@@ -414,21 +420,38 @@ if (defined $Opt{minpass}) {
}
$|=1;
-if (my $reports = delete $Opt{report}) {
+if ($Opt{report} || $Opt{reportfiles}) {
my $dumpvars = {};
- REPORT: for my $report (@$reports) {
- my $extract = eval { CPAN::Testers::ParseReport::parse_single_report({id => $report},$dumpvars,%Opt) };
- if ($@) {
- if (ref $@) {
- warn "Warning: error while parsing '$report': $@->{text}";
- } else {
- warn "Alert: error while parsing '$report': $@";
- }
- }
- last REPORT if $CPAN::Testers::ParseReport::Signal;
+ if ($Opt{solve}) {
+ $Opt{dumpvars} = "." unless defined $Opt{dumpvars};
+ }
+ REPORT: for my $key (qw(report reportfiles)) {
+ my $reports = $Opt{$key};
+ if ($reports && @$reports) {
+ for my $report (@$reports) {
+ my $extract;
+ if ($key eq 'report') {
+ $extract = eval { CPAN::Testers::ParseReport::parse_single_report({id => $report},$dumpvars,%Opt) };
+ } else {
+ $extract = eval { CPAN::Testers::ParseReport::parse_report($report,$dumpvars,%Opt) };
+ }
+ if ($@) {
+ if (ref $@) {
+ warn "Warning: error while parsing '$report': $@->{text}";
+ } else {
+ warn "Alert: error while parsing '$report': $@";
+ }
+ }
+ last REPORT if $CPAN::Testers::ParseReport::Signal;
+ }
+ }
+ }
+ if ($Opt{solve}) {
+ CPAN::Testers::ParseReport::solve($dumpvars,%Opt);
+ } else {
+ my $dumpfile = $Opt{dumpfile} || "ctgetreports.out";
+ YAML::Syck::DumpFile($dumpfile,$dumpvars);
}
- my $dumpfile = $Opt{dumpfile} || "ctgetreports.out";
- YAML::Syck::DumpFile($dumpfile,$dumpvars);
} else {
$ARGV[0] =~ s|.+/||;
CPAN::Testers::ParseReport::parse_distro($ARGV[0],%Opt);
--
2.1.2
Subject: | 0002-id-may-be-non-numeric-now-avoid-warnings.patch |
From 599c1c7bd8342efcafa6f9389e1843b79a5b08d8 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <slaven@rezic.de>
Date: Wed, 8 Apr 2015 21:43:21 +0200
Subject: [PATCH 2/2] id may be non-numeric now, avoid warnings
---
lib/CPAN/Testers/ParseReport.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/CPAN/Testers/ParseReport.pm b/lib/CPAN/Testers/ParseReport.pm
index c0e84fb..0a6c7b1 100644
--- a/lib/CPAN/Testers/ParseReport.pm
+++ b/lib/CPAN/Testers/ParseReport.pm
@@ -892,7 +892,7 @@ sub parse_report {
my $have = $extract{$want} || "";
$diag .= " $want\[$have]";
}
- printf STDERR " %-4s %8d%s\n", $extract{"meta:ok"}, $id, $diag unless $Opt{quiet};
+ printf STDERR " %-4s %8s%s\n", $extract{"meta:ok"}, $id, $diag unless $Opt{quiet};
if ($Opt{raw}) {
$report =~ s/\s+\z//;
print STDERR $report, "\n================\n" unless $Opt{quiet};
--
2.1.2