die "$0: exactly one or two nonoption arguments are required\n"
if @ARGV != 1 && @ARGV != 2;
-my $buildslave = `hostname`;
-chomp $buildslave;
+my $builder = `hostname`;
+chomp $builder;
# Select build number.
my $buildnumber = POSIX::strftime("%Y%m%d%H%M%S", localtime);
mkdir "builds" or die "builds: mkdir: $!\n" if ! -d "builds";
mkdir $builddir or die "$builddir: mkdir: $!\n";
+$resultsdir = "$builddir/results";
+mkdir $resultsdir or die "$resultsdir: mkdir: $!\n";
+
+$logfile = "$resultsdir/LOG";
+open (LOG, '>', $logfile) or die "creating $logfile failed: $!\n";
+
+$varsfile = "$resultsdir/VARS";
+open (VARS, '>', $varsfile) or die "creating $varsfile failed: $!\n";
+
+
+
+
+
+my $tarball;
if (@ARGV == 2) {
my ($repo, $branch) = @ARGV;
if ($. != $line) {
print NEWFILE $_;
} else {
- print NEWFILE "AC_INIT([[$package]]";
- print NEWFILE ", [[$version-g$abbrev_revision]]";
- print NEWFILE ", [[$_]]" foreach @rest;
+ print NEWFILE "AC_INIT([$package], [$version-g$abbrev_revision]";
+ print NEWFILE ", [$_]" foreach @rest;
print NEWFILE ")\n";
}
}
Changes from $version to $version-g$abbrev_revision:
* Built automatically from commit $revision
- in branch $branch on build slave $buildslave
+ in branch $branch by builder $builder
EOF
}
die "$fullname does not specify a Git commit number\n"
if !defined ($gnulib_commit);
print "\tGNULIB_REVISION=$gnulib_commit\n";
+
+ # If we don't already have that Gnulib commit, update Gnulib.
+ `git rev-parse $gnulib_commit`;
+ if ($? != 0) {
+ run ("git fetch gnulib");
+ }
+
+ # Extract gnulib source.
+ run ("git archive --format=tar --prefix=gnulib/ $gnulib_commit | (cd $builddir && tar xf -)");
+
+ # Bootstrap.
+ run ("cd $builddir/pspp$buildnumber && make -f Smake");
+
+ # Configure.
+ run ("cd $builddir/pspp$buildnumber && mkdir _build && cd _build && ../configure");
+
+ # Distribute.
+ run ("cd $builddir/pspp$buildnumber/_build && make dist");
+
+ $tarball = "$builddir/pspp$buildnumber/_build/pspp-$version-g$abbrev_revision.tar.gz";
+} else {
+ $tarball = $ARGV[0];
}
+print "Determining $tarball target directory\n";
+my $sample_filename = `zcat $tarball | tar tf - | head -1`;
+my ($tarball_dir) = $sample_filename =~ m%^(?:[./])*([^/]+)/%;
+print "\tTARBALL_DIR=$tarball_dir\n";
+
+print "Extracting $tarball into $builddir/$tarball_dir\n";
+run ("zcat $tarball | (cd $builddir && tar xf -)");
+
+print "Extracting tar version\n";
+my ($version) = `cd $builddir/$tarball_dir && ./configure --version | head -1`
+ =~ /configure (\S+)$/;
+print "\tVERSION=$version\n";
+my ($binary_version) = "$version-$builder-build$buildnumber";
+print "\tBINARY_VERSION=$version\n";
+
+print "Configuring\n";
+run ("chmod -R a-w $builddir/$tarball_dir");
+run ("chmod u+w $builddir/$tarball_dir");
+run ("mkdir $builddir/$tarball_dir/_build");
+run ("chmod a-w $builddir/$tarball_dir");
+run ("cd $builddir/$tarball_dir/_build && ../configure --enable-relocatable --prefix=''");
+
+print "Build\n";
+run ("cd $builddir/$tarball_dir/_build && make");
+
+print "Install\n";
+run ("cd $builddir/$tarball_dir/_build && make install DESTDIR=\$PWD/pspp-$binary_version");
+
+print "Make binary distribution\n";
+run ("cd $builddir/$tarball_dir/_build && tar cfz pspp-$binary_version.tar.gz pspp-$binary_version");
+
+print "Check\n";
+run ("cd $builddir/$tarball_dir/_build && make check");
+
+print "Uninstall\n";
+run ("cd $builddir/$tarball_dir/_build && make uninstall DESTDIR=\$PWD/pspp-$binary_version");
+
+print "Check uninstall\n";
+run ("cd $builddir/$tarball_dir/_build && make distuninstallcheck distuninstallcheck_dir=\$PWD/pspp-$binary_version");
+
+# distcleancheck
+
+print "Success\n";
+
sub usage {
print <<EOF;
$0, for building and testing PSPP
# Make binary dist
# Build mingw32 installer
# Other distcheck stuff?
+
+# Distribute manual in various formats