#!/bin/sh -e
BUILDDIR=`dirname $PWD`

cat > ~/.pbuilderrc <<EOT
AUTO_DEBSIGN=yes
PKGNAME_LOGFILE=yes
BUILDRESULT=$BUILDDIR
BASEPATH="/var/cache/pbuilder/trusty.cow"
# otherwise packages from PPA break the build
ALLOWUNTRUSTED=yes
## COMPONENTS="main universe multiverse restricted"
COMPONENTS="main universe"
HOOKDIR=${HOME}/.pbuilder
# BINDMOUNTS="/home/vagrant/_pbuilder_local_deps /dev/shm"
# This is a workaround a problem that /dev/shm is not mounted in pbuilder chroot
BINDMOUNTS="/dev/shm"
EOT

# Aufruf für binary-only build:
#   pdebuild --debbuildopts "-B"
/usr/bin/pdebuild --pbuilder cowbuilder --debbuildopts "-i\.git -I.git $*" --debsign-k "Andreas Tille <tille@debian.org>"  # $@
cd ..
lintian -i *.deb *.dsc
