--- a/uh_parser/releaseables.pm Tue Aug 31 16:17:03 2010 +0100
+++ b/uh_parser/releaseables.pm Wed Sep 01 12:37:06 2010 +0100
@@ -17,6 +17,7 @@
package releaseables;
use File::Path;
+use File::Find;
use strict;
@@ -256,6 +257,43 @@
}
}
}
+
+sub count_distinct
+{
+ my @files;
+ my $finder = sub {
+ return if ! -f;
+ return if ! /\.tsv$/;
+ push @files, $File::Find::name;
+ };
+ find($finder, $::releaseablesdir);
+
+ for my $file (@files)
+ {
+ $file =~ /$::releaseablesdir[\\\/](.*)[\\\/]info\.tsv/;
+ my $package = $1;
+ $package =~ s,\\,/,g;
+
+ my @releasables;
+ open(FILE, $file);
+ while (<FILE>)
+ {
+ my $line = $_;
+ next if ($line !~ /^([^\t]*)\t[^\t]*\t[^\t]*$/);
+ push @releasables, $1;
+ }
+ close(FILE);
+ #for my $r (@releasables) {print "$r\n";}
+ #print "\n\n\n\n";
+ my $previous = '';
+ my @distincts = grep {$_ ne $previous && ($previous = $_, 1) } sort @releasables;
+
+ my $nd = scalar(@distincts);
+ #print "adding $package -> $nd to releaseables_by_package\n";
+ $::releaseables_by_package->{$package} = $nd;
+ }
+}
+
sub remove_missing_duplicates
{
opendir(DIR, $::raptorbitsdir);
@@ -265,7 +303,7 @@
for my $file (@files)
{
open(FILE, "+<$::raptorbitsdir/$file");
- print "working on $file\n";
+ #print "working on $file\n";
# Read it
my @content = <FILE>;
--- a/uh_parser/uh.pl Tue Aug 31 16:17:03 2010 +0100
+++ b/uh_parser/uh.pl Wed Sep 01 12:37:06 2010 +0100
@@ -132,6 +132,7 @@
our $allbldinfs = {};
our $allconfigs = {};
+our $releaseables_by_package = {};
my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler);
for (@logfiles)
@@ -141,11 +142,14 @@
$parser->parse_uri($_);
}
+print "Removing duplicates from missing files\n";
releaseables::remove_missing_duplicates();
+print "Counting releasables\n";
+releaseables::count_distinct();
my @allpackages = distinct_packages($allbldinfs);
-print "Generating HTML...\n";
+print "Generating HTML\n";
system("rd /S /Q $outputdir") if (-d $outputdir);
mkdir ($outputdir);
@@ -315,7 +319,8 @@
$failuresbyseverity = $recipe_failures_num_by_severity->{$package}->{$_} if (defined $recipe_failures_num_by_severity->{$package}->{$_});
$packageline .= "<td>$failuresbyseverity</td>";
}
- $packageline .= "<td>".$missing_by_package->{$package}."</td>" if ($missing);
+ #print "package $package, releasables in this package: $releaseables_by_package->{$package}\n";
+ $packageline .= "<td>".$missing_by_package->{$package}."/".$releaseables_by_package->{$package}."</td>" if ($missing);
$packageline .= "</tr>\n";
print AGGREGATED "$packageline\n";
}
@@ -325,7 +330,7 @@
{
my $packageline = "<tr><td>$package</td>";
for (@severities) { $packageline .= "<td>0</td>"; }
- $packageline .= "<td>0</td>" if ($missing);
+ $packageline .= "<td>0/$releaseables_by_package->{$package}</td>" if ($missing);
$packageline .= "</tr>\n";
print AGGREGATED "$packageline\n";
}