- start_step ("Make dist tarball");
- run ("cd $builddir/pspp$build_number/_build && make dist");
-
- $tarball = "$builddir/pspp$build_number/_build/pspp-$version-g$abbrev_commit.tar.gz";
-} else {
- $tarball = $ARGV[0];
-}
-
-start_step ("Determining $tarball target directory");
-my $sample_filename = `zcat $tarball | tar tf - | head -1`;
-my ($tarball_dir) = $sample_filename =~ m%^(?:[./])*([^/]+)/%;
-set_var ("dist_dir", $tarball_dir);
-
-start_step ("Extracting $tarball into $builddir/$tarball_dir");
-run ("zcat $tarball | (cd $builddir && tar xf -)");
-
-start_step ("Extracting tar version");
-my ($version) = `cd $builddir/$tarball_dir && ./configure --version | head -1`
- =~ /configure (\S+)$/;
-set_var ("dist_version", $version);
-my ($binary_version) = "$version-$builder-build$build_number";
-set_var ("binary_version", $binary_version);
-
-start_step ("Configuring");
-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=''");
-
-start_step ("Build");
-run ("cd $builddir/$tarball_dir/_build && make");
-
-start_step ("Install");
-run ("cd $builddir/$tarball_dir/_build && make install DESTDIR=\$PWD/pspp-$binary_version");
-
-start_step ("Make binary distribution");
-run ("cd $builddir/$tarball_dir/_build && tar cfz pspp-$binary_version.tar.gz pspp-$binary_version");
-
-start_step ("Check");
-run ("cd $builddir/$tarball_dir/_build && make check");
-
-start_step ("Uninstall");
-run ("cd $builddir/$tarball_dir/_build && make uninstall DESTDIR=\$PWD/pspp-$binary_version");
-
-start_step ("Check uninstall");
-run ("cd $builddir/$tarball_dir/_build && make distuninstallcheck distuninstallcheck_dir=\$PWD/pspp-$binary_version");
-
-# distcleancheck
-
-start_step ("Success");
-
-sub usage {
- print <<EOF;
-$0, for building and testing PSPP
-usage: $0 [OPTIONS] [TARBALL | REPO REFSPEC]
-where TARBALL is the name of a tarball produced by "make dist"
- or REPO and REFSPEC are a Git repo and refspec (e.g. branch) to clone.
-
-Options:
- --help Print this usage message and exit
-EOF
- exit(0);
-}
-
-sub run {
- my ($command) = @_;
-
- print LOG "$command\n";
-
- my $pid = open (COMMAND, '-|');
- if (!defined ($pid)) {
- die "fork failed: $!\n";
- } elsif (!$pid) {
- dup2 (1, 2);
- exec ($command);
- die "$command: exec failed: $!\n";
- }
-
- local ($|) = 1;
- my $i = 0;
- while (<COMMAND>) {
- print LOG $_;
- print "\r", $i++;
- }
- close (COMMAND);
- print "\r \r";
-
- if ($? == 0) {
- return;
- } elsif ($? & 127) {
- printf "%s: child died with signal %d, %s coredump\n",
- $command, ($? & 127), ($? & 128) ? 'with' : 'without';
- } else {
- printf "%s: child exited with value %d\n", $command, $? >> 8;
- }
- exit 1;
-}
-
-# Clone source
-# Add build number
-# Tag build
-# Clone gnulib at correct commit number
-# Run gnulib-tool.
-# Run configure
-# Make dist
-
-# Unpack dist
-# Run configure
-# Check
-# Install
-# Make binary dist
-# Build mingw32 installer
-# Other distcheck stuff?
-
-# Distribute manual in various formats
+ start_step("Make source tarball")
+ run("cd pspp/_build && make -j$(nproc) dist", "dist")
+ tarname = "pspp-%s.tar.gz" % version
+ tarball = save_result("source distribution", "pspp/_build/%s" % tarname, 1)
+
+ # Save translation templates.
+ potfile = "pspp/_build/po/pspp.pot"
+ if not Path(potfile).exists():
+ potfile = "pspp/po/pspp.pot"
+ save_result("translation templates", potfile)
+
+ # Build examples for user manual.
+ start_step("Build examples for user manual")
+ run("cd pspp/_build && make -j$(nproc) example-outputs example-html")
+
+ # Build user manual
+ start_step("Build user manual")
+ run("cd pspp && "
+ "GENDOCS_TEMPLATE_DIR=%s %s/gendocs.sh -s doc/pspp.texi -I doc "
+ "-I _build/doc/examples -I doc/examples "
+ "-o %s/user-manual --email bug-gnu-pspp@gnu.org "
+ "pspp \"GNU PSPP User Manual\"" % (topdir, topdir, resultsdir),
+ "user-manual")
+ saved_result("User Manual", "user-manual")
+
+ # Build developer's guide
+ start_step("Build developers guide")
+ run("cd pspp && "
+ "GENDOCS_TEMPLATE_DIR=%s %s/gendocs.sh -s doc/pspp-dev.texi "
+ "-I doc -o %s/dev-guide --email bug-gnu-pspp@gnu.org "
+ "pspp-dev \"GNU PSPP Developers Guide\""
+ % (topdir, topdir, resultsdir), "dev-guide")
+ saved_result("Developers Guide", "dev-guide")
+else:
+ start_step("Starting from %s" % tarball)
+
+if build_binary:
+ start_step("Save tarball to Git")
+ run("GIT_DIR=%s/.git %s/git-import-tar %s refs/builds/%s/dist"
+ % (topdir, topdir, tarball, build_number), "git-dist")
+ set_var("dist_ref", "refs/builds/%s/dist" % build_number)
+ set_var("dist_commit", ref_to_commit("refs/builds/%s/dist" % build_number))
+
+ start_step("Determining %s target directory" % tarball)
+ sample_filename = backquotes("zcat %s | tar tf - | head -1" % tarball)
+ tarball_dir = re.match('(?:[./])*([^/]+)/', sample_filename).group(1)
+ set_var("dist_dir", tarball_dir)
+
+ start_step("Extracting source tarball")
+ run("zcat %s | (cd %s && tar xf -)" % (tarball, builddir))
+
+ start_step("Extracting tar version")
+ version_line = backquotes("cd %s/%s && ./configure --version | head -1"
+ % (builddir, tarball_dir))
+ version = re.search(r'configure (\S+)$', version_line).group(1)
+ set_var("dist_version", version)
+ binary_version = "%s-%s-build%s" % (version, builder, build_number)
+ set_var("binary_version", binary_version)
+
+ start_step("Configuring")
+ run("chmod -R a-w %s/%s" % (builddir, tarball_dir))
+ run("chmod u+w %s/%s" % (builddir, tarball_dir))
+ run("chmod -R u+w %s/%s/perl-module" % (builddir, tarball_dir))
+ run("mkdir %s/%s/_build" % (builddir, tarball_dir))
+ run("chmod a-w %s/%s" % (builddir, tarball_dir))
+ ok = try_run(
+ "cd %(builddir)s/%(tarball_dir)s/_build && ../configure "
+ "--with-perl-module --enable-relocatable --prefix='' "
+ "PKG_CONFIG_PATH=$PWD/../../../source/%(ssw_dir)s/inst/lib/pkgconfig "
+ "CPPFLAGS=\"-I$PWD/../../../source/%(ssw_dir)s/inst/include\" "
+ "LDFLAGS=\"-L$PWD/../../../source/%(ssw_dir)s/inst/lib\""
+ % {"builddir": builddir,
+ "tarball_dir": tarball_dir,
+ "ssw_dir": ssw_dir},
+ "bin-configure")
+ for basename in ("config.h", "config.log"):
+ save_result_if_exists("build configuration",
+ "%s/%s/_build/%s" % (builddir, tarball_dir,
+ basename))
+ if not ok:
+ fail()
+
+ start_step("Build")
+ run("cd %s/%s/_build && make -j$(nproc)" % (builddir, tarball_dir), "build")
+ run("cd %s/%s/_build/perl-module && perl Makefile.PL && make -j$(nproc)"
+ % (builddir, tarball_dir), "build Perl module")
+
+ start_step("Install")
+ run("cd %s/%s/_build && make -j$(nproc) install DESTDIR=$PWD/pspp-%s"
+ % (builddir, tarball_dir, binary_version), "install")
+ run("cd ../source/%s && make -j$(nproc) install DESTDIR=%s/%s/_build/pspp-%s"
+ % (ssw_dir, builddir, tarball_dir, binary_version))
+ run("cd %s/%s/_build/perl-module && "
+ "make -j$(nproc) install DESTDIR=%s/%s/_build/pspp-%s"
+ % (builddir, tarball_dir, builddir, tarball_dir, binary_version),
+ "install Perl module")
+ run("cd %s/%s/_build/perl-module && "
+ "make -j$(nproc) install DESTDIR=$PWD/inst"
+ % (builddir, tarball_dir))
+
+ start_step("Make binary distribution")
+ run("cd %s/%s/_build && tar cfz pspp-%s.tar.gz pspp-%s"
+ % (builddir, tarball_dir, binary_version, binary_version))
+ save_result("binary distribution", "%s/%s/_build/pspp-%s.tar.gz"
+ % (builddir, tarball_dir, binary_version), 1)
+
+ start_step("Check")
+ ok = try_run("cd %s/%s/_build && make check TESTSUITEFLAGS=-j$(nproc)"
+ % (builddir, tarball_dir), "check")
+ for basename in ("tests/testsuite.log", "tests/testsuite.dir"):
+ save_result_if_exists("test logs", "%s/%s/_build/%s"
+ % (builddir, tarball_dir, basename))
+ if not ok:
+ fail()
+
+ start_step("Uninstall")
+ run("cd ../source/%s && make -j$(nproc) uninstall DESTDIR=%s/%s/_build/pspp-%s"
+ % (ssw_dir, builddir, tarball_dir, binary_version))
+ run("cd %s/%s/_build && make -j$(nproc) uninstall DESTDIR=$PWD/pspp-%s"
+ % (builddir, tarball_dir, binary_version), "uninstall")
+
+ start_step("Check uninstall")
+ run("(cd %s/%s/_build/perl-module/inst && find -type f -print) | "
+ "(cd %s/%s/_build/pspp-%s && xargs rm)"
+ % (builddir, tarball_dir,
+ builddir, tarball_dir, binary_version), "uninstall Perl module")
+ run("cd %s/%s/_build && "
+ "make -j$(nproc) distuninstallcheck distuninstallcheck_dir=$PWD/pspp-%s"
+ % (builddir, tarball_dir, binary_version),
+ "distuninstallcheck")
+
+ # distcleancheck
+
+start_step("Success")