Subject: top-ten patch
To: None <pkgsrc-bulk@netbsd.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: pkgsrc-bulk
Date: 05/08/2005 15:34:33
--RpqchZ26BWispMcB
Content-Type: multipart/mixed; boundary="ieNMXl1Fr3cevapt"
Content-Disposition: inline
--ieNMXl1Fr3cevapt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
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
--=20
Free Speech Online - Stop Internet Censorship
--- Electronic Frontier Foundation -- http://www.eff.org ---
--ieNMXl1Fr3cevapt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
Content-Transfer-Encoding: quoted-printable
Index: post-build
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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=3D"right" class=3D"pkg-'.$state_style.'">'.$nbrokenby.'</td>'
if $nbrokenby > 0;
=20
- if ($pinfo->{nerrors} !=3D 0 && $verbose && $state eq "broken") {
+ if ($pinfo->{nerrors} !=3D 0 && $verbose && ($state eq "broken" || $state=
eq "topten")) {
print swrite($report_form, $pkg, $nbrokenby > 0 ? $nbrokenby : "", $main=
tainer);
}
=20
@@ -450,6 +450,7 @@
<p>
Jump to:<br/>
<ul>
+ <li><a href=3D"#topten">Top Ten Offenders</a></li>
<li><a href=3D"#broken">Broken packages</a></li>
<li><a href=3D"#broken depends">Broken dependencies</a></li>
<li><a href=3D"#not packaged">Not packaged</a></li>
@@ -459,19 +460,21 @@
EOHTML
=20
my %state_head =3D (
+ "topten" =3D> "Top Ten Offenders",
"broken" =3D> "Broken packages",
"broken depends" =3D> "Broken dependencies",
"not packaged" =3D> "Not packaged"
);
=20
+ 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;
}
=20
- foreach my $state ("broken", "broken depends", "not packaged") {
- next unless scalar(@{$broken->{$state}});
=20
print HTML <<EOHTML;
=20
@@ -536,6 +539,7 @@
# get and sort the broken packages
sub getBroken {
my $res =3D {
+ 'topten' =3D> [],
'broken' =3D> [],
'broken depends' =3D> [],
'not packaged' =3D> [],
@@ -571,6 +575,12 @@
$res->{$state} =3D [ sort { $a->{pkg} cmp $b->{pkg} } @{$res->{$state}} =
];
}
=20
+ $res->{"topten"} =3D [ sort { $b->{nbrokenby} <=3D> $a->{nbrokenby} } @{$=
res->{"broken"}} ];
+
+ for (my $count =3D $#{$res->{"topten"}}; $count >=3D 10; $count--) {
+ pop(@{$res->{"topten"}});
+ }
+
return $res;
}
=20
--ieNMXl1Fr3cevapt--
--RpqchZ26BWispMcB
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
iD8DBQFCfmnJfFtkr68iakwRAqr2AJ92A5O46EwktPpOh3/yeh+giuUmDQCghL03
kpNUpE5i5SG6IQ5BipbbKzw=
=pG1n
-----END PGP SIGNATURE-----
--RpqchZ26BWispMcB--