#! /usr/bin/env perl
+use Cwd;
+use File::Spec;
use Getopt::Long qw(:config bundling no_ignore_case);
+use IO::Handle;
use POSIX;
-use Cwd;
use strict;
use warnings;
my $help = 0;
my $build_binary = 1;
my $batch = 0;
+my $builddir;
+my $build_number;
GetOptions ("h|help" => \$help,
"binary!" => \$build_binary,
- "batch!" => \$batch);
+ "batch!" => \$batch,
+ "o|output=s" => \$builddir,
+ "build-number=i" => \$build_number);
usage () if $help;
chomp $builder;
# Select build number.
-my $build_number = POSIX::strftime("%Y%m%d%H%M%S", localtime);
-print "$build_number\n" if $batch;
+if (!defined ($build_number)) {
+ $build_number = POSIX::strftime("%Y%m%d%H%M%S", localtime);
+}
my $topdir = getcwd ();
# Create build directory.
-my $builddir = "builds/$build_number";
-mkdir "builds" or die "builds: mkdir: $!\n" if ! -d "builds";
-mkdir $builddir or die "$builddir: mkdir: $!\n";
+if (!defined ($builddir)) {
+ $builddir = "builds/$build_number";
+ mkdir "builds" or die "builds: mkdir: $!\n" if ! -d "builds";
+}
+-d $builddir or mkdir $builddir or die "$builddir: mkdir: $!\n";
+my $abs_builddir = File::Spec->rel2abs ($builddir);
our $resultsdir = "$builddir/results";
mkdir $resultsdir or die "$resultsdir: mkdir: $!\n";
mkdir "$resultsdir/vars" or die "$resultsdir/vars: mkdir: $!\n";
+my $abs_resultsdir = File::Spec->rel2abs ($resultsdir);
+
+my $varsfile = "$resultsdir/VARS";
+open (VARS, '>', $varsfile) or die "creating $varsfile failed: $!\n";
+VARS->autoflush (1);
my $logfile = "$resultsdir/LOG";
open (LOG, '>', $logfile) or die "creating $logfile failed: $!\n";
sub set_var {
my ($var, $value) = @_;
+
+ print VARS "$var=$value\n";
+
+ print "\t$var=$value\n" unless $batch;
+
open (VAR, '>', "$resultsdir/vars/$var")
or die "creating $resultsdir/$var failed: $!\n";
print VAR "$value\n";
close VAR;
- print LOG "$var=$value\n";
- print "\t$var=$value\n" unless $batch;
+}
+
+sub saved_result {
+ my ($product) = @_;
+ start_step ("Saving $product");
}
sub save_result {
my ($src, $rm_src) = @_;
- my ($dst) = $src;
- $dst =~ s(^.*/)();
- $dst = "$resultsdir/$dst";
+ my ($basename) = $src;
+ $basename =~ s(^.*/)();
+ my ($dst) = "$resultsdir/$basename";
- start_step ("Saving $src");
+ saved_result ($basename);
run ("cp -R $src $dst");
if (defined ($rm_src) && $rm_src) {
# 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 $topdir/$builddir/results/user-manual --email bug-gnu-pspp\@gnu.org pspp \"GNU PSPP User Manual\"", "user-manual");
+ 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");
# 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 $topdir/$builddir/results/dev-guide --email bug-gnu-pspp\@gnu.org pspp-dev \"GNU PSPP Developers Guide\"", "dev-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");
} else {
$tarball = $ARGV[0];
}
--- /dev/null
+#! /usr/bin/env perl
+
+use strict;
+use warnings;
+
+use HTML::Entities;
+
+open (LOG, '<', "LOG");
+open (INDEX, '>','index.html');
+open (LOG_HTML, '>', "log.html");
+
+print INDEX <<EOF;
+<html>
+<head>
+ <link rel="stylesheet" href="build.css">
+</head>
+<body>
+<ol>
+EOF
+
+print LOG_HTML <<EOF;
+<html>
+<head>
+ <link rel="stylesheet" href="build.css">
+</head>
+<body>
+EOF
+print LOG_HTML "<pre>";
+
+my ($n_products) = 0;
+my ($n_steps) = 0;
+my ($new_page) = 0;
+while (<LOG>) {
+ my $ln = $.;
+ chomp;
+
+ if (/^\f$/) {
+ $new_page = 1;
+ print LOG_HTML "</pre><hr><pre>\n";
+ next;
+ }
+
+ my $log_class;
+ if ($new_page) {
+ $new_page = 0;
+ $log_class = "step";
+ if (my ($product) = /^Saving (.*)$/) {
+ print INDEX "\n <ul>\n" if !$n_products++;
+ my $href = "$product/index.html";
+ $href = $product if ! -e $href;
+ print INDEX " <li><a href=\"", encode_entities ($href), "\">";
+ print INDEX encode_entities ($product), "</a>";
+ print INDEX " <small><a href=\"log.html#$ln\">(log)</a></small>";
+ print INDEX "</li>\n";
+ } else {
+ print INDEX "</ul>" if !$n_steps;
+ print INDEX "<li>", encode_entities ($_);
+ print INDEX " <small><a href=\"log.html#$ln\">(log)</a></small>";
+ $n_products = 0;
+ }
+ } else {
+ if (my ($diagnostic) = /(error|warning):/) {
+ if ($n_products) {
+ print INDEX " </ul>\n";
+ $n_products = 0;
+ }
+ print INDEX "<p class=\"$diagnostic\">";
+ print INDEX "<a href=\"log.html#$ln\">";
+ print INDEX encode_entities ($_);
+ print INDEX "</a></p>\n";
+ $log_class = "$diagnostic";
+ }
+ }
+ printf LOG_HTML "<a name=\"%d\"><tt>%4d</tt></a> ", $ln, $ln;
+ if (defined ($log_class)) {
+ print LOG_HTML "<span class=\"$log_class\">", encode_entities ($_), "</span>\n";
+ } else {
+ print LOG_HTML encode_entities ($_), "\n";
+ }
+}
+print INDEX " </ul>\n" if $n_products;
+print INDEX "</li>\n" if $n_steps;
+print INDEX <<EOF;
+</ol>
+</body>
+</html>
+EOF
+
+print LOG_HTML <<EOF;
+</pre>
+</body>
+</html>
+EOF
+
+open (CSS, '>', "build.css");
+print CSS <<EOF;
+body {
+ background: white;
+ color: black;
+ padding: 0em 12em 0em 3em;
+ margin: 0
+}
+body>p {
+ margin: 0pt 0pt 0pt 0em
+}
+body>p + p {
+ text-indent: 1.5em;
+}
+H1 {
+ font-size: 150%;
+ margin-left: -1.33em
+}
+H2 {
+ font-size: 125%;
+ font-weight: bold;
+ margin-left: -.8em
+}
+H3 {
+ font-size: 100%;
+ font-weight: bold;
+ margin-left: -.5em }
+H4 {
+ font-size: 100%;
+ margin-left: 0em
+}
+H1, H2, H3, H4, H5, H6 {
+ font-family: sans-serif;
+ color: blue
+}
+html {
+ margin: 0
+}
+
+a:link {
+ color: blue;
+ text-decoration: none;
+}
+a:visited {
+ color: gray;
+ text-decoration: none;
+}
+a:active {
+ color: black;
+ text-decoration: none;
+}
+a:hover {
+ text-decoration: underline
+}
+
+.step {
+ font-weight: bold
+}
+.warning {
+ background: yellow;
+ margin-top: 0;
+ margin-bottom: 0
+}
+.error {
+ background: orange;
+ margin-top: 0;
+ margin-bottom: 0
+}
+EOF