From: Ben Pfaff Date: Mon, 31 May 2010 04:32:44 +0000 (-0700) Subject: start rewrite X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=69ed81b2ad13646d885c5f18604ecc5633404ddf start rewrite --- diff --git a/.gitignore b/.gitignore index 2a3d71f3a8..135879d3ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,16 @@ -/builds/ -/timings +/.autom4te.cfg +/Makefile +/Makefile.in +/aclocal.m4 +/autom4te.cache/ +/build[0-9]*/ +/buildnr/ +/buildtmp/ +/config.log +/config.status +/configure +/dist-pspp +/dist-pspp.in +/make-builder +/make-builder.in +/repo.git/ diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000000..bd28503e0f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,29 @@ +AUTOMAKE_OPTIONS = foreign + +dist_noinst_DATA = make-builder.as dist-pspp.as #build-pspp.as + +dist_noinst_SCRIPTS = make-builder +dist_noinst_DATA += dist-pspp.in #build-pspp.in + +AUTOM4TE = autom4te + +make-builder.in: make-builder.as + $(AUTOM4TE) --language M4sh make-builder.as -o $@ +dist-pspp.in: dist-pspp.as build-pspp.m4 + $(AUTOM4TE) --language build-pspp dist-pspp.as -o $@ +#build-pspp.in: build-pspp.as build-pspp.m4 +# $(AUTOM4TE) --language build-pspp build-pspp.as -o $@ + +edit = sed \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ + -e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g' + +make-builder: make-builder.in + rm -f $@ $@.tmp + srcdir=''; \ + test -f ./$@.in || srcdir=$(srcdir)/; \ + $(edit) $${srcdir}$@.in >$@.tmp + chmod +x $@.tmp + chmod a-w $@.tmp + mv $@.tmp $@ diff --git a/build-aux/.gitignore b/build-aux/.gitignore new file mode 100644 index 0000000000..68c3e860f0 --- /dev/null +++ b/build-aux/.gitignore @@ -0,0 +1,2 @@ +/install-sh +/missing diff --git a/build-pspp b/build-pspp deleted file mode 100755 index ae723f7de4..0000000000 --- a/build-pspp +++ /dev/null @@ -1,448 +0,0 @@ -#! /usr/bin/env perl - -use Cwd; -use File::Basename; -use File::Spec; -use Getopt::Long qw(:config bundling no_ignore_case); -use IO::Handle; -use POSIX; - -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, - "o|output=s" => \$builddir, - "build-number=i" => \$build_number); - -usage () if $help; - -die "$0: exactly one or two nonoption arguments are required\n" - if @ARGV != 1 && @ARGV != 2; - -my $tarball; -if (@ARGV == 1) { - $tarball = File::Spec->rel2abs ($ARGV[0]); -} else { - # Tarball will be generated later. -} - -# Select build number. -if (!defined ($build_number)) { - $build_number = POSIX::strftime("%Y%m%d%H%M%S", localtime); -} - -my $topdir = dirname ($0); -$topdir = cwd () . "/$topdir" if $topdir !~ m%^/%; - -# Create build directory. -if (!defined ($builddir)) { - $builddir = "builds/$build_number"; - mkdir "builds" or die "builds: mkdir: $!\n" if ! -d "builds"; -} -$builddir = File::Spec->rel2abs ($builddir); --d $builddir or mkdir $builddir or die "$builddir: mkdir: $!\n"; -chdir ($builddir) or die "$builddir: chdir: $!\n"; - -our $resultsdir = "$builddir/results"; -mkdir $resultsdir or die "$resultsdir: mkdir: $!\n"; -mkdir "$resultsdir/vars" or die "$resultsdir/vars: mkdir: $!\n"; - -my $varsfile = "$resultsdir/VARS"; -open (VARS, '>', $varsfile) or die "creating $varsfile failed: $!\n"; -VARS->autoflush (1); - -our $logfile = "$resultsdir/LOG"; -open (LOG, '>', $logfile) or die "creating $logfile failed: $!\n"; - -my $build_host = `hostname`; -chomp $build_host; -set_var ("build_host", $build_host); -set_var ("build_number", $build_number); - -our $GIT = "git --git-dir=$topdir/.git"; - -sub start_step { - my ($msg) = @_; - print LOG " \n$msg\n"; - print "$msg\n" unless $batch; -} - -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; -} - -sub saved_result { - my ($name, $product) = @_; - start_step ("Saving $name: $product"); -} - -sub save_result { - my ($name, $src, $rm_src) = @_; - my ($basename) = $src; - $basename =~ s(^.*/)(); - my ($dst) = "$resultsdir/$basename"; - - saved_result ($name, $basename); - run ("cp -R $src $dst"); - - if (defined ($rm_src) && $rm_src) { - run ("rm $src"); - } - - return $dst; -} - -sub save_result_if_exists { - my ($name, $src, $rm_src) = @_; - if (-e $src) { - save_result (@_); - } else { - start_step ("$src does not exist, cannot save"); - } -} - -sub ref_to_commit { - my ($ref) = @_; - my $commit = `$GIT rev-parse $ref`; - chomp $commit; - return $commit; -} - -if (@ARGV == 2) { - my ($repo, $branch) = @ARGV; - - start_step ("Fetch branch from Git"); - set_var ("git_repo", $repo); - set_var ("git_branch", $branch); - run ("$GIT fetch $repo +$branch:refs/builds/$build_number/pspp"); - - # Get revision number. - set_var ("pspp_ref", "refs/builds/$build_number/pspp"); - my $revision = ref_to_commit ("refs/builds/$build_number/pspp"); - set_var ("pspp_commit", $revision); - my $abbrev_commit = substr ($revision, 0, 6); - - # Extract source. - start_step ("Extract branch into source directory"); - run ("$GIT archive --format=tar --prefix=pspp/ refs/builds/$build_number/pspp | tar xf -"); - - # Extract version number. - start_step ("Extract repository version number"); - my $trace = `cd pspp && autoconf -t AC_INIT`; - chomp $trace; - my ($file, $line, $macro, $package, $repo_version, @rest) - = split (':', $trace); - set_var ("repo_version", $repo_version); - - # Is this a "gnits" mode tree? - start_step ("Checking Automake mode"); - open (MAKEFILE_AM, '<', "pspp/Makefile.am"); - my $am_mode = "gnu"; - while () { - if (/gnits/) { - $am_mode = "gnits"; - last; - } - } - close (MAKEFILE_AM); - print LOG "Automake mode is $am_mode\n"; - - # Generate version number for build. - # We want to append -g012345, but if we're in Gnits mode and the - # version number already has a hyphen, we have to omit it. - start_step ("Generate build version number"); - my $version = $repo_version; - $version .= '-' unless $version =~ /-/; - $version .= "g$abbrev_commit"; - set_var ("version", $version); - - # Append -g012345 to configure.ac version number. - start_step ("Updating version number in $file"); - my $fullname = "pspp/$file"; - open (OLDFILE, '<', $fullname) - or die "opening $fullname failed: $!\n"; - open (NEWFILE, '>', "$fullname.new") - or die "creating $fullname.new failed: $!\n"; - while () { - if ($. != $line) { - print NEWFILE $_; - } else { - print NEWFILE "AC_INIT([$package], [$version]"; - print NEWFILE ", [$_]" foreach @rest; - print NEWFILE ")\n"; - } - } - close (NEWFILE); - close (OLDFILE); - rename ("$fullname.new", $fullname) - or die "rename $fullname.new to $fullname failed: $!\n"; - - # Get Gnulib commit number. - start_step ("Reading README.Git to find Gnulib commit number"); - my $gnulib_commit; - $fullname = "pspp/README.Git"; - open (README_GIT, '<', $fullname) - or die "opening $fullname failed: $!\n"; - while () { - ($gnulib_commit) = /^\s+commit ([0-9a-fA-F]{8,})/ and last; - } - die "$fullname does not specify a Git commit number\n" - if !defined ($gnulib_commit); - set_var ("gnulib_commit", $gnulib_commit); - - # Add note to beginning of NEWS (otherwise "make dist" fails). - start_step ("Updating NEWS"); - $fullname = "pspp/NEWS"; - open (OLDFILE, '<', $fullname) - or die "opening $fullname failed: $!\n"; - open (NEWFILE, '>', "$fullname.new") - or die "creating $fullname.new failed: $!\n"; - my $found_changes = 0; - while () { - if (!$found_changes && /^Changes/) { - $found_changes = 1; - print NEWFILE < /dev/null"); - if ($? != 0) { - start_step ("Updating Gnulib to obtain commit"); - run ("$GIT fetch gnulib"); - } - run ("$GIT update-ref refs/builds/$build_number/gnulib $gnulib_commit"); - set_var ("gnulib_ref", "refs/builds/$build_number/gnulib"); - - # Extract gnulib source. - start_step ("Extract Gnulib source"); - run ("$GIT archive --format=tar --prefix=gnulib/ $gnulib_commit | tar xf -"); - - # Bootstrap. - start_step ("Bootstrap (make -f Smake)"); - run ("cd pspp && make -f Smake", "bootstrap"); - - # Configure. - start_step ("Configure source"); - run ("cd pspp && mkdir _build && cd _build && ../configure", "configure"); - - # Distribute. - start_step ("Make source tarball"); - run ("cd pspp/_build && make dist", "dist"); - my $tarname = "pspp-$version.tar.gz"; - $tarball = save_result ("source distribution", "pspp/_build/$tarname", 1); - - # Save translation templates. - my $potfile = "pspp/_build/po/pspp.pot"; - $potfile = "pspp/po/pspp.pot" if ! -e $potfile; - save_result ("translation templates", $potfile); - - # Build user manual - start_step ("Build user manual"); - run ("cd pspp && cp _build/doc/*.texi doc/"); - run ("cd pspp && GENDOCS_TEMPLATE_DIR=$topdir $topdir/gendocs.sh -s doc/pspp.texinfo -o $resultsdir/user-manual --email bug-gnu-pspp\@gnu.org pspp \"GNU PSPP User Manual\"", "user-manual"); - saved_result ("User Manual", "user-manual"); - - # Build developer's guide - start_step ("Build developers guide"); - run ("cd pspp && GENDOCS_TEMPLATE_DIR=$topdir $topdir/gendocs.sh -s doc/pspp-dev.texinfo -o $resultsdir/dev-guide --email bug-gnu-pspp\@gnu.org pspp-dev \"GNU PSPP Developers Guide\"", "dev-guide"); - saved_result ("Developers Guide", "dev-guide"); -} else { - $tarball = saved_result ("source distribution", $tarball); -} - -if ($build_binary) { - start_step ("Save tarball to Git"); - run ("GIT_DIR=$topdir/.git $topdir/git-import-tar $tarball refs/builds/$build_number/dist", "git-dist"); - set_var ("dist_ref", "refs/builds/$build_number/dist"); - set_var ("dist_commit", ref_to_commit ("refs/builds/$build_number/dist")); - - 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 source tarball"); - 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-$build_host-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"); - 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 ("build configuration", - "$builddir/$tarball_dir/_build/$basename"); - } - fail () if !$ok; - - start_step ("Build"); - run ("cd $builddir/$tarball_dir/_build && make", "build"); - - start_step ("Install"); - run ("cd $builddir/$tarball_dir/_build && make install DESTDIR=\$PWD/pspp-$binary_version", "install"); - - start_step ("Make binary distribution"); - run ("cd $builddir/$tarball_dir/_build && tar cfz pspp-$binary_version.tar.gz pspp-$binary_version"); - 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 ("test logs", "$builddir/$tarball_dir/_build/$basename"); - } - fail () if !$ok; - - start_step ("Uninstall"); - run ("cd $builddir/$tarball_dir/_build && make uninstall DESTDIR=\$PWD/pspp-$binary_version", "uninstall"); - - start_step ("Check uninstall"); - run ("cd $builddir/$tarball_dir/_build && make distuninstallcheck distuninstallcheck_dir=\$PWD/pspp-$binary_version", "distuninstallcheck"); - - # distcleancheck -} - -start_step ("Success"); - -sub usage { - print <) { - print LOG $_; - - my $elapsed = time () - $start; - my $progress = sprintf "%d lines logged, %d s elapsed", - $lines++, $elapsed; - if ($est_time > 0) { - my $left = $est_time - $elapsed; - if ($left > 0) { - $progress .= sprintf ", ETA %d s", $left; - } - } - print "\r$progress", " " x (79 - length ($progress)), "\r" - unless $batch; - } - close (COMMAND); - print "\r", " " x 79, "\r" unless $batch; - - write_timing ($id, time () - $start) if defined ($id); - - return 1 if !$?; - - if ($? & 127) { - printf STDERR "%s: child died with signal %d, %s coredump\n", - $command, ($? & 127), ($? & 128) ? 'with' : 'without'; - } else { - printf STDERR "%s: child exited with value %d\n", $command, $? >> 8; - } - return 0; -} - -sub read_timing { - my ($id) = @_; - open (TIMINGS, "<", "$topdir/timings") or return 0; - while () { - chomp; - my ($key, $value) = /^([^=]+)=(.*)/ or next; - return $value if $key eq $id; - } - close (TIMINGS); - return 0; -} - -sub write_timing { - my ($id, $time) = @_; - - open (NEWTIMINGS, ">", "$topdir/timings.tmp$$") or return; - - if (open (OLDTIMINGS, "<", "$topdir/timings")) { - while () { - if (my ($key, $value) = /^([^=]+)=(.*)/) { - next if $key eq $id; - } - print NEWTIMINGS $_; - } - close (OLDTIMINGS); - } - - print NEWTIMINGS "$id=$time\n"; - close (NEWTIMINGS); - - rename ("$topdir/timings.tmp$$", "$topdir/timings"); -} - -sub fail { - die "Build failed, refer to:\n\t$logfile\nfor details.\n"; -} diff --git a/build-pspp.m4 b/build-pspp.m4 new file mode 100644 index 0000000000..7f1f3fa126 --- /dev/null +++ b/build-pspp.m4 @@ -0,0 +1,104 @@ +m4_define([_m4_divert(INIT_PREPARE)], 300) + +m4_pattern_forbid([^_?BP_]) +m4_pattern_allow([_BP_EOF]) + +# BP_INIT([LOGFILE]) +# ------------------ +# Initializes and starts logging to LOGFILE. +m4_define([BP_INIT], +[AS_INIT +_BP_INIT_LOG([$1]) +_BP_INIT_RESULTS +AS_PREPARE +]) + +# _BP_INIT_LOG([LOGFILE]) +# ----------------------- +# Initialize the log file descriptor and write header to it. +m4_define([_BP_INIT_LOG], +[m4_divert_text([INIT_PREPARE], +[m4_define([BP_LOG_FILE], [$1]) +m4_define([AS_MESSAGE_LOG_FD], 5)dnl +cat >$1 <<_BPEOF +This file is a build log. + +Invocation command line was + + $ $[0] $[@] + +_BPEOF +exec AS_MESSAGE_LOG_FD>>$1 +AS_UNAME >&AS_MESSAGE_LOG_FD + +cat >&AS_MESSAGE_LOG_FD <<_BPEOF + +_BPEOF +])])# _BP_INIT_LOG + +# _BP_INIT_RESULTS +m4_define([_BP_INIT_RESULTS], +[AS_MKDIR_P([results]) +m4_define([BP_VARS_FD], 6)dnl +exec BP_VARS_FD>results/VARS +]) + +# _BP_INIT_DEFAULTS +# ----------------- +m4_define([_BP_INIT_DEFAULTS], +[m4_divert_push([DEFAULTS])dnl + +test -n "$DJDIR" || exec AS_ORIGINAL_STDIN_FD<&0 &1 +]) + +# BP_START_STEP([MESSAGE]) +m4_define([BP_START_STEP], + [AS_ECHO(["$1"]) +AS_ECHO([" @&t@ +$1"]) >&AS_MESSAGE_LOG_FD +]) + +# BP_SET_VAR(VARIABLE, [VALUE]) +m4_define([BP_SET_VAR], + [m4_if([$2], [], [], [$1='$2' +])dnl +AS_ECHO(["$1=$[$1]"]) >&BP_VARS_FD +AS_ECHO(["$as_me:$LINENO: $1=$[$1]"]) >&AS_MESSAGE_LOG_FD +AS_ECHO([" $1=$[$1]"])]) + +# BP_OUTPUT(DESCRIPTION, FILE) +m4_define([BP_OUTPUT], +[BP_START_STEP([Saving `AS_BASENAME([$2])`: $1])]) + +# BP_MOVE_OUTPUT(DESCRIPTION, FILE) +m4_define([BP_MOVE_OUTPUT], +[BP_OUTPUT([$1], [$2]) +BP_RUN([mv $2 results/ >&AS_MESSAGE_LOG_FD 2>&1])]) + +# BP_COPY_OUTPUT(DESCRIPTION, FILE) +m4_define([BP_COPY_OUTPUT], +[BP_OUTPUT([$1], [$2]) +BP_RUN([cp -R $2 results/ >&AS_MESSAGE_LOG_FD 2>&1])]) + +# BP_RUN_LOG(COMMAND) +m4_define([BP_RUN_LOG], +[cat <<_BP_EOF >&AS_MESSAGE_LOG_FD +$as_me:$LINENO: $1 +_BP_EOF +$1 +]) + +# BP_RUN(COMMAND) +m4_define([BP_RUN], +[BP_RUN_LOG([$1]) +_bp_status=$? +if test $_bp_status != 0; then + AS_ECHO(["Build failed, refer to BP_LOG_FILE for details"]) + AS_ECHO(["$as_me:$LINENO: command exited with status $_bp_status"]) >&AS_MESSAGE_LOG_FD + AS_EXIT([1]) +fi]) + +# BP_FINISH +m4_define([BP_FINISH], +[BP_START_STEP([success])]) diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000000..47be4f1a50 --- /dev/null +++ b/configure.ac @@ -0,0 +1,7 @@ +AC_INIT([build-pspp], [1]) +AC_CONFIG_SRCDIR([dist-pspp.as]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_FILES([Makefile]) +AM_INIT_AUTOMAKE +AC_PROG_CC +AC_OUTPUT diff --git a/dist-pspp.as b/dist-pspp.as new file mode 100644 index 0000000000..3d3f225a04 --- /dev/null +++ b/dist-pspp.as @@ -0,0 +1,93 @@ +# -* autoconf -*- + +BP_INIT([dist-pspp.log]) + +BP_SET_VAR([COMMIT], [@PSPP_COMMIT@]) +BP_SET_VAR([GNULIB_COMMIT], [@GNULIB_COMMIT@]) +BP_SET_VAR([BRANCH], [@BRANCH@]) + +ABBREV_COMMIT=`expr "$COMMIT" : '\(......\)'` +BP_SET_VAR([ABBREV_COMMIT]) + +BP_START_STEP([Extracting Git sources]) +tar xzf pspp-$COMMIT.tar.gz + +BP_START_STEP([Extract repository version number]) +(cd pspp-$COMMIT && autoconf -t AC_INIT) > tmp$$ +IFS=: read FILE LINE macro PACKAGE REPO_VERSION BUG_REPORT TARNAME URL < tmp$$ +BP_SET_VAR([REPO_VERSION]) + +BP_START_STEP([Checking Automake mode]) +if grep gnits pspp-$COMMIT/Makefile.am >/dev/null 2>&1; then + AM_MODE=gnits +else + AM_MODE=gnu +fi +BP_SET_VAR([AM_MODE]) + +BP_START_STEP([Generate build version number]) +case $AM_MODE-$REPO_VERSION in # ( + gnits-*-*) + # We want to append -g012345, but we're in Gnits mode and the + # version number already has a hyphen, so we have to omit the + # second hyphen. + VERSION="$REPO_VERSIONg$ABBREV_COMMIT" + ;; # ( + *) + VERSION="$REPO_VERSION-g$ABBREV_COMMIT" + ;; +esac +BP_SET_VAR([VERSION]) + +BP_START_STEP([Update version number in configure.ac]) +echo "AC_INIT([[$PACKAGE], [$VERSION], [$BUG_REPORT], [$TARNAME], [$URL]])" > tmp$$ +sed -n "${LINE}r tmp$$ +$LINE!p" < pspp-$COMMIT/$FILE > pspp-$COMMIT/$FILE.new +mv pspp-$COMMIT/$FILE.new pspp-$COMMIT/$FILE + +BP_START_STEP([Updating NEWS]) +{ + sed -n '/^Changes/q;p' pspp-$COMMIT/NEWS +cat <<_BP_EOF +Changes from $REPO_VERSION to $VERSION: + + * Built from PSPP commit $COMMIT + in branch $BRANCH on host `hostname`. + + * Built from Gnulib commit $GNULIB_COMMIT. + +_BP_EOF + sed -n '/^Changes/,$p' pspp-$COMMIT/NEWS +} > NEWS.new +mv NEWS.new pspp-$COMMIT/NEWS + +BP_START_STEP([Extract Gnulib source]) +BP_RUN([tar xzf gnulib-$GNULIB_COMMIT.tar.gz >&AS_MESSAGE_LOG_FD 2>&1]) + +BP_START_STEP([Bootstrap (make -f Smake)]) +BP_RUN([(cd pspp-$COMMIT && make -f Smake GNULIB=../gnulib-$GNULIB_COMMIT) >&AS_MESSAGE_LOG_FD 2>&1]) + +BP_START_STEP([Configure]) +AS_MKDIR_P([pspp-$COMMIT/_build]) +BP_RUN([(cd pspp-$COMMIT/_build && ../configure @CONFIGUREFLAGS@) >&AS_MESSAGE_LOG_FD 2>&1]) + +BP_START_STEP([Make source tarball]) +BP_RUN([(cd pspp-$COMMIT/_build && make dist) >&AS_MESSAGE_LOG_FD 2>&1]) +BP_MOVE_OUTPUT([source distribution], [pspp-$COMMIT/_build/pspp-$VERSION.tar.gz]) + +potfile=pspp-$COMMIT/_build/po/pspp.pot +if test ! -e $potfile; then + potfile=pspp-$COMMIT/po/pspp.pot +fi +BP_COPY_OUTPUT([translation templates], [$potfile]) + +BP_START_STEP([Build user manual]) +BP_RUN([(cd pspp-$COMMIT && cp _build/doc/*.texi doc/) >&AS_MESSAGE_LOG_FD 2>&1]) +BP_RUN([(cd pspp-$COMMIT && GENDOCS_TEMPLATE_DIR=.. ../gendocs.sh -s doc/pspp.texinfo -o results/user-manual --email bug-gnu-pspp@gnu.org pspp "GNU PSPP User Manual") >&AS_MESSAGE_LOG_FD 2>&1]) +BP_OUTPUT([User Manual], [user-manual]) + +BP_START_STEP([Build developers guide]) +BP_RUN([(cd pspp-$COMMIT && GENDOCS_TEMPLATE_DIR=.. ../gendocs.sh -s doc/pspp-dev.texinfo -o results/dev-guide --email bug-gnu-pspp@gnu.org pspp-dev "GNU PSPP Developers Guide") >&AS_MESSAGE_LOG_FD 2>&1]) +BP_OUTPUT([Developers Guide], [dev-guide]) + +BP_FINISH diff --git a/make-binary.as b/make-binary.as new file mode 100644 index 0000000000..3d3f225a04 --- /dev/null +++ b/make-binary.as @@ -0,0 +1,93 @@ +# -* autoconf -*- + +BP_INIT([dist-pspp.log]) + +BP_SET_VAR([COMMIT], [@PSPP_COMMIT@]) +BP_SET_VAR([GNULIB_COMMIT], [@GNULIB_COMMIT@]) +BP_SET_VAR([BRANCH], [@BRANCH@]) + +ABBREV_COMMIT=`expr "$COMMIT" : '\(......\)'` +BP_SET_VAR([ABBREV_COMMIT]) + +BP_START_STEP([Extracting Git sources]) +tar xzf pspp-$COMMIT.tar.gz + +BP_START_STEP([Extract repository version number]) +(cd pspp-$COMMIT && autoconf -t AC_INIT) > tmp$$ +IFS=: read FILE LINE macro PACKAGE REPO_VERSION BUG_REPORT TARNAME URL < tmp$$ +BP_SET_VAR([REPO_VERSION]) + +BP_START_STEP([Checking Automake mode]) +if grep gnits pspp-$COMMIT/Makefile.am >/dev/null 2>&1; then + AM_MODE=gnits +else + AM_MODE=gnu +fi +BP_SET_VAR([AM_MODE]) + +BP_START_STEP([Generate build version number]) +case $AM_MODE-$REPO_VERSION in # ( + gnits-*-*) + # We want to append -g012345, but we're in Gnits mode and the + # version number already has a hyphen, so we have to omit the + # second hyphen. + VERSION="$REPO_VERSIONg$ABBREV_COMMIT" + ;; # ( + *) + VERSION="$REPO_VERSION-g$ABBREV_COMMIT" + ;; +esac +BP_SET_VAR([VERSION]) + +BP_START_STEP([Update version number in configure.ac]) +echo "AC_INIT([[$PACKAGE], [$VERSION], [$BUG_REPORT], [$TARNAME], [$URL]])" > tmp$$ +sed -n "${LINE}r tmp$$ +$LINE!p" < pspp-$COMMIT/$FILE > pspp-$COMMIT/$FILE.new +mv pspp-$COMMIT/$FILE.new pspp-$COMMIT/$FILE + +BP_START_STEP([Updating NEWS]) +{ + sed -n '/^Changes/q;p' pspp-$COMMIT/NEWS +cat <<_BP_EOF +Changes from $REPO_VERSION to $VERSION: + + * Built from PSPP commit $COMMIT + in branch $BRANCH on host `hostname`. + + * Built from Gnulib commit $GNULIB_COMMIT. + +_BP_EOF + sed -n '/^Changes/,$p' pspp-$COMMIT/NEWS +} > NEWS.new +mv NEWS.new pspp-$COMMIT/NEWS + +BP_START_STEP([Extract Gnulib source]) +BP_RUN([tar xzf gnulib-$GNULIB_COMMIT.tar.gz >&AS_MESSAGE_LOG_FD 2>&1]) + +BP_START_STEP([Bootstrap (make -f Smake)]) +BP_RUN([(cd pspp-$COMMIT && make -f Smake GNULIB=../gnulib-$GNULIB_COMMIT) >&AS_MESSAGE_LOG_FD 2>&1]) + +BP_START_STEP([Configure]) +AS_MKDIR_P([pspp-$COMMIT/_build]) +BP_RUN([(cd pspp-$COMMIT/_build && ../configure @CONFIGUREFLAGS@) >&AS_MESSAGE_LOG_FD 2>&1]) + +BP_START_STEP([Make source tarball]) +BP_RUN([(cd pspp-$COMMIT/_build && make dist) >&AS_MESSAGE_LOG_FD 2>&1]) +BP_MOVE_OUTPUT([source distribution], [pspp-$COMMIT/_build/pspp-$VERSION.tar.gz]) + +potfile=pspp-$COMMIT/_build/po/pspp.pot +if test ! -e $potfile; then + potfile=pspp-$COMMIT/po/pspp.pot +fi +BP_COPY_OUTPUT([translation templates], [$potfile]) + +BP_START_STEP([Build user manual]) +BP_RUN([(cd pspp-$COMMIT && cp _build/doc/*.texi doc/) >&AS_MESSAGE_LOG_FD 2>&1]) +BP_RUN([(cd pspp-$COMMIT && GENDOCS_TEMPLATE_DIR=.. ../gendocs.sh -s doc/pspp.texinfo -o results/user-manual --email bug-gnu-pspp@gnu.org pspp "GNU PSPP User Manual") >&AS_MESSAGE_LOG_FD 2>&1]) +BP_OUTPUT([User Manual], [user-manual]) + +BP_START_STEP([Build developers guide]) +BP_RUN([(cd pspp-$COMMIT && GENDOCS_TEMPLATE_DIR=.. ../gendocs.sh -s doc/pspp-dev.texinfo -o results/dev-guide --email bug-gnu-pspp@gnu.org pspp-dev "GNU PSPP Developers Guide") >&AS_MESSAGE_LOG_FD 2>&1]) +BP_OUTPUT([Developers Guide], [dev-guide]) + +BP_FINISH diff --git a/make-builder.as b/make-builder.as new file mode 100644 index 0000000000..a30e4374ce --- /dev/null +++ b/make-builder.as @@ -0,0 +1,208 @@ +AS_INIT[]dnl -*- shell-script -*- +m4_divert_push([HEADER-COPYRIGHT])dnl +# @configure_input@ +# make-builder -- create PSPP build scripts + +# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, +# 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +m4_divert_pop([HEADER-COPYRIGHT])dnl back to BODY +AS_ME_PREPARE[]dnl + +usage=["\ +Usage: $0 [OPTION]... REPOSITORY BRANCH +where REPO and BRANCH are a Git repository and branch to clone. + +Options: + -h, --help Print this usage message and exit + -b, --build=NUMBER Set build number (default: next available) + -o, --output=DIRECTORY Set build directory (default: build\$BUILDNR) + -f, --force Overwrite files in existing directory + +Report bugs to . +GNU PSPP: . +General help using GNU software: ."] + +version=["\ +make-builder (@PACKAGE_NAME@) @VERSION@ +Copyright (C) 2010 Free Software Foundation, Inc. +License GPLv3+/Autoconf: GNU GPL version 3 or later +, +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. + +Written by Ben Pfaff."] + +help="\ +Try \`$as_me --help' for more information." + +exit_missing_arg=' + m4_bpatsubst([AS_ERROR([option `$[1]' requires an argument$as_nl$help])], + ['], ['\\''])' +# restore font-lock: ' + +# Variables. +outdir= +overwrite=false +buildnr= + +# Parse command line. +while test $# -gt 0 ; do + option=[`expr "x$1" : 'x\(--[^=]*\)' \| \ + "x$1" : 'x\(-.\)'`] + optarg=[`expr "x$1" : 'x--[^=]*=\(.*\)' \| \ + "x$1" : 'x-.\(.*\)'`] + case $1 in + --version | -V ) + echo "$version" ; exit ;; + --help | -h ) + AS_ECHO(["$usage"]); exit ;; + + --verbose | -v ) + verbose=: + autom4te_options="$autom4te_options $1"; shift ;; + + --output=* | -o?* ) + outdir=$optarg + shift ;; + --output | -o ) + test $# = 1 && eval "$exit_missing_arg" + outdir=$2 + shift; shift ;; + + --build=* | -b?* ) + buildnr=$optarg + shift ;; + --build | -b ) + test $# = 1 && eval "$exit_missing_arg" + buildnr=$2 + shift; shift ;; + + --force | -f ) + overwrite=true ;; + + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + exec >&2 + AS_ERROR([invalid option `$[1]'$as_nl$help]) ;; #` + * ) + break ;; + esac +done + +# Find the input file. +case $# in + 2) + repository=$1 + branch=$2 + ;; + *) exec >&2 + AS_ERROR([invalid number of arguments$as_nl$help]) ;; +esac + +# Choose build number. +if test "x$buildnr" = x; then + lock_file () { + echo $$ > $[1].$$ + if ln $[1].$$ $[1].lock; then + rm $[1].$$ + return 0 + fi + pid=`cat $[1].lock` + if kill -0 pid; then + : + else + rm -f $[1].lock + fi + return 1 + } + until lock_file build_number; do + sleep 1 + done + + if test -e buildnr; then + buildnr=`cat buildnr` + else + buildnr=1 + fi + echo `expr $buildnr + 1` > buildnr + + rm build_number.lock +fi + +# Check that build number is a number. +if expr "X$buildnr" : '[X[0-9][0-9]*$]' >/dev/null; then + : +else + exec >&2 + AS_ERROR([invalid build number `$buildnr'$as_nl$help]) #` +fi + +# Ensure that git repository exists. +GIT_DIR=$PWD/repo.git +export GIT_DIR +git init + +# Fetch PSPP source. +git fetch $repository +$branch:refs/builds/$buildnr/pspp + +# Get PSPP commit number. +pspp_commit=`git rev-parse refs/builds/$buildnr/pspp` + +# Get gnulib commit number. +gnulib_commit=`\ + git show refs/builds/$buildnr/pspp:README.Git | \ + sed -n 's/^[[ ]]*commit \([[0-9a-fA-F]]\{8,\}\)$/\1/p' | \ + head -1` + +# Fetch Gnulib source. +if git rev-parse --verify --quiet $gnulib_commit^0 > /dev/null; then + : +else + # We don't have the right commit yet, update Gnulib. + git fetch git://git.sv.gnu.org/gnulib.git +refs/heads/*:refs/remotes/gnulib/* +fi +git update-ref refs/builds/$buildnr/gnulib $gnulib_commit + +# Choose and create output directory. +test -z "$outdir" && outdir=build$buildnr +if test -e "$outdir" && test $overwrite = false; then + exec >&2 + AS_ERROR([$outdir exists and --force not specified$as_nl$help]) +fi +AS_MKDIR_P([$outdir]) + +# Make source tarballs. +git archive --format=tar --prefix=pspp-$pspp_commit/ $pspp_commit \ + | gzip > $outdir/pspp-$pspp_commit.tar.gz +git archive --format=tar --prefix=gnulib-$gnulib_commit/ $gnulib_commit \ + | gzip > $outdir/gnulib-$gnulib_commit.tar.gz + +# Make build scripts. +sed < dist-pspp.in > "$outdir/dist-pspp" " +s,[@]PSPP_COMMIT[@],$pspp_commit,g +s,[@]GNULIB_COMMIT[@],$gnulib_commit,g +s,[@]BRANCH[@],$branch,g +s,[@]CONFIGUREFLAGS[@],,g +" +chmod +x "$outdir/dist-pspp" + +# Copy in scripts. +cp gendocs.sh gendocs_template gendocs_template_min "$outdir/" diff --git a/results2html b/results2html index 4e3224fca3..448d1e5e41 100755 --- a/results2html +++ b/results2html @@ -227,6 +227,11 @@ print LOG_HTML < EOF +open (HTACCESS, '>', '.htaccess'); +print HTACCESS <', "build.css"); print CSS <