#!/usr/pkg/bin/perl # $NetBSD: post-build,v 1.18 2002/06/29 03:33:34 dmcmahill Exp $ # # Collect stuff after a pkg bulk build # # (c) 2000 Hubert Feyrer, All Rights Reserved. # use File::Basename; # Where config vars are stored (/bin/sh syntax) if (-f $ENV{"BULK_BUILD_CONF"}) { $BULK_BUILD_CONF=$ENV{"BULK_BUILD_CONF"}; } else { $BULK_BUILD_CONF=dirname("$0")."/build.conf"; } # Dig given variable out of config file, and set it sub getconf { local($var)=@_; local($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}" getconf("FTPHOST"); # ftp://ftp.machi.ne/ getconf("REPORT"); # "broken.html" getconf("USR_PKGSRC"); # "/usr/pkgsrc" getconf("osrev"); # `uname -r` getconf("arch"); # `uname -m` chomp($date=`date`); $reportf=basename($REPORT); # extract the name of the files used for the build log and broken build log. # these have defaults set by bsd.bulk-pkg.mk and may be overridden in /etc/mk.conf chomp($BROKENFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=BROKENFILE )`); # also extract the names of the cache files used during the bulk build. We'll save a copy of # those to help debug if the build messed up. chomp($DEPENDSTREEFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=DEPENDSTREEFILE )`); chomp($DEPENDSFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=DEPENDSFILE )`); chomp($SUPPORTSFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=SUPPORTSFILE )`); chomp($INDEXFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=INDEXFILE )`); chomp($ORDERFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=ORDERFILE )`); chomp($STARTFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=STARTFILE )`); chomp($LOCALBASE=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=LOCALBASE )`); chomp($X11BASE=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=X11BASE )`); $dtfile=basename($DEPENDSTREEFILE); $depfile=basename($DEPENDSFILE); $supfile=basename($SUPPORTSFILE); $indfile=basename($INDEXFILE); $ordfile=basename($ORDERFILE); $startfile=basename($STARTFILE); $verbose=1; if ($verbose) { print "\n"; print "*** NetBSD $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"); } system("mkdir -p ${FTP}"); # Copy over the output from the build process chdir("$USR_PKGSRC"); system("tar plcf - $BROKENFILE */*/$BROKENFILE | ( cd ${FTP} ; tar plxf - )"); # Copy over the cache files used during the build if (-f $DEPENDSTREEFILE ) {system("cp $DEPENDSTREEFILE ${FTP}");} if (-f $DEPENDSFILE ) {system("cp $DEPENDSFILE ${FTP}");} if (-f $SUPPORTSFILE ) {system("cp $SUPPORTSFILE ${FTP}");} if (-f $INDEXFILE ) {system("cp $INDEXFILE ${FTP}");} if (-f $ORDERFILE ) {system("cp $ORDERFILE ${FTP}");} open(HTML,">$REPORT") or die "Can't write $REPORT: $!\n"; print HTML < NetBSD-$osrev/$arch bulk package build

NetBSD $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.

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++; } # The idea of this is stolen from bsd.pkg.mk's # show-pkgtools-version target - thanks Al! :-) $whofile = `find ${USR_PKGSRC}/${pkg} -type f -print | xargs ident 2>/dev/null | awk '\$1 ~ /\\\$NetBSD/ { gsub("/", "", \$4); print \$4 " " \$6 " " \$2 }' | sort -n | tail -n 1 | awk '{ print \$2 " " \$3 }' `; $whofile=~s/,v$//; chomp($whofile); ($who,$file) = split(/\s+/, $whofile); # $maintainer=`( cd $USR_PKGSRC/$pkg ; ( echo '.include "Makefile"' ; echo 'bla: ; \@echo ${MAINTAINER}' ) | make -f - bla )`; $maintainer=`grep ^MAINTAINER $USR_PKGSRC/$pkg/Makefile | awk '{ print \$2\$3\$4\$5\$6}' | sed -e '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; } } } 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); # # Adjust "last" symlink # { local($base, $dir) = $FTP=~m|^(.*)/([^/]*)$|; unlink("$base/last"); symlink($dir, "$base/last"); } # # Generate leftovers-${arch}.html: files not deleted # Leftover files are copied to leftovers-${arch} dir, and linked from # leftovers-${arch}.html # { chdir("${FTP}"); system("mkdir -p leftovers-${arch}"); # Find files since last build: system("find ${LOCALBASE} -newer ${USR_PKGSRC}/${startfile} -type f >>leftovers-${arch}.txt"); system("find ${X11BASE} -newer ${USR_PKGSRC}/${startfile} -type f >>leftovers-${arch}.txt"); # Strip perl-files: system("pkg_info -qL perl > .p.${arch}"); system("fgrep -v -x -f .p.${arch} leftovers-${arch}.txt >leftovers-${arch}.txt.new"); rename("leftovers-${arch}.txt.new", "leftovers-${arch}.txt"); unlink(".p.${arch}"); # Store leftovers, for easier identification: system("tar plcf - `cat leftovers-${arch}.txt` | ( cd leftovers-${arch} ; tar plxf - )"); # Add links to leftover list: open (IN, "< leftovers-${arch}.txt") or die "can't read leftovers-${arch}.txt"; open (OUT, "> leftovers-${arch}.html") or die "can't write leftovers-${arch}.html"; print OUT <
EOOUT
;
	while () {
	    	print OUT "$_\n";
	}
	print OUT <


EOOUT2
;
    	close(IN);
    	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";
}