Hi, Attached find a patch to calculate and list the top-ten offenders in a bulk-build. I have used this in my last IRIX build for the pkgsrc-2005Q1 branch, but since post-build has changed a bit for pkgsrc-current, I'd like somebody else to test this before I commit it. Any volunteers? Thanks! -Jan -- Free Speech Online - Stop Internet Censorship --- Electronic Frontier Foundation -- http://www.eff.org ---
Index: post-build =================================================================== RCS file: /cvsroot/pkgsrc/mk/bulk/post-build,v retrieving revision 1.51 diff -b -u -r1.51 post-build --- post-build 15 Jan 2005 01:53:00 -0000 1.51 +++ post-build 8 May 2005 18:00:58 -0000 @@ -241,7 +241,7 @@ '<td align="right" class="pkg-'.$state_style.'">'.$nbrokenby.'</td>' if $nbrokenby > 0; - if ($pinfo->{nerrors} != 0 && $verbose && $state eq "broken") { + if ($pinfo->{nerrors} != 0 && $verbose && ($state eq "broken" || $state eq "topten")) { print swrite($report_form, $pkg, $nbrokenby > 0 ? $nbrokenby : "", $maintainer); } @@ -450,6 +450,7 @@ <p> Jump to:<br/> <ul> + <li><a href="#topten">Top Ten Offenders</a></li> <li><a href="#broken">Broken packages</a></li> <li><a href="#broken depends">Broken dependencies</a></li> <li><a href="#not packaged">Not packaged</a></li> @@ -459,19 +460,21 @@ EOHTML my %state_head = ( + "topten" => "Top Ten Offenders", "broken" => "Broken packages", "broken depends" => "Broken dependencies", "not packaged" => "Not packaged" ); + foreach my $state ("broken", "broken depends", "not packaged") { + next unless scalar(@{$broken->{$state}}); + # only include broken packages in the email, see also pkgResult(). - if ($verbose && scalar(@{$broken->{"broken"}})) { + if ($verbose && ($state eq "topten" || $state eq "broken")) { print "\n\n$state_head{broken}\n\n"; print $report_head; } - foreach my $state ("broken", "broken depends", "not packaged") { - next unless scalar(@{$broken->{$state}}); print HTML <<EOHTML; @@ -536,6 +539,7 @@ # get and sort the broken packages sub getBroken { my $res = { + 'topten' => [], 'broken' => [], 'broken depends' => [], 'not packaged' => [], @@ -571,6 +575,12 @@ $res->{$state} = [ sort { $a->{pkg} cmp $b->{pkg} } @{$res->{$state}} ]; } + $res->{"topten"} = [ sort { $b->{nbrokenby} <=> $a->{nbrokenby} } @{$res->{"broken"}} ]; + + for (my $count = $#{$res->{"topten"}}; $count >= 10; $count--) { + pop(@{$res->{"topten"}}); + } + return $res; }
Attachment:
pgpB5pZEwMoq4.pgp
Description: PGP signature