Ubuntu – How to package the git repo and publish to the launchpad ppa


I have GitHub repo named logger. Its a C++ library. What I am doing to package and publish to my launchpad ppa is

rm -Rf Packages2
mkdir Packages2
cp -R workspace/logger/ Packages2/logger-1.0
cd Packages2/logger-1.0
rm -R build/
rm -R debian/
rm -R dist/
rm -R nbproject/
rm -R QtBuild/
rm -Rf .git
rm Makefile.old 
rm CMakeLists.txt.user

cd ~/Packages2/logger-1.0/
make clean
cd ..
rm -Rf logger-1.0.tar.gz logger_* logger logger-dev_* liblogger1_* logger1_* build-area/logger-1.0 build-area/logger_* build-area liblogger1_* build-area/logger-dev_* build-area/logger1*

tar -czf logger-1.0.tar.gz logger-1.0
bzr dh-make logger 1.0 logger-1.0.tar.gz
cd logger/debian/
rm *ex *EX
cp ~/workspace/logger/debian/control ./
cp ~/workspace/logger/debian/changelog ./
cp ~/workspace/logger/debian/copyright ./
cp ~/workspace/logger/debian/rules ./
cp ~/workspace/logger/debian/README.Debian ./
cp ~/workspace/logger/debian/README.source ./
bzr commit -m "Initial commit of Debian packaging."
bzr builddeb -- -us -uc # -sd
bzr builddeb -S -- # -sd
bzr tag release-1.1
cd ../../build-area
pbuilder-dist xenial build logger_1.0-0ubuntu1.dsc
cd ../logger
bzr push lp:~satyagowtham-k-gmail/+junk/logger-package
cd ../build-area
dput ppa:satyagowtham-k-gmail/ferryfair.ppa logger_1.0-0ubuntu1_source.changes

Now I came to know that we can use git instead of bzr. I found very sparse documentation regarding packaging and publishing to launchpad ppa.
How can I accomplish it?

Best Answer

It turns out to be very simple

cd ~/workspace/logger
git tag v1.0
git checkout -b ubuntu/xenial
mkdir debian
cd debian
vi changelog
vi control
vi rules
vi liblogger-dev.dirs
vi liblogger-dev.install
vi liblogger1.dirs
vi liblogger1.install
mkdir source
vi source/format
vi compat
cd ..
git add debian
git commit -a -m "packed from git"
# Check if full build works (so we don't upload a broken source package)
gbp buildpackage --git-upstream-tag='v1.0' --git-debian-branch=ubuntu/xenial
# Build source package
debuild -S -sa
# Upload source package to ppa
dput ppa:satyagowtham-k-gmail/ferryfair.ppa ../logger_1.0-0ubuntu1_source.changes

that is all.