It is very easy to build a debian package from source. Typically you want to do this if you patched it yourself, but want it installed the “standard way”. This of course works with Ubuntu as well. In this example, we are rebuilding shotwell. Pay attention to when sudo is used.
$ sudo apt-get build-dep shotwell $ mkdir tmpsrc $ cd tmpsrc $ apt-get source shotwell
Now it is time to patch the source of shotwell. Then:
$ cd shotwell-0.7.2 $ debuild -uc -us $ cd .. $ sudo dpkg -i shotwell_0.7.2-0ubuntu2_amd64.deb
Of course, the names may depend on versions, architectures etc.
NOTE: Debian 6.0, use dpkg-buildpackage instead of debuild.
How to make the next apt-get upgrade not touch your custom version?
# echo "hold shotwell" | dpkg --set-selections # dpkg --get-selections | grep shotwell
Replace “hold” with “install” to enable upgrade again.