Subject: Re: use of ls in mk/bulk/post-build
To: Todd Vierling <tv@duh.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: pkgsrc-bulk
Date: 06/13/2005 15:59:53
--eNMatiwYGLtwo1cJ
Content-Type: multipart/mixed; boundary="6Vw0j8UKbyX0bfpA"
Content-Disposition: inline


--6Vw0j8UKbyX0bfpA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Todd Vierling <tv@duh.org> wrote:
> On Mon, 13 Jun 2005, Jan Schaumann wrote:
>=20
> > > Hm.  This is ugly.  I suppose it can go back to find, but I may try t=
o find
> > > a new way to do this in the future.
> >
> > This still hasn't been fixed.  I'd really like to have a functional
> > post-build on the new branch -- can we please revert this change to use
> > find(1) again?  It's better to have it be slow over NFS than to not have
> > it working at all on some platforms.
>=20
> Oh, I thought I implied that you could revert it, but I probably didn't m=
ake
> that clear enough.  I was assuming that you had a working revert diff to
> commit -- if not, let me know, and I'll do it.

Here's a diff against the stable branch.  This also includes my
'top-ten' patch, which I don't remember if I committed this on HEAD or
not.  Could you extract the find-vs-ls chunk and commit it?

Thanks!

-Jan

--=20
chown -R us:enemy your_base

--6Vw0j8UKbyX0bfpA
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	13 Jun 2005 19:55:03 -0000
@@ -104,21 +104,24 @@
 	$enddate =3D strftime("%c %Z", gmtime(time()));
 }
=20
+$verbose=3D1;
+
 my $report_head =3D <<EOF;
 Package                    Breaks  Maintainer
---------------------------------------------------------------
+----------------------------------------------------------------------
 EOF
 my $report_form =3D <<EOF;
-@<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
+@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
 EOF
 # $pkg, $nbrokenby, $maintainer
+#$pkg                               $nbrokenby  $maintainer
=20
=20
 my_system("mkdir -p $vars{FTP}");
=20
 # Copy over the output from the build process
 chdir($vars{USR_PKGSRC});
-my_system("/bin/ls -1 $vars{BROKENFILE} $vars{BROKENWRKLOG} */*/$vars{BROK=
ENFILE} */*/$vars{BROKENWRKLOG} 2>/dev/null | $vars{GTAR} -T - -plcf - | (c=
d $vars{FTP}; $vars{GTAR} -plxf -)");
+my_system("find . -name $vars{BROKENFILE} -print -o -name $vars{BROKENWRKL=
OG} -print | $vars{GTAR} -T - -plcf - | (cd $vars{FTP}; $vars{GTAR} -plxf -=
)");
=20
 # Copy over the cache files used during the build
 foreach my $f qw(BULK_DBFILE DEPENDSTREEFILE DEPENDSFILE SUPPORTSFILE INDE=
XFILE ORDERFILE) {
@@ -241,7 +244,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 +453,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 +463,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
@@ -571,6 +576,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

--6Vw0j8UKbyX0bfpA--

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

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

iD8DBQFCreW5fFtkr68iakwRAhlHAKDdkE/mCsHvaeJxrumtKtyROhnECwCg2fIE
/lQxH5lkfC7lQTbXJJ4QJs0=
=b+JF
-----END PGP SIGNATURE-----

--eNMatiwYGLtwo1cJ--