This tutorial walks you though making a debian packaging git repo where upstream branch is the upstream git repo.

We will take libvarnam as an example.

mkdir varnam

We need to make initial debian directory template with debmake (for golang, ruby or node packages, there are tools that will do this directly). We need a release tarball for this.

cd varnam
mv v3.2.6.tar.gz libvarnam-3.2.6.tar.gz
tar -zxvf libvarnam-3.2.6.tar.gz
cd libvarnam-3.2.6
cd ..

Now initialize and pull the upstream repo,

mkdir libvarnam
cd libvarnam
git init
git checkout -b upstream
git remote add upstream
git pull upstream master --tags

Now copy the debian directory created by debmake to your repo.

git checkout -b debian/sid v3.2.6
cp -r ../libvarnam-3.2.6/debian/ .
git add debian/
git commit -m "Add debian directory created by debmake"

Now create debian/gbp.conf to make debian/sid as debian-branch. Also run origtargz automatically after gbp clone.



git add debian/gbp.conf
git commit debian/gbp.conf -m "Add debian-brach=debian/sid, run origtargz automatically"

Now you can build your package

gbp buildpackage

Fix build errors and make lintian happy.

Credits: Thanks to jmkim for originally showing the steps here