Subject: Re: top-ten patch
To: Min Sik Kim <minskim@NetBSD.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: pkgsrc-bulk
Date: 05/13/2005 10:25:12
--UFHRwCdBEJvubb2X
Content-Type: multipart/mixed; boundary="cmJC7u66zC7hs+87"
Content-Disposition: inline


--cmJC7u66zC7hs+87
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Min Sik Kim <minskim@NetBSD.org> wrote:
> On May 8, 2005, at 2:34 PM, Jan Schaumann wrote:

> >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 =20
> >it.
> >
>=20
> I ran my recent Linux bulk build with the patch applied, but the =20
> result doesn't include the top ten list.  It only has a link.

Hmm, strange.  I just finished another build (though from the branch),
and that worked fine, too.  Just to make sure, here's the patch that
applies to the branch -- it might need minor adjustment for -current.
Could you try to weave that into your mk/bulk/post-build and see if it
works?

If you still have all the build-results, then you don't actually need to
run a full bulk-build, but can just run post-build to see if it works
fine...

-Jan

--=20
Free Speech Online - Stop Internet Censorship
   --- Electronic Frontier Foundation -- http://www.eff.org ---

--cmJC7u66zC7hs+87
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.48
diff -b -u -r1.48 post-build
--- post-build	23 Nov 2004 19:31:46 -0000	1.48
+++ post-build	13 May 2005 14:23:34 -0000
@@ -82,10 +82,10 @@
=20
 $report_head =3D <<EOF;
 Package                    Breaks  Maintainer
---------------------------------------------------------------
+----------------------------------------------------------------------
 EOF
 $report_form =3D <<EOF;
-@<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
+@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
 $pkg                       $nbrokenby  $maintainer
 EOF
=20
@@ -204,7 +204,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
@@ -413,6 +413,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>
@@ -422,19 +423,20 @@
 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
-	# only include broken packages in the email, see also pkgResult().
-	if ($verbose && scalar(@{$broken->{"broken"}})) {
-		print "\n\n$state_head{broken}\n\n";
+	foreach my $state ("topten", "broken", "broken depends", "not packaged") {
+		next unless scalar(@{$broken->{$state}});
+	=09
+		if ($verbose && ($state eq "topten" || $state eq "broken")) {
+			print "\n\n$state_head{$state}\n\n";
 		print $report_head;
 	}
=20
-	foreach my $state ("broken", "broken depends", "not packaged") {
-		next unless scalar(@{$broken->{$state}});
=20
 		print HTML <<EOHTML;
=20
@@ -532,6 +534,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

--cmJC7u66zC7hs+87--

--UFHRwCdBEJvubb2X
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFChLjIfFtkr68iakwRApaPAJ4g1w0xVBOipxckIleFtrCsu1mHKQCfY7pI
zXyYqHG6fcaZdtSPD81OCco=
=zeQ0
-----END PGP SIGNATURE-----

--UFHRwCdBEJvubb2X--