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)
+ -o, --output=DIRECTORY Set build directory (default: build\$BUILD_NUMBER)
-f, --force Overwrite files in existing directory
Report bugs to <bug-gnu-pspp@gnu.org>.
# Variables.
outdir=
overwrite=false
-buildnr=
+BUILD_NUMBER=
+GNULIB_REPO=git://git.sv.gnu.org/gnulib.git
# Parse command line.
while test $# -gt 0 ; do
shift; shift ;;
--build=* | -b?* )
- buildnr=$optarg
+ BUILD_NUMBER=$optarg
shift ;;
--build | -b )
test $# = 1 && eval "$exit_missing_arg"
- buildnr=$2
+ BUILD_NUMBER=$2
shift; shift ;;
--force | -f )
# Find the input file.
case $# in
2)
- repository=$1
- branch=$2
+ PSPP_REPO=$1
+ PSPP_BRANCH=$2
;;
*) exec >&2
AS_ERROR([invalid number of arguments$as_nl$help]) ;;
esac
# Choose build number.
-if test "x$buildnr" = x; then
+if test "x$BUILD_NUMBER" = x; then
lock_file () {
echo $$ > $[1].$$
if ln $[1].$$ $[1].lock; then
done
if test -e buildnr; then
- buildnr=`cat buildnr`
+ BUILD_NUMBER=`cat buildnr`
else
- buildnr=1
+ BUILD_NUMBER=1
fi
- echo `expr $buildnr + 1` > buildnr
+ echo `expr $BUILD_NUMBER + 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
+case $BUILD_NUMBER in # (
+ "" | *[!0-9]*)
+ exec >&2
+ AS_ERROR([invalid build number `$BUILD_NUMBER'$as_nl$help]) #`
+ ;;
+esac
# Ensure that git repository exists.
GIT_DIR=$PWD/repo.git
git init
# Fetch PSPP source.
-git fetch $repository +$branch:refs/builds/$buildnr/pspp
+git fetch $PSPP_REPO +$PSPP_BRANCH:refs/builds/$BUILD_NUMBER/pspp
# Get PSPP commit number.
-pspp_commit=`git rev-parse refs/builds/$buildnr/pspp`
+PSPP_COMMIT=`git rev-parse refs/builds/$BUILD_NUMBER/pspp`
# Get gnulib commit number.
-gnulib_commit=`\
- git show refs/builds/$buildnr/pspp:README.Git | \
+GNULIB_COMMIT=`\
+ git show refs/builds/$BUILD_NUMBER/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
+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/*
+ git fetch $GNULIB_REPO +refs/heads/*:refs/remotes/gnulib/*
fi
-git update-ref refs/builds/$buildnr/gnulib $gnulib_commit
+git update-ref refs/builds/$BUILD_NUMBER/gnulib $GNULIB_COMMIT
# Choose and create output directory.
-test -z "$outdir" && outdir=build$buildnr
+test -z "$outdir" && outdir=build$BUILD_NUMBER
if test -e "$outdir" && test $overwrite = false; then
exec >&2
AS_ERROR([$outdir exists and --force not specified$as_nl$help])
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
+mkdir "$outdir/repo"
+git archive --format=tar --prefix=pspp-$PSPP_COMMIT/ $PSPP_COMMIT \
+ | gzip > $outdir/repo/pspp-$PSPP_COMMIT.tar.gz
+git archive --format=tar --prefix=gnulib-$GNULIB_COMMIT/ $GNULIB_COMMIT \
+ | gzip > $outdir/repo/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
+for base in make-src-dist make-bin-dist; do
+ sed < $base.in > "$outdir/$base" "
+s,[@]BUILD_NUMBER[@],$BUILD_NUMBER,g
+s,[@]PSPP_REPO[@],$PSPP_REPO,g
+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/dist-pspp"
+ chmod +x "$outdir/$base"
+done
-# Copy in scripts.
-cp gendocs.sh gendocs_template gendocs_template_min "$outdir/"
+# Copy in auxiliary files.
+mkdir "$outdir/build-aux"
+for base in gendocs.sh gendocs_template gendocs_template_min; do
+ cp "build-aux/$base" "$outdir/build-aux/"
+done