In some very rare situations you may find yourself in the need to recompile a Debian (or Ubuntu) package. Luckily for all of use, the great Debian packaging system makes this a piece of cake.
Let's say we want to recompile mod_python for apache 2 to hook in to python 2.5, instead of the default 2.4.
First, get every thing installed you may need to build the libapache2-mod-python package.
Okay, next let's grab the source for the package. The source will be unpacked to your current working directory, so it may be a good idea to create a seperate directory for this.
This will build the package. You will get some warnings and errors about missing GPG keys. This is okay. You are not the package maintainer, so your packages should not be marked as 'original'.
You're now ready to install your compiled package.