2008 Jan 25

As I had mentioned in this post about the top gear packaging activity that is going on for a few Science tools (more specifically Electronics), one review point that the packager comes across instantly is that “Do not change upstream code”. This is a Golden rule for packagers. Making these changes as patches in debian/ (for debian based distros ofcourse ;-) ) is highly recommended. One such tool for achieving this is DPATCH. kart linked me to this nice page which has a few details on dpatch. Still the page did not have a step by step how to, instead has tidbits. So here goes my how-to or just a documentation of what I learnt.

1. Install dpatch. sudo apt-get install dpatch

2. Go to “your_packages_top_directory”/debian and create a directory “patches”. (mkdir patches)

3. Inside this debian/patches directory create a file “00list”. The reason for this file is explained in the coming points.

4. Open up debian/rules in your favourite editor (I expect it to be emacs ofcourse ;-) ) and do the changes mentioned below.

* Add this line “include /usr/share/dpatch/dpatch.make” without the quotes at the top.

* Append to the config.status section “patch-stamp” before “configure”. This shall let the package know that there is a patch stamp that needs to be checked.

* In the “clean” section add “unpatch”. This ensures the patch is reverted when a make clean is performed.

5. Now save the debian/rules and execute the following command. “dpatch-edit-patch {patchname}”. Say for example the patch name is fixing_foo then the command is “dpatch-edit-patch fixing_foo”

6. This opens up a temporary shell where a copy of the source package is ready. Make the changes that you would want to do and exit the shell. Patch is created. Wow! (Check debian/patches directory)

7. Update this patch name in the 00list file that we created in point 3. This file will have the list of patches that needs to be applied in the specified order. Repeat this process until all the necessary changes to upstream is done and patches are ready.

Now give the package for a build. Sit back, relax and enjoy the pbuilder experience!

 
  1. https://wiki.ubuntu.com/PackagingGuide/PatchSystems is a great resource for dealing with patch systems too.

  2. Broken WordPress: debian unstable is called unstable for a reason…

    Update 2009-09-07: The maintainer of the wordpress package released “my” bugfix. It’s available now for those using unstable (sid). I guess it will be available in testing (lenny) soon, since the bug is listed in the release critical …

  3. please tell me how to create the rules file as soon as possible

© 2006-2009 Aanjhan Ranganathan, All rights reserved (unless otherwise stated).
Home Projects Presentations Profile Photography Notes Archives Blogroll Top ↑ Theme by Eficacy Designs