# HG changeset patch # User Dario Sestito # Date 1283341026 -3600 # Node ID 8e14889056213a08692d4c47f34bbb9459fe7e9a # Parent 510bd35e96e2101c5905f2f0df1154b4af1705da Add number of releasables (by package) in the missing column diff -r 510bd35e96e2 -r 8e1488905621 uh_parser/releaseables.pm --- 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 () + { + 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 = ; diff -r 510bd35e96e2 -r 8e1488905621 uh_parser/uh.pl --- 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 .= "$failuresbyseverity"; } - $packageline .= "".$missing_by_package->{$package}."" if ($missing); + #print "package $package, releasables in this package: $releaseables_by_package->{$package}\n"; + $packageline .= "".$missing_by_package->{$package}."/".$releaseables_by_package->{$package}."" if ($missing); $packageline .= "\n"; print AGGREGATED "$packageline\n"; } @@ -325,7 +330,7 @@ { my $packageline = "$package"; for (@severities) { $packageline .= "0"; } - $packageline .= "0" if ($missing); + $packageline .= "0/$releaseables_by_package->{$package}" if ($missing); $packageline .= "\n"; print AGGREGATED "$packageline\n"; }