#!/bin/sh
# test that the current darcs repository builds debian style
set -ev

# test that current working directory matches darcs get expectation
if [ ! -f autogen.sh ]; then echo "build: run in wrong directory"; exit 1; fi

# where to build
BUILDROOT=/tmp/netrek-server.$$

# copy the repository there
darcs get .. $BUILDROOT

# go there
cd $BUILDROOT/Vanilla

# build configure
sh autogen.sh

# Build debian arch, noarch, and source packages using fakeroot
dpkg-buildpackage -sa -rfakeroot
if [ $? -ne 0 ]; then
  echo "Error: Build failure"
  exit 1
fi

# report success
echo success
exit 0