# Apply a debdiff patch.
# - PKGNAME: Name of the package
# - DEBDIFF: Deb diff file.
# - RESPACKAGE: Resulting package of debuild

# Neccesary packages to make the deb package
sudo apt-get install build-essential fakeroot devscripts

apt-get source PKGNAME
sudo apt-get build-dep PKGNAME
cd PKGNAME-*
patch -p1 < ../DEBDIFF
debuild -uc -us
sudo dpkg -i ../RESPACKAGE

# Thanks to https://wiki.ubuntu.com/UbuntuPackagingGuide/BuildFromDebdiff