This script is quite useful to test Debian packaging and build against the master of a project.

I use it to develop the packaging in my debian branch and pull the latest master from the projects' repo.

set -e
set -x


[ -d tmpbuilddir ] && rm -rf tmpbuilddir

mkdir tmpbuilddir

cd tmpbuilddir
git clone -b master
cd libelektra
git remote add upstream

git fetch upstream master
git merge --no-ff -m "merge $VERSION" upstream/master
git tag -f $VERSION

git checkout -b debian origin/debian
git merge --no-ff -m "merge $VERSION" master

dch -l ".$BUILD_NUMBER" "auto build"

git commit -am "auto build $VERSION"

git archive --format=tar HEAD | gzip > ../elektra_$VERSION.orig.tar.gz

annotate-output +"%H:%M:%S.%N" dpkg-buildpackage -sa | tee ~/buildlog.log