While upgrading my server, I had to create a new version of Cyrus-SASL packages with the crypt patch. This turned out to be more difficult as I thought as just patching the raw source would conflict with debian patches applied after that and the package building would fail. Fortunately, I learned about (dpatch)[http://www.tuxmaniac.com/blog/2008/01/25/dpatch-just-superb-a-short-how-to/], which is a standard mechanism for patching stuff in Debian.
Once I figured out how to do it, it tunred out to be very simple:
- Unpack the original orig.tar.gz
- Apply the Debian diff (this would create a debian subdirectory)
- Edit changelog file to add a new release (so that we can keep track of it).
dpatch-edit-patch fixing_footo create a patch. This will create a shell with mounted source package and any changes you make there will be included in the diff.
- Exit the shell without changing anything. You will change things after making sure that the patch is applied in the correct order.
00listto set the patch ordering.
dpatch-edit-patchagain now, with all the previous patches applied.
- Make the necessary changes.
- Build the target package with
debuild-pbuilder(this will download all the dependencies too).
- Install the pakcages with
dpkg -i(I could also create my private apt-repository for this. I wrote about in in a blog entry about pbuilder).
- Pin the packages so that they will not get upgraded
echo "package hold" | dpkg --set-selection