From: Ben Pfaff Date: Wed, 17 Feb 2010 01:17:40 +0000 (-0800) Subject: work on output formatting X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38fb5346628a7b16e9f2a3d066059539037498bf;p=pspp work on output formatting --- diff --git a/build-pspp b/build-pspp index e7c819cc6d..f151cc1f88 100755 --- a/build-pspp +++ b/build-pspp @@ -25,9 +25,6 @@ usage () if $help; die "$0: exactly one or two nonoption arguments are required\n" if @ARGV != 1 && @ARGV != 2; -my $builder = `hostname`; -chomp $builder; - # Select build number. if (!defined ($build_number)) { $build_number = POSIX::strftime("%Y%m%d%H%M%S", localtime); @@ -55,7 +52,9 @@ VARS->autoflush (1); my $logfile = "$resultsdir/LOG"; open (LOG, '>', $logfile) or die "creating $logfile failed: $!\n"; -set_var ("builder", $builder); +my $build_host = `hostname`; +chomp $build_host; +set_var ("build_host", $build_host); set_var ("build_number", $build_number); sub start_step { @@ -78,17 +77,17 @@ sub set_var { } sub saved_result { - my ($product) = @_; - start_step ("Saving $product"); + my ($name, $product) = @_; + start_step ("Saving $name: $product"); } sub save_result { - my ($src, $rm_src) = @_; + my ($name, $src, $rm_src) = @_; my ($basename) = $src; $basename =~ s(^.*/)(); my ($dst) = "$resultsdir/$basename"; - saved_result ($basename); + saved_result ($name, $basename); run ("cp -R $src $dst"); if (defined ($rm_src) && $rm_src) { @@ -99,7 +98,7 @@ sub save_result { } sub save_result_if_exists { - my ($src, $rm_src) = @_; + my ($name, $src, $rm_src) = @_; if (-e $src) { save_result (@_); } else { @@ -239,18 +238,18 @@ EOF start_step ("Make source tarball"); run ("cd $builddir/pspp$build_number/_build && make dist", "dist"); my $tarname = "pspp-$version.tar.gz"; - $tarball = save_result ("$builddir/pspp$build_number/_build/$tarname", 1); + $tarball = save_result ("source distribution", "$builddir/pspp$build_number/_build/$tarname", 1); # Build user manual start_step ("Build user manual"); run ("cd $builddir/pspp$build_number && cp _build/doc/*.texi doc/"); run ("cd $builddir/pspp$build_number && GENDOCS_TEMPLATE_DIR=$topdir $topdir/gendocs.sh -s doc/pspp.texinfo -o $abs_resultsdir/user-manual --email bug-gnu-pspp\@gnu.org pspp \"GNU PSPP User Manual\"", "user-manual"); - saved_result ("user-manual"); + saved_result ("User Manual", "user-manual"); # Build developer's guide start_step ("Build developers guide"); run ("cd $builddir/pspp$build_number && GENDOCS_TEMPLATE_DIR=$topdir $topdir/gendocs.sh -s doc/pspp-dev.texinfo -o $abs_resultsdir/dev-guide --email bug-gnu-pspp\@gnu.org pspp-dev \"GNU PSPP Developers Guide\"", "dev-guide"); - saved_result ("dev-guide"); + saved_result ("Developers Guide", "dev-guide"); } else { $tarball = $ARGV[0]; } @@ -278,7 +277,8 @@ if ($build_binary) { run ("chmod a-w $builddir/$tarball_dir"); my $ok = try_run ("cd $builddir/$tarball_dir/_build && ../configure --enable-relocatable --prefix=''", "bin-configure"); for my $basename ("config.h", "config.log") { - save_result_if_exists ("$builddir/$tarball_dir/_build/$basename"); + save_result_if_exists ("build configuration", + "$builddir/$tarball_dir/_build/$basename"); } fail () if !$ok; @@ -290,12 +290,12 @@ if ($build_binary) { start_step ("Make binary distribution"); run ("cd $builddir/$tarball_dir/_build && tar cfz pspp-$binary_version.tar.gz pspp-$binary_version"); - save_result ("$builddir/$tarball_dir/_build/pspp-$binary_version.tar.gz", 1); + save_result ("binary distribution", "$builddir/$tarball_dir/_build/pspp-$binary_version.tar.gz", 1); start_step ("Check"); $ok = try_run ("cd $builddir/$tarball_dir/_build && make check", "check"); for my $basename ("tests/testsuite.log", "tests/testsuite.dir") { - save_result_if_exists ("$builddir/$tarball_dir/_build/$basename"); + save_result_if_exists ("test logs", "$builddir/$tarball_dir/_build/$basename"); } fail () if !$ok; diff --git a/results2html b/results2html index 8f8725f82f..abc520d3db 100755 --- a/results2html +++ b/results2html @@ -6,17 +6,8 @@ use warnings; use HTML::Entities; open (LOG, '<', "LOG"); -open (INDEX, '>','index.html'); open (LOG_HTML, '>', "log.html"); -print INDEX < - - - - -EOF - print LOG_HTML < @@ -39,22 +30,12 @@ sub read_vars { } return %vars; } - my (%vars) = read_vars ('VARS'); -print INDEX "

Build Properties

\n"; -print INDEX "\n"; -print INDEX "\n"; -foreach my $key (sort (keys (%vars))) { - print INDEX ""; - print INDEX ""; - print INDEX ""; - print INDEX "\n"; -} -print INDEX "
NameValue
", encode_entities ($key), "", encode_entities ($vars{$key}), "
\n"; my (@products); my (@steps); my ($new_page) = 0; +my ($result) = "failure"; while () { my $ln = $.; chomp; @@ -69,11 +50,12 @@ while () { if ($new_page) { $new_page = 0; $log_class = "step"; - if (my ($product) = /^Saving (.*)$/) { + if (my ($name, $product) = /^Saving(?:([^:]*):)?\s+(.*)$/) { my $href = "$product/index.html"; $href = $product if ! -e $href; my (%p); + $p{NAME} = $name if defined ($name); $p{PRODUCT} = $product; $p{HREF} = $href; $p{LN} = $ln; @@ -85,10 +67,11 @@ while () { $s{LN} = $ln; push (@steps, \%s); } + $result = 'success' if $_ eq 'Success'; } else { - if (my ($diagnostic) = /(error|warning):/) { + if (my ($diagnostic) = /(error|warning):/i) { my (%d); - $d{DIAGNOSTIC} = $diagnostic; + $d{DIAGNOSTIC} = lc ($diagnostic); $d{MESSAGE} = $_; $d{LN} = $ln; push (@{$steps[$#steps]{CHILDREN}}, \%d); @@ -104,10 +87,35 @@ while () { } } +open (INDEX, '>','index.html'); + +print INDEX < + + + + +EOF + +print INDEX "

Build ", $vars{"build_number"}, ": $result

\n"; + +print INDEX "

Build Properties

\n"; +print INDEX "\n"; +print INDEX "\n"; +foreach my $key (sort (keys (%vars))) { + print INDEX ""; + print INDEX ""; + print INDEX ""; + print INDEX "\n"; +} +print INDEX "
NameValue
", encode_entities ($key), "", encode_entities ($vars{$key}), "
\n"; + print INDEX "

Build Products

\n"; print INDEX "