I've done easy fixes (debdiffs) in Ubuntu and find I need to look up exactly how I want to do a debdiff every time. Last time I had to look at 5 different docs to get all the commands I needed. The bug I based this on was a debian only change (Init script), I plan to update it next time I have an actual source change.
- Start a new VM/ Cloud instance
- sudo apt-get install packaging-dev
- apt-get source <package_name> ; apt-get build-dep <package_name>
- cd into-directory-created
- Make the change (if it's only a debian/ change)
- dch -i (document it)
- debuild -S -us -uc (build it)
- debdiff rrdtool_1.4.7-1.dsc rrdtool_1.4.7-1ubuntu1.dsc > rrdtool_1.4.7-1ubuntu1.debdiff (make the debdiff - note to me, change the name later)
- cd into-directory; DEB_BUILD_OPTIONS='nostrip noopt debug' fakeroot debian/rules binary (build it)
- Test it
My understanding is the current best practice is to use mk-build-deps, provided by the devscripts package, to install build dependencies. See https://wiki.debian.org/BuildingAPackage#Get_the_build_dependencies
With apt-get build-dep, the installed packages are marked as manually installed and so won't be offered for autoremoval. mk-build-deps creates a dummy metapackage with the build deps as dependencies. When that generated package is later removed, so are the build deps.
Or, add "APT::Get::Build-Dep-Automatic true;" to your apt.conf to mark the build deps as automatically installed so they will be removed with the next "apt-get autoremove"