From: Ben Pfaff Date: Tue, 9 Feb 2010 01:20:08 +0000 (-0800) Subject: do full build, install, check, etc. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42e95ace2429555f5f872059b70890ffdf2522c2;p=pspp do full build, install, check, etc. --- diff --git a/build-pspp b/build-pspp index 8180ddd80c..a20152e284 100755 --- a/build-pspp +++ b/build-pspp @@ -14,8 +14,8 @@ usage () if $help; 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); @@ -27,6 +27,20 @@ print "Create $builddir\n"; 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; @@ -61,9 +75,8 @@ if (@ARGV == 2) { 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"; } } @@ -86,7 +99,7 @@ if (@ARGV == 2) { 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 } @@ -108,8 +121,74 @@ 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 <