Thread: [Compbench-web-devel] compbenchmarks-web/tools maint-import-doc.pl, NONE, 1.1 maint-info-compilers.
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-09-11 17:19:47
|
Update of /cvsroot/compbench/compbenchmarks-web/tools In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17459 Added Files: maint-import-doc.pl maint-info-compilers.pl Makefile verchecker.pl Log Message: First import. --- NEW FILE: maint-info-compilers.pl --- #!/usr/bin/perl -w -I ../../CompBenchmarks++/CBM-PI -I ../../CompBenchmarks++/testing/CBM-PI/ use CBM; use strict; push(@INC, "../../CompBenchmarks++/CBM-PI/t/lib"); # push(@INC, "~/compbenchmarks/share/compbenchmarks/0.5.0/perl"); require "compilers.pl"; my $WWW_LIBCOMPBENCHMARKS_SRCDIR; our %COMPILER_FAKE_INTERFACES; my @SUPPORTED_COMPILERS; # = ('gcc', 'g++'); # tcc my %SUPPORTED_COMPILER_VERSIONS; # = ('gcc' => [ '2.95.x', '3.0.x'], # 'g++' => [ '2.95.x', '3.0.x']); my %SUPPORTED_COMPILER_FAKE; my $WEB_OUTPUT_DIR = "../tmp/doc"; my $DOC_FILE_PREFIX = "compbenchmarks-maint-compilers"; my $sys; sub init_compilers { my $c; my %C; foreach $c (keys %COMPILER_FAKE_INTERFACES) { my $cid; my $ver; if ($COMPILER_FAKE_INTERFACES{$c}=~ /(.*?)-(.*)/) { $cid=$1; $ver=$2; } if ((!defined($cid)) || (!defined($ver))) { print STDERR "Can't find CID and branch for $c\n"; $cid=undef; $ver=undef; next; } if ((!defined($C{$cid})) || (!defined($C{$cid}->{$ver}))) { $C{$cid}->{$ver}=$c; } $cid=undef; $ver=undef; } @SUPPORTED_COMPILERS=keys %C; my $v; foreach $c (@SUPPORTED_COMPILERS) { foreach $v (keys %{$C{$c}}) { push(@{$SUPPORTED_COMPILER_VERSIONS{$c}}, $v); $SUPPORTED_COMPILER_FAKE{"$c-$v"}=$C{$c}->{$v}; } } } sub compiler_info { my $cid = shift; my $ver = shift; my $f = "$WEB_OUTPUT_DIR/$DOC_FILE_PREFIX-zoom-$cid-$ver.html"; my $i; my $cfake = "$WWW_LIBCOMPBENCHMARKS_SRCDIR/CBM-PI/t/reference/" . $SUPPORTED_COMPILER_FAKE{"$cid-$ver"}; my $d1 = "/home/fred/workspace/CompBenchmarks++/testing"; my $d0 = `pwd`; chomp($d0); chdir($d1); my $CS = new CBM::CompilerSelector($sys); my $C = $CS->select($cfake); my $OD = $C->OptionDescriptions(); my $n = $OD->DescriptionNumber(); print " * $cid $ver\n"; chdir($d0); open(FD, ">$f") || die ("Can't open $f for writing."); print FD "<p><a href='/cgi-bin/doc.cgi?tab=compilers'>Back to compiler list</a>.</p>\n"; print FD "<h2>$cid $ver</h2>\n"; my $tr_class = "l1"; print FD "<table summary='$cid-$ver options' class='supcomp'>\n"; if (!$n) { print FD "<tr><td>No option defined in knowledge base yet.</td></tr>"; } for($i=0; $i<$n; $i++) { my $O = $OD->Description($i); print FD "<tr class='$tr_class'><td colspan='2' class='supcomp_head'>" . $O->ShortDescription() . "</td></tr>"; print FD "<tr class='$tr_class'><td class='supcomp_opt'>" . $O->Option() . "</td><td class='supcomp_detail'>" . $O->EditorDescription() . "</td></tr>\n"; if ($tr_class eq 'l1') { $tr_class='l2'; } else { $tr_class='l1'; } } print FD "</table>"; close(FD); } sub compilers_supported { my $c; my $v; my $f = "$WEB_OUTPUT_DIR/$DOC_FILE_PREFIX-summary.html"; print "Generating $f\n"; open(FD, ">$f"); print FD "<p>This list shows explicitly supported compilers, according to internal knownledge base of <i>libcompbenchmarks</i> <b>" . $sys->Version() . "</b>. Newer versions of a given compiler should work and will use the higher's version options defined there.</p>"; print FD "<table summary=\"supported compilers' summary\">\n"; foreach $c (sort @SUPPORTED_COMPILERS) { print FD "<tr><td>$c</td></td><td>"; my $url_c; foreach $v (sort @{$SUPPORTED_COMPILER_VERSIONS{$c}}) { $url_c = $c; $url_c=~ s/\+/%2B/g; print FD "<a href='/cgi-bin/doc.cgi?tab=compilers&cid=$url_c&ver=$v'>$v</a> "; } print FD "</td></tr>\n"; } print FD "</table>\n"; close(FD); } sub compilers_infos { my $c; my $v; foreach $c (@SUPPORTED_COMPILERS) { foreach $v (@{$SUPPORTED_COMPILER_VERSIONS{$c}}) { compiler_info($c, $v); } } } if (!defined($ENV{WWW_LIBCOMPBENCHMARKS_SRCDIR})) { print STDERR "WWW_LIBCOMPBENCHMARKS_SRCDIR environment variable not set.\n"; print STDERR "Use make.\n"; print STDERR "Aborting\n"; exit(1); } else { $WWW_LIBCOMPBENCHMARKS_SRCDIR=$ENV{WWW_LIBCOMPBENCHMARKS_SRCDIR}; } $sys = CBM::Init(); init_compilers(); compilers_supported(); compilers_infos(); $sys->done(); --- NEW FILE: maint-import-doc.pl --- #!/usr/bin/perl -w use strict; # !!! # http://biomass/cgi-bin/doc.cgi?tab=core&version=0.5.0&target=classCBM_1_1Benchmark.html my $SRC_DOC_PATH = "/home/fred/workspace/CompBenchmarks++/doc/html"; my $VERSION = "0.5.0-BETA2"; my $DEST_DOC_PATH = "/home/fred/workspace/compbenchmarks-web/tmp/doc/$VERSION"; my $HTMLFILE_PREFIX = "/cgi-bin/doc.cgi?tab=core&version=$VERSION&target="; my $BIN_PATH = "/home/fred/workspace/CompBenchmarks++/testing"; sub treat_htmlfile { my $file = shift; my $htmlfile_prefix = $HTMLFILE_PREFIX; my $png_prefix = "\/tmp\/doc\/$VERSION"; # $htmlfile_prefix =~ s/\//\\\//g; my @data = `cat $SRC_DOC_PATH/$file`; $file="$DEST_DOC_PATH/$file"; my @out; chomp(@data); my $s; foreach $s (@data) { $s=~ s/\shref=\"(.*?)\.html(.*?)\"/ href=\"$htmlfile_prefix$1.html$2\"/g; #$s=~ s/ href=\"(.*)\.html\"/ href=\"$htmlfile_prefix$1.html\"/g; $s=~ s/^<!DOCTYPE.*>//g; $s=~ s/^<html>.*>//g; $s=~ s/^<title>.*\$//g; $s=~ s/^<link href=\".*\.css\">.*\$//g; $s=~ s/^<\/head>.*$//g; $s=~ s/^<\/body>$//g; $s=~ s/^<\/html>$//g; $s=~ s/src=\"(.*)\.png\"/src=\"$png_prefix\/$1.png\"/g; $s=~ s/src=\"(.*)\.gif\"/src=\"$png_prefix\/$1.gif\"/g; push(@out, "$s\n"); } open(FD, ">$file") || die ("$! $file"); print FD @out; close(FD); } sub treat { my $n; my $i; print "Getting files from $SRC_DOC_PATH... "; my @files = `ls -1 $SRC_DOC_PATH`; $n=(@files+0); print "OK ($n)\n"; # treat_htmlfile("classes.html"); # exit(0); # treat_htmlfile("Benchmark_8h-source.html"); # exit(0); # treat_htmlfile("classCBM_1_1Benchmark.html"); # exit(0); foreach(@files) { chomp; if (/.html$/) { treat_htmlfile($_); } else { if (/\.gif$/) { `cp $SRC_DOC_PATH/$_ ../tmp/doc`; } else { `cp $SRC_DOC_PATH/$_ $DEST_DOC_PATH`; } } $i++; print "Progress : " . sprintf("%0.2f", ($i*100.0)/$n) . "%\r"; } print "\n"; } sub doc_bin { my %docs = ('compbenchmarks-core-h.raw' => { 'directory' => 'compbenchmarks-core', 'command' => './compbenchmarks-core -h'}, 'compbenchmarks-core-qH.raw' => { 'directory' => 'compbenchmarks-core', 'command' => './compbenchmarks-core -qH'}, 'compbenchmarks-core-qcgcc.raw' => { 'directory' => 'compbenchmarks-core', 'command' => './compbenchmarks-core -qc gcc'}, 'compbenchmarks-core-qip.raw' => { 'directory' => 'compbenchmarks-core', 'command' => './compbenchmarks-core -qip'}, 'compbenchmarks-core-qacA.raw' => { 'directory' => 'compbenchmarks-core', 'command' => "./compbenchmarks-core -qa -c gcc -A '-O3 -finline-functions'"}, 'compbenchmarks-core-mI.raw' => { 'directory' => 'compbenchmarks-core', 'before' => "./compbenchmarks-core -m -U linpackc", 'command' => "./compbenchmarks-core -m -I linpackc" }, 'compbenchmarks-core-mU.raw' => { 'directory' => 'compbenchmarks-core', 'before' => "./compbenchmarks-core -m -I linpackc", 'command' => "./compbenchmarks-core -m -U linpackc" }, 'compbenchmarks-core-B.raw' => { 'directory' => 'compbenchmarks-core', 'command' => "./compbenchmarks-core -B linpackc-dp-roll gcc '-O3'"}, ); my $of; foreach $of (keys %docs) { my $cmd_directory = $docs{$of}->{directory}; my $cmd = $docs{$of}->{command}; my $sh = "cd $BIN_PATH"; my $sh2 = "cd $cmd_directory && $cmd"; my $shall = "$sh && $sh2"; if (defined($docs{$of}->{before})) { my $bef = "cd $BIN_PATH && cd $cmd_directory && $docs{$of}->{before}"; `$bef`; } my @output = `$shall`; unlink("dum"); chomp(@output); foreach(@output) { $_=~ s/\</</g; $_=~ s/\>/>/g; $_=~ s/$/\<br\>\n/g; $_=~ s/ / /g; } my $F = "../tmp/doc/compbenchmarks-bin-$of"; print "Generating $F\n"; open(FD, ">$F") || die ("$!"); print FD "# <b>$sh2</b><br>"; foreach(@output) { print FD $_; } close(FD); } } $|=1; # treat(); doc_bin(); --- NEW FILE: verchecker.pl --- #!/usr/bin/perl -w use strict; push (@INC, "../lib"); require "config.pl"; our $LT_CBM_VERSION; use CBM; config_read("../etc/compbenchmarks-web.conf"); my $sys = CBM::Init(); if ($sys->Version() eq $LT_CBM_VERSION) { print "Versions match ($LT_CBM_VERSION)\n"; exit(0); } else { print "Versions mismatch : web-site relies on $LT_CBM_VERSION, CBM is " . $sys->Version() . "\n"; exit(1); } --- NEW FILE: Makefile --- # ----------------------------------------------------------------------------- # $Id: Makefile,v 1.1 2007/09/11 17:19:43 xfred Exp $ # # This is free software. # For details, see the GNU Public License in the COPYING file, or # Look http://www.fsf.org # ----------------------------------------------------------------------------- WWW_LIBCOMPBENCHMARKS_SRCDIR = ../../CompBenchmarks++ WWW_LIBCOMPBENCHMARKS_COMPDIR = $(WWW_LIBCOMPBENCHMARKS_SRCDIR)/testing PERL = ../bin/perl CBM_PERL = export LD_LIBRARY_PATH=$(WWW_LIBCOMPBENCHMARKS_COMPDIR)/.libs && WWW_LIBCOMPBENCHMARKS_SRCDIR=$(WWW_LIBCOMPBENCHMARKS_SRCDIR) $(PERL) -w -I$(WWW_LIBCOMPBENCHMARKS_COMPDIR)/CBM-PI -I$(WWW_LIBCOMPBENCHMARKS_SRCDIR)/CBM-PI -I$(WWW_LIBCOMPBENCHMARKS_COMPDIR)/libcompbenchmarks/share/perl -I$(WWW_LIBCOMPBENCHMARKS_SRCDIR)/CBM-PI/t/lib all: ver maint-compilers maint-import-doc import-doc ver: verchecker.pl $(CBM_PERL) $< maint-compilers: maint-info-compilers.pl $(CBM_PERL) $< maint-import-doc: maint-import-doc.pl $(CBM_PERL) $< import-doc: import-doc.pl $(CBM_PERL) $< |