pkgsrc-Bulk archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: use of ls in mk/bulk/post-build



Todd Vierling <tv%duh.org@localhost> wrote:
> On Mon, 13 Jun 2005, Jan Schaumann wrote:
> 
> > > Hm.  This is ugly.  I suppose it can go back to find, but I may try to 
> > > 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.
> 
> Oh, I thought I implied that you could revert it, but I probably didn't make
> 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

-- 
chown -R us:enemy your_base
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  13 Jun 2005 19:55:03 -0000
@@ -104,21 +104,24 @@
        $enddate = strftime("%c %Z", gmtime(time()));
 }
 
+$verbose=1;
+
 my $report_head = <<EOF;
 Package                    Breaks  Maintainer
---------------------------------------------------------------
+----------------------------------------------------------------------
 EOF
 my $report_form = <<EOF;
-@<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
+@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
 EOF
 # $pkg, $nbrokenby, $maintainer
+#$pkg                               $nbrokenby  $maintainer
 
 
 my_system("mkdir -p $vars{FTP}");
 
 # Copy over the output from the build process
 chdir($vars{USR_PKGSRC});
-my_system("/bin/ls -1 $vars{BROKENFILE} $vars{BROKENWRKLOG} 
*/*/$vars{BROKENFILE} */*/$vars{BROKENWRKLOG} 2>/dev/null | $vars{GTAR} -T - 
-plcf - | (cd $vars{FTP}; $vars{GTAR} -plxf -)");
+my_system("find . -name $vars{BROKENFILE} -print -o -name $vars{BROKENWRKLOG} 
-print | $vars{GTAR} -T - -plcf - | (cd $vars{FTP}; $vars{GTAR} -plxf -)");
 
 # Copy over the cache files used during the build
 foreach my $f qw(BULK_DBFILE DEPENDSTREEFILE DEPENDSFILE SUPPORTSFILE 
INDEXFILE ORDERFILE) {
@@ -241,7 +244,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 +453,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 +463,20 @@
 EOHTML
 
        my %state_head = (
+               "topten" => "Top Ten Offenders",
                "broken" => "Broken packages",
                "broken depends" => "Broken dependencies",
                "not packaged" => "Not packaged"
        );
 
-       # 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}});
+               
+               if ($verbose && ($state eq "topten" || $state eq "broken")) {
+                       print "\n\n$state_head{$state}\n\n";
                print $report_head;
        }
 
-       foreach my $state ("broken", "broken depends", "not packaged") {
-               next unless scalar(@{$broken->{$state}});
 
                print HTML <<EOHTML;
 
@@ -571,6 +576,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: pgpffbavjz9pc.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index