From 898ab60c52851ccc9df653ddcabcd16917831f57 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 6 Jun 2010 22:55:42 -0700 Subject: [PATCH] work on remote builds need to avoid doing vpath build with non-gnu make --- make-bin-dist.as | 95 +++++++++++++++++++++++++++++++++++++++++++----- make-builder.as | 1 - make-src-dist.as | 11 +++--- results2html | 2 +- 4 files changed, 93 insertions(+), 16 deletions(-) diff --git a/make-bin-dist.as b/make-bin-dist.as index 295b498a16..40d20bac47 100644 --- a/make-bin-dist.as +++ b/make-bin-dist.as @@ -8,6 +8,7 @@ where PSPP_DIST.TAR.GZ is a PSPP tarball prepared by \"make dist\" and BINID briefly identifies the target, e.g. \"debian-squeeze-i386\". Options: + --on HOST[:DIR] Perform remote build using ssh and scp -h, --help Print this usage message and exit -f, --force Delete existing directory instead of aborting @@ -35,6 +36,9 @@ exit_missing_arg=' # Variables. overwrite=false +remote= +CONFIGUREFLAGS= +n_envvars=0 # Parse command line. while test $# -gt 0 ; do @@ -49,15 +53,35 @@ while test $# -gt 0 ; do AS_ECHO(["$usage"]); exit ;; --force | -f ) - overwrite=true ;; + overwrite=true + shift ;; + + --on=* ) + remote=$optarg + shift ;; + --on ) + test $# = 1 && eval "$exit_missing_arg" + remote=$2 + shift; shift ;; + + --configureflags=* ) + CONFIGUREFLAGS=$optarg + shift ;; + --configureflags ) + test $# = 1 && eval "$exit_missing_arg" + CONFIGUREFLAGS=$2 + shift; shift ;; -- ) # Stop option processing shift; break ;; - - ) # Use stdin as input. - break ;; -* ) exec >&2 - AS_ERROR([invalid option `$[1]'$as_nl$help]) ;; #` + AS_ERROR([invalid option `$[1]'$as_nl$help]) ;; #`( + *=* ) + AS_VAR_ARITH([n_envvars], [$n_envvars + 1]) + AS_VAR_SET([env$n_envvars], ["$[1]"]) + shift + ;; * ) break ;; esac @@ -78,6 +102,48 @@ if test ! -e "$tarball"; then AS_ERROR([$tarball does not exist]) fi +REMOTE_HOST= +REMOTE_DIR= +case $remote in # ( + "") + ;; # ( + *:*) + REMOTE_HOST=[`expr "$remote" : '\([^:]*\):'`] + REMOTE_DIR=[`expr "$remote" : '[^:]*:\(.*\)'`] + ;; # ( + *) + REMOTE_HOST=$remote + ;; +esac + +if test "X$REMOTE_HOST" != X; then + m4_pattern_allow([BP_SSH]) + : ${BP_SSH=ssh} + + escape () { + AS_ECHO("$1") | sed "s/'/'\\\\''/g" + } + + options= + if test "x$CONFIGUREFLAGS" != x; then + options="--configureflags='"`escape "$CONFIGUREFLAGS"`\' + fi + $overwrite && options="$options --force" + + i=0 + while test $i -lt $n_envvars; do + AS_VAR_ARITH([i], [$i + 1]) + AS_VAR_COPY([tmp], [env$i]) + options="$options '"`escape "$tmp"`"\' + done + shift + + rc=0 + tar cf - make-bin-dist build-aux $tarball | gzip | $BP_SSH $REMOTE_HOST "cd $REMOTE_DIR && zcat | tar xf - && ./make-bin-dist $options $tarball $BINID" || rc=$? + $BP_SSH $REMOTE_HOST "cd $REMOTE_DIR && tar cf - $BINID" | tar xf - || rc=$? + exit $rc +fi + if test -e "$BINID"; then if test $overwrite = true; then chmod -R u+w "$BINID" @@ -92,13 +158,14 @@ BP_INIT_RESULTS([$BINID]) BP_INIT_LOG([$BINID/LOG]) BP_SET_VAR([BUILD_NUMBER], [@BUILD_NUMBER@]) -BP_SET_VAR([PSPP_COMMIT], [@PSPP_COMMIT@]) BP_SET_VAR([PSPP_REPO], [@PSPP_REPO@]) -BP_SET_VAR([GNULIB_COMMIT], [@GNULIB_COMMIT@]) +BP_SET_VAR([PSPP_BRANCH], [@PSPP_BRANCH@]) +BP_SET_VAR([PSPP_COMMIT], [@PSPP_COMMIT@]) BP_SET_VAR([GNULIB_REPO], [@GNULIB_REPO@]) -BP_SET_VAR([BRANCH], [@BRANCH@]) +BP_SET_VAR([GNULIB_COMMIT], [@GNULIB_COMMIT@]) BP_SET_VAR([BINID]) +BP_SET_VAR([CONFIGUREFLAGS]) BP_START_STEP([Determining $tarball target directory]) DIST_DIR=`zcat $tarball | tar tf - 2>/dev/null | sed 1q | sed s,/.*,,` @@ -108,7 +175,7 @@ if test X$DIST_DIR = X; then fi BP_START_STEP([Extracting source tarball]) -BP_RUN([zcat $tarball | tar xkf - >&AS_MESSAGE_LOG_FD 2>&1]) +BP_RUN([zcat $tarball | tar xf - >&AS_MESSAGE_LOG_FD 2>&1]) BP_START_STEP([Extracting tar version]) DIST_VERSION=`$DIST_DIR/configure --version 2>/dev/null | sed 1q | sed 's/.* //'` @@ -118,7 +185,17 @@ BP_START_STEP([Configuring]) BP_RUN([mkdir $DIST_DIR/_$BINID >&AS_MESSAGE_LOG_FD 2>&1]) BP_RUN([chmod -R a-w $DIST_DIR >&AS_MESSAGE_LOG_FD 2>&1]) BP_RUN([chmod u+w $DIST_DIR/_$BINID >&AS_MESSAGE_LOG_FD 2>&1]) -BP_TRY_RUN([(cd $DIST_DIR/_$BINID && ../configure --enable-relocatable --prefix='') >&AS_MESSAGE_LOG_FD 2>&1]) + +set x +i=0 +while test $i -lt $n_envvars; do + AS_VAR_ARITH([i], [$i + 1]) + AS_VAR_COPY([tmp], [env$i]) + set "$@" "$tmp" +done +shift + +BP_TRY_RUN([(cd $DIST_DIR/_$BINID && ../configure --enable-relocatable --prefix='' $CONFIGUREFLAGS "$@") >&AS_MESSAGE_LOG_FD 2>&1]) _bp_status=$? for base in config.h config.log; do fn=$DIST_DIR/_$BINID/$base diff --git a/make-builder.as b/make-builder.as index 8a90693f35..e7fd623a5f 100644 --- a/make-builder.as +++ b/make-builder.as @@ -206,7 +206,6 @@ s,[@]PSPP_BRANCH[@],$PSPP_BRANCH,g s,[@]PSPP_COMMIT[@],$PSPP_COMMIT,g s,[@]GNULIB_COMMIT[@],$GNULIB_COMMIT,g s,[@]GNULIB_REPO[@],$GNULIB_REPO,g -s,[@]CONFIGUREFLAGS[@],,g " chmod +x "$outdir/$base" done diff --git a/make-src-dist.as b/make-src-dist.as index 81d42eabe8..2e491de997 100644 --- a/make-src-dist.as +++ b/make-src-dist.as @@ -12,7 +12,7 @@ BP_SET_VAR([PSPP_COMMIT], [@PSPP_COMMIT@]) BP_SET_VAR([GNULIB_COMMIT], [@GNULIB_COMMIT@]) BP_SET_VAR([GNULIB_REPO], [@GNULIB_REPO@]) -ABBREV_COMMIT=`expr "$COMMIT" : '\(......\)'` +ABBREV_COMMIT=`expr "$PSPP_COMMIT" : '\(......\)'` BP_START_STEP([Extracting Git sources]) BP_RUN([(cd repo && zcat pspp-$PSPP_COMMIT.tar.gz | tar xf -) >&AS_MESSAGE_LOG_FD 2>&1]) @@ -46,9 +46,10 @@ BP_SET_VAR([VERSION]) BP_START_STEP([Update version number in configure.ac]) AS_ECHO(["AC_INIT([$PACKAGE], [$VERSION], [$BUG_REPORT], [$TARNAME], [$URL])]") > tmp$$ -sed -n "${LINE}r tmp$$ -$LINE!p" < repo/pspp-$PSPP_COMMIT/$FILE > repo/pspp-$PSPP_COMMIT/$FILE.new -mv repo/pspp-$PSPP_COMMIT/$FILE.new repo/pspp-$PSPP_COMMIT/$FILE +BP_RUN([sed -n "${LINE}r tmp$$ +$LINE!p" < repo/pspp-$PSPP_COMMIT/$FILE > repo/pspp-$PSPP_COMMIT/$FILE.new 2>&AS_MESSAGE_LOG_FD]) +BP_RUN([mv repo/pspp-$PSPP_COMMIT/$FILE.new repo/pspp-$PSPP_COMMIT/$FILE >&AS_MESSAGE_LOG_FD 2>&1]) +BP_RUN([rm tmp$$ >&AS_MESSAGE_LOG_FD 2>&1]) BP_START_STEP([Updating NEWS]) { @@ -75,7 +76,7 @@ BP_RUN([(cd repo/pspp-$PSPP_COMMIT && make -f Smake GNULIB=../gnulib-$GNULIB_COM BP_START_STEP([Configure]) mkdir repo/pspp-$PSPP_COMMIT/_dist -BP_RUN([(cd repo/pspp-$PSPP_COMMIT/_dist && ../configure @CONFIGUREFLAGS@) >&AS_MESSAGE_LOG_FD 2>&1]) +BP_RUN([(cd repo/pspp-$PSPP_COMMIT/_dist && ../configure) >&AS_MESSAGE_LOG_FD 2>&1]) BP_START_STEP([Make source tarball]) BP_RUN([(cd repo/pspp-$PSPP_COMMIT/_dist && make dist) >&AS_MESSAGE_LOG_FD 2>&1]) diff --git a/results2html b/results2html index c6aaab634d..c682b5e514 100755 --- a/results2html +++ b/results2html @@ -142,7 +142,7 @@ print INDEX < EOF -print INDEX "

Build ", $vars{"build_number"}, ": $result

\n"; +print INDEX "

Build ", $vars{"BUILD_NUMBER"}, ": $result

\n"; print INDEX "

Build Properties

\n"; print INDEX "\n"; -- 2.30.2