From 68315859d732ed730772c4350c14ed453b4e7738 Mon Sep 17 00:00:00 2001 From: grant Date: Sat, 31 Jan 2004 03:30:49 +0000 Subject: improve report layout: - move the build summary to the top and include build start/end times. - break the report up into three sections for easier navigation: Broken, Broken dependencies, and Not packaged. - HTML report now uses a subset of the www.NetBSD.org stylesheet. - improve some of the text. --- mk/bulk/post-build | 573 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 376 insertions(+), 197 deletions(-) (limited to 'mk/bulk') diff --git a/mk/bulk/post-build b/mk/bulk/post-build index dea113e30d1..252e83b9fa7 100644 --- a/mk/bulk/post-build +++ b/mk/bulk/post-build @@ -1,5 +1,5 @@ #!/usr/pkg/bin/perl -# $NetBSD: post-build,v 1.28 2004/01/26 21:10:32 heinz Exp $ +# $NetBSD: post-build,v 1.29 2004/01/31 03:30:49 grant Exp $ # # Collect stuff after a pkg bulk build # @@ -11,22 +11,20 @@ use File::Basename; # Where config vars are stored (/bin/sh syntax) if (-f $ENV{"BULK_BUILD_CONF"}) { - $BULK_BUILD_CONF=$ENV{"BULK_BUILD_CONF"}; + $BULK_BUILD_CONF=$ENV{"BULK_BUILD_CONF"}; } else { - $BULK_BUILD_CONF=dirname("$0")."/build.conf"; + $BULK_BUILD_CONF=dirname("$0")."/build.conf"; } # Dig given variable out of config file, and set it -sub getconf -{ - local($var)=@_; - local($val); +sub getconf { + local($var)=@_; + local($val); - chomp($val=`. ./$BULK_BUILD_CONF ; echo \$$var`); - eval "\$$var=\"$val\";"; + chomp($val=`. ./$BULK_BUILD_CONF ; echo \$$var`); + eval "\$$var=\"$val\";"; } - getconf("ADMINSIG"); # "-Your Name" getconf("FTPURL"); # "pub/NetBSD/pkgstat/`date +%Y%m%d.%H%M`" getconf("FTP"); # "/disk1/ftp/${FTPURL}" @@ -35,7 +33,7 @@ getconf("REPORT"); # "broken.html" getconf("USR_PKGSRC"); # "/usr/pkgsrc" getconf("osrev"); # `uname -r` getconf("arch"); # `uname -m` -chomp($date=`date`); +$enddate=localtime(time()); $reportf=basename($REPORT); chomp($os=`uname -s`); @@ -62,175 +60,33 @@ $indfile=basename($INDEXFILE); $ordfile=basename($ORDERFILE); $startfile=basename($STARTFILE); +$startdate = (stat($STARTFILE))[9]; +$startdate = "unknown" if $startdate == 0; + $verbose=1; -if ($verbose) { - print "\n"; - print "*** $os $osrev/$arch\n"; - print "*** Result of bulk pkgsrc build as of $date:\n"; - print "\n"; - printf ("%-23s State \tBreaks\t(last modified, maintainer)\n","Pkg"); -} +$report_head = <$REPORT") or die "Can't write $REPORT: $!\n"; -print HTML < - -$os-$osrev/$arch bulk package build - - - - -

$os $osrev/$arch

-

Output of the pkgsrc bulk build
- as of $date

- - Packages not listed here resulted in a binary package. To see the output of - the (failed) build, select the package below. -

- - Files not listed in PLISTs can be found in this list. -

- - -'; + $nbrokenby_html = + '' + if $nbrokenby > 0; + + if ($pinfo->{nerrors} != 0 && $verbose) { + print swrite($report_form, $pkg, $nbrokenby > 0 ? $nbrokenby : "", $who, $maintainer); + } + + return < + + $nbrokenby_html + + + + + +EOHTML +} + +# write the build report +sub writeReport { + my $broken = getBroken(); + $nbroken = scalar(@{$broken->{"broken"}}); + $nbrokendep = scalar(@{$broken->{"broken depends"}}); + $nunpackaged = scalar(@{$broken->{"not packaged"}}); + $nbrokentot = $nbroken + $nbrokendep; + $ntotal = $nunpackaged + $nbroken + $nbrokendep; + + if ($verbose) { + print <$REPORT") or die "Can't write $REPORT: $!\n"; + print HTML < + +$os $osrev/$arch bulk package build + + + + + +

