#!/usr/bin/perl $base="/Builds/R-builds/nightly"; $dbase="$base/deploy"; @bstyles=("Debug", "Deployment", "Deployment64", "Leopard", "Leopard64"); @rds=`cat $dbase/builds`; foreach(@rds) { s/[\r\n]+//g; }; @pf=('i386','ppc','x86_64'); ## ppc64 is no longer supported # @pf=('i386','ppc','x86_64','ppc64'); open OUT, ">$base/web/R-builds.html"; print OUT "\n"; foreach $rd (@rds) { ($os,$rd) = split /\//, $rd; if ($trc eq '') { $trc=" bgcolor=#ffffa0"; } else { $trc=''; }; undef @rv; if ( -e "$dbase/$os/$rd/universal/$rd-$os-universal.tar.gz" ) { @rv=`(rm -f '$base/rver.h' '$base/rver'; tar fxzO '$dbase/$os/$rd/universal/$rd-$os-universal.tar.gz' 'Library/Frameworks/R.framework/*/i386/Rversion.h' > '$base/rver.h'; gcc -o '$base/rver' -I '$base' '$base/rver.c' && '$base/rver')`; } $ver=$rv[0]; # $ver=~s/\.$//; # $ver=~s/development /development
/; $rl1=""; $rl=''; $lkf=''; $dl=''; foreach (@pf) { if ( -e "$dbase/$os/$rd/$_" ) { $rl.="$_: "; if (-e "$dbase/$os/$rd/$_/SUCCESS") { $rl.="OK (log)
"; $lkf="$dbase/$os/$rd/$_/SUCCESS"; } elsif (-e "$dbase/$os/$rd/$_/FAILED") { $sf=`cat $dbase/$os/$rd/$_/FAILED`; $bl=`cat $dbase/$os/$rd/$_/build.log`; $rl.=" $sf (log)
"; $lkf="$dbase/$os/$rd/$_/FAILED"; } else { $rl.="MISSING
"; } } } $rl.="universal: "; if (-e "$dbase/$os/$rd/universal/SUCCESS") { $rl.="OK
"; $lkf="$dbase/$os/$rd/universal/SUCCESS"; if (-e "$dbase/$os/$rd/universal/$rd-$os-universal.tar.gz") { $sz=`ls -lh $dbase/$os/$rd/universal/$rd-$os-universal.tar.gz|awk '{print \$5}'`; chop $sz; $dl="$rd-$os-universal.tar.gz (${sz}b)"; } $dmg=`ls $dbase/$os/$rd/universal/$rd-*.dmg 2>/dev/null|sort|tail -n 1`; chop $dmg; if ($dmg ne '' && (-e $dmg)) { $sz=`ls -lh $dmg|awk '{print \$5}'`; $dmg=`basename \"$dmg\"`; chop $dmg; chop $sz; $dl.="
$dmg (${sz}b, installer incl. GUI)"; } $lpkg="$dbase/$os/$rd/universal/$rd-$os.pkg"; if ( -e $lpkg ) { $sz=`ls -lh $lpkg|awk '{print \$5}'`; $lpkg=`basename \"$lpkg\"`; chop $lpkg; chop $sz; $dl.="
$lpkg (${sz}b, installer incl. GUI)"; } # if ($os eq 'leopard' && $rd=~/^R-2.9-/) { ## manual override! # $dl.="
(For an installer package see the Leopard build section below)"; # } } elsif (-e "$dbase/$os/$rd/universal/FAILED") { $sf=`cat $dbase/$os/$rd/universal/FAILED`; $rl.="FAILED: $sf
"; $lkf="$dbase/$os/$rd/universal/FAILED"; } else { $rl.="MISSING
"; } $lkd=''; $lkd=`ls -l "$lkf" |awk '{print \$6,\$7,\$8}'` if ($lkf ne ''); chop $lkd; $logs=''; @suff=('check','conf','build'); foreach $a (@pf) { open LOUT, ">$base/web/log-$rd.$os.$a.html"; print LOUT "

$rd, $os, $a

"; foreach(@suff) { print LOUT "$_   "; }; print LOUT "
BuildOSDateStatusDownload
$rd
$ver
$os
"; foreach $pf (@suff) { $fc=($pf=~/err$/)?"#c00000":"#0000c0"; $da=`stat $dbase/$os/$rd/$a/$pf 2>/dev/null`; $da=~s/\".*?\"//; $da=$1 if ($da=~/\"(.*?)\"/); print LOUT "\n"; } print LOUT "
$pf - $da
";
	    open INA, "$dbase/$os/$rd/$a/$pf"; while() {
		#s//>/g;
		s/\#\@1\@\#//g;
		s/\#\@2\@\#/
/g; s/\@\#.\#\@/<\/font>/g; print LOUT $_; }; close INA; print LOUT "
"; close LOUT; } if ($dl eq '') { $rl="$rl1$lkd$rl\n"; } else { $rl="$rl1$lkd$rl$dl\n"; } print OUT $rl; foreach $bsty (@bstyles) { $gf=`ls $dbase/$os/$rd/universal/R-GUI*-$bsty.dmg 2>/dev/null|sort -r|head -n 1`; $gf=~s/[\r\n]+//g; push @guilist, $gf if ($gf ne ''); } } print OUT "\n"; close OUT; open OUT, ">$base/web/GUI.html"; print OUT ""; $trc=''; foreach (@guilist) { $gfn=$_; s/.dmg$//i; s/^.*\///; $rl=''; if ($trc eq '') { $trc=" bgcolor=#ffffa0"; } else { $trc=''; }; if (/GUI-(\d+)-(\d+\.\d+)-(.*)/) { $rl="\n"; } print OUT $rl; } print OUT "
VersionBuildDownload
Mac OS X GUI rev. $1 for R $2.x$3$_.dmg
\n"; close OUT; sub fetch { my($a); $a=''; open INF,"$base/web/$_[0]"; while() { $a.=$_; }; close INF; $a; }; open IN, "$base/web/index.in.html"; open OUT, ">$base/web/index.html"; while() { s//fetch($1)/ge; print OUT $_; } close IN; close OUT;