#!/usr/bin/perl
$base="/Builds/R-builds/nightly";
$dbase="$base/deploy";
@bstyles=("Debug", "Release"); ## "Deployment", "Deployment64", "Leopard", "Leopard64", "SnowLeopard64");
@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');
@pf=('x86_64');
$rsuff='sa-x86_64';
open OUT, ">$base/web/R-builds.html";
print OUT "
Build | OS | Date | Status | Download |
\n";
foreach $rd (@rds) {
($os,$rd) = split /\//, $rd;
if ($trc eq '') { $trc=" bgcolor=#ffffa0"; } else { $trc=''; };
undef @rv;
print " - processing $os $rd\n";
if ( -e "$dbase/$os/$rd/$rd-$os-$rsuff.tar.gz" ) {
@rv=`(rm -f '$base/rver.h' '$base/rver'; tar fxzO '$dbase/$os/$rd/$rd-$os-$rsuff.tar.gz' 'Library/Frameworks/R.framework/*/Rversion.h' > '$base/rver.h'; gcc -o '$base/rver' -I '$base' '$base/rver.c' && '$base/rver')`;
} elsif ( -e "$dbase/$os/$rd/x86_64/$rd.tar.gz" ) {
@rv=`(rm -f '$base/rver.h' '$base/rver'; tar fxzO '$dbase/$os/$rd/x86_64/$rd.tar.gz' 'Library/Frameworks/R.framework/*/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="$rd $ver | $os | ";
$rl='';
$lkf='';
$dl='';
foreach (@pf) {
if ( -e "$dbase/$os/$rd/$_/SUCCESS" || -e "$dbase/$os/$rd/$_/FAILED" ) {
if (-e "$dbase/$os/$rd/$_/SUCCESS") {
print " old-style, OK\n";
$rl.="$_: OK (log)
"; $lkf="$dbase/$os/$rd/$_/SUCCESS";
} elsif (-e "$dbase/$os/$rd/$_/FAILED") {
print " old-style, FAILED\n";
$sf=`cat $dbase/$os/$rd/$_/FAILED`;
$bl=`cat $dbase/$os/$rd/$_/build.log`;
$rl.="$_: $sf (log)
";
$lkf="$dbase/$os/$rd/$_/FAILED";
} else {
# $rl.="MISSING
";
}
} elsif ( -e "$dbase/$os/$rd/$_/$rd.SUCCESS" || -e "$dbase/$os/$rd/$_/$rd.FAILED" ) {
if (-e "$dbase/$os/$rd/$_/$rd.SUCCESS") {
print " R4, OK\n";
$rl.="$_: OK (log)
"; $lkf="$dbase/$os/$rd/$_/$rd.SUCCESS";
} elsif (-e "$dbase/$os/$rd/$_/$rd.FAILED") {
print " R4, FAILED\n";
$sf=`cat $dbase/$os/$rd/$_/$rd.FAILED`;
$bl=`cat $dbase/$os/$rd/$_/build.log`;
$rl.="$_: $sf (log)
";
$lkf="$dbase/$os/$rd/$_/FAILED";
} else {
# $rl.="MISSING
";
}
}
}
if (-e "$dbase/$os/$rd/universal/SUCCESS") {
$rl.="universal: 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.="universal: FAILED: $sf
";
$lkf="$dbase/$os/$rd/universal/FAILED";
}
if (-e "$dbase/$os/$rd/$rd.pkg") {
$rl.="Package: OK
";
# $lkf="$dbase/$os/$rd/universal/SUCCESS";
if (-e "$dbase/$os/$rd/x86_64/$rd.tar.gz") {
$sz=`ls -lh $dbase/$os/$rd/x86_64/$rd.tar.gz|awk '{print \$5}'`;
chop $sz;
$dl="
$rd.tar.gz (${sz}b)";
}
$lpkg="$dbase/$os/$rd/$rd.pkg";
if ( -e $lpkg ) {
$lkf = $lpkg;
$sz=`ls -lh $lpkg|awk '{print \$5}'`;
$lpkg=`basename \"$lpkg\"`; chop $lpkg;
chop $sz;
$dl.="
$lpkg (${sz}b, installer incl. GUI)";
}
} elsif (-e "$dbase/$os/$rd/$rd-$os.pkg") {
$rl.="Package: OK
";
# $lkf="$dbase/$os/$rd/universal/SUCCESS";
if (-e "$dbase/$os/$rd/$rd-$os-$rsuff.tar.gz") {
$sz=`ls -lh $dbase/$os/$rd/$rd-$os-$rsuff.tar.gz|awk '{print \$5}'`;
chop $sz;
$dl="
$rd-$os-$rsuff.tar.gz (${sz}b)";
}
$lpkg="$dbase/$os/$rd/$rd-$os-signed.pkg";
if ( -e $lpkg ) {
$lkf = $lpkg;
$sz=`ls -lh $lpkg|awk '{print \$5}'`;
$lpkg=`basename \"$lpkg\"`; chop $lpkg;
chop $sz;
$dl.="
$lpkg (${sz}b, installer incl. GUI)";
} else {
$lpkg="$dbase/$os/$rd/$rd-$os.pkg";
if ( -e $lpkg ) {
$lkf = $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.="Package: FAILED: $sf
";
$lkf="$dbase/$os/$rd/universal/FAILED";
}
$lkd='';
$lkd=`ls -l "$lkf" |awk '{print \$6,\$7,\$8}'` if ($lkf ne '');
chop $lkd;
$logs='';
@suff=('check','conf','build');
foreach $a (@pf) {
print " - generating log-$rd.$os.$a.html\n";
open LOUT, ">$base/web/log-$rd.$os.$a.html";
print LOUT "$rd, $os, $a
";
foreach(@suff) { print LOUT "$_ "; };
print LOUT "
";
foreach $pf (@suff) {
$fc=($pf=~/err$/)?"#c00000":"#0000c0";
$fn="$dbase/$os/$rd/$a/$pf";
if ( -e "$dbase/$os/$rd/$a/$rd.$pf" ) { $fn="$dbase/$os/$rd/$a/$rd.$pf" }
$da=`stat $fn 2>/dev/null`; $da=~s/\".*?\"//; $da=$1 if ($da=~/\"(.*?)\"/);
print LOUT "$pf - $da |
";
open INA, "$fn"; while() {
#s/</g;
#s/>/>/g;
s/\#\@1\@\#//g;
s/\#\@2\@\#/ /g;
s/\@\#.\#\@/<\/font>/g;
print LOUT $_;
}; close INA;
print LOUT " |
\n";
}
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/R-GUI*-$bsty.dmg 2>/dev/null|sort -r|head -n 1`;
$gf=~s/[\r\n]+//g;
push @guilist, $gf if ($gf ne '');
$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 "Version | Build | Download |
";
$trc='';
foreach (@guilist) {
$gfn=$_;
$lnk=$_;
if (/\/universal/) {
s/^.*\///;
$lnk=$_;
} else {
$lnk=~s/.*deploy\///;
s/^.*\///;
}
$rl='';
if ($trc eq '') { $trc=" bgcolor=#ffffa0"; } else { $trc=''; };
if (/GUI-(\d+)-(\d+\.\d+)-(.*)/) {
$rl="Mac OS X GUI rev. $1 for R $2.x | $3 | $_ |
\n";
}
print OUT $rl;
}
print OUT "
\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;