pkgsrc bulk build results

+

$os $osrev/$arch

+ +

Summary

+ +
Package State Pkgs Broken by Last touched by File touched last Maintainer -EOHTML -; - -# some nifty postprocessing of $FTP/.broken* -> HTML here -$nunpackaged = $nbroken = $nbrokendep = 0; -chdir("$FTP"); -open(BF,"sort +1 $BROKENFILE |") or die "can't open .broken-file '$BROKENFILE'"; -while () { - ($nerrors, $bf, $nbrokenby) = split; - $pkg = $bf; - $pkg =~ s,/$BROKENFILE,,; - -# next -# if $pkg!~/^a/; # DEBUG! HF - - if ($nerrors > 0) { - $color = "red"; - $state = "build broken"; - $nbroken++; - } elsif ($nerrors == -1) { - $color = "orange"; - $state = "broken depends"; - $nbrokendep++; - } else { - $color = "yellow"; - $state = "not packaged"; - $nunpackaged++; - } - - @idents = `${FIND} ${USR_PKGSRC}/${pkg} -type f -print | xargs grep \\\$NetBSD`; - $datetime = ""; - $who = "nobody"; - $file = ""; - $ver = ""; - foreach $ident (@idents) { - $ident =~ /\$[N]etBSD: ([^ ]*),v ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) Exp \$/; - if ("$3 $4" gt $datetime) { - $datetime = "$3 $4"; - $who = $5; - $file = $1; - $ver = $1; - } - } - - $maintainer=`grep ^MAINTAINER $USR_PKGSRC/$pkg/Makefile`; - $maintainer =~ s/MAINTAINER=[ \t]*//; - $maintainer =~ s//>/g; - chomp($maintainer); - - print HTML "
$pkg"; - print HTML " $state"; - if ($nbrokenby > 0){ - print HTML " $nbrokenby"; - } - else { - print HTML " "; - } - print HTML " $who $file"; - print HTML " $maintainer\n"; - - ($category, $dbfeed_pkg) = split('/', $pkg); - - if ($nerrors != 0) { - if ($nbrokenby > 0){ - printf("%-23s $state\t%-5d\t($who, $maintainer)\n", "$pkg:",$nbrokenby) - if $verbose; - } - else { - printf("%-23s $state\t%-5s\t($who, $maintainer)\n", "$pkg:","") - if $verbose; - } - - } +foreach my $f ($DEPENDSTREEFILE, $DEPENDSFILE, $SUPPORTSFILE, $INDEXFILE, $ORDERFILE) { + system("cp ${f} ${FTP}") if -f ${f}; } -close(BF); - -$nbrokentot=$nbroken+$nbrokendep; -$ntotal=$nunpackaged+$nbroken+$nbrokendep; -print HTML < - -
-

-The following cache files were used during the build: -

-

-


- - -
Packages not packaged: $nunpackaged -
Packages really broken: $nbroken -
Pkgs broken due to them: $nbrokendep -
Total broken: $nbrokentot -
Total: $ntotal -
- -
-

-

-

-
-Hubert Feyrer, 1999-2000. - - -EOHTML -; -close(HTML); +chdir($FTP); +writeReport(); # # Adjust "last" symlink @@ -248,7 +104,7 @@ close(HTML); # leftovers-${arch}.html # { - chdir("${FTP}"); + chdir($FTP); system("mkdir -p leftovers-${arch}"); # Find files since last build: @@ -283,38 +139,361 @@ close(HTML); # Add links to leftover list: open (OUT, "> $leftovers_html") or die "can't write $leftovers_html"; - print OUT < - -
+	print OUT <
+
+
 EOOUT
-;
 	foreach (@leftovers) {
-	    	print OUT "$_\n";
+		chomp;
+	    	print OUT "$_\n";
 	}
-	print OUT <
-
-
+	print OUT <
+
+
 EOOUT2
-;
     	close(OUT);
 }
 
-if ($verbose) {
-	print "\n";
-	print "Packages not packaged:     $nunpackaged\n";
-	print "Packages really broken:    $nbroken\n";
-	print "Pkgs broken due to them:   $nbrokendep\n";
-	print "Total broken:              $nbrokentot\n";
-	print "Total:                     $ntotal\n";
-	print "\n";
-	print "See $FTPHOST/$FTPURL/$reportf\n";
-	print "for logs of builds broken or not resulting in a binary pkg.\n";
-	print "\n";
-	print "\n";
-	print "$ADMINSIG\n";
-	print "\n";
-	print "[* This message was created automatically! *]\n";
-	print "\n";
+# print the result of a single broken package
+sub pkgResult {
+	my ($pinfo, $state) = @_;
+	my $pkg = $pinfo->{pkg};
+	my $nbrokenby = $pinfo->{nbrokenby};
+	my $nerrors = $pinfo->{nerrors};
+
+	@idents = `${FIND} ${USR_PKGSRC}/${pkg} -type f -print | xargs grep \\\$NetBSD`;
+	$datetime = "";
+	$who = "nobody";
+	$file = "";
+	$ver = "";
+	foreach $ident (@idents) {
+		$ident =~ /\$[N]etBSD: ([^ ]*),v ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) Exp \$/;
+		if ("$3 $4" gt $datetime) {
+			$datetime = "$3 $4";
+			$who = $5;
+			$file = $1;
+			$ver = $1;
+		}
+	}
+
+	$maintainer = `grep ^MAINTAINER $USR_PKGSRC/$pkg/Makefile`;
+	$maintainer =~ s/MAINTAINER=[ \t]*//;
+	$maintainer =~ s//>/g;
+	chomp($maintainer);
+
+	(my $state_style = $state) =~ s/ //g;
+
+	$nbrokenby_html = '
 '.$nbrokenby.'$pkg$who$file$maintainer
+ + + + + + + + + + + + + + + + + + + + + + + + +
Build started: $startdate
Build ended: $enddate
   
Packages really broken: $nbroken
Packages broken due to them: $nbrokendep
Total broken: $nbrokentot
Not packaged: $nunpackaged
Total: $ntotal
+ +

+ Packages not listed here resulted in a binary + package. Results of failed packages are available below. +

+ +

+ Files leftover from the build (because of broken PLISTs, etc.) can be + found in this + list. +

+EOHTML + + my %state_head = ( + "broken" => "Broken packages", + "broken depends" => "Broken dependencies", + "not packaged" => "Not packaged" + ); + + foreach my $state ("broken", "broken depends", "not packaged") { + next unless scalar(@{$broken->{$state}}); + print HTML <$state_head{$state} + + + + + + + + + +EOHTML + if ($verbose && $state ne "not packaged") { + print "\n\n$state_head{$state}\n\n"; + print $report_head; + } + foreach my $pinfo (@{$broken->{$state}}) { + print HTML pkgResult($pinfo, $state); + } + + print HTML "
PackageBreaksLast commit byFile touched lastMaintainer
\n"; + } + print HTML < +

+The following cache files were used during the build: +

+ +
+ +

+

+

+ + +EOHTML + close(HTML); + + if ($verbose) { + print "\n\n$ADMINSIG\n\n"; + print "[* This message was created automatically! *]\n"; + } +} + +# get and sort the broken packages +sub getBroken { + open (BF, $BROKENFILE) or die "can't open $BROKENFILE: $!"; + my @in = ; + close (BF); + + my $res = {}; + foreach (@in) { + chomp; + my ($nerrors, $bf, $nbrokenby) = split; + (my $pkg = $bf) =~ s,/$BROKENFILE,,; + my %tmp = ( + bf => $bf, + pkg => $pkg, + nbrokenby => $nbrokenby, + nerrors => $nerrors, + ); + + if ($nerrors > 0) { + push(@{$res->{"broken"}}, \%tmp); + } elsif ($nerrors == -1) { + push(@{$res->{"broken depends"}}, \%tmp); + } else { + push(@{$res->{"not packaged"}}, \%tmp); + } + } + + # sort pkgs in each state + foreach my $state ("broken", "broken depends", "not packaged") { + $res->{$state} = [ sort { $a->{pkg} cmp $b->{pkg} } @{$res->{$state}} ]; + } + + return $res; +} + +sub swrite { + my $format = shift; + $^A = ""; + formline($format, @_); + $^A =~ s/\n\n/\n/; + return $^A; } -- cgit v1.2.3