Patching a debian package

Published: Wednesday, Dec 26, 2007 Last modified: Thursday, Nov 14, 2024

If I want to make a patch for a debian package:

cd /tmp/; apt-get source package; cp -r package-1.1/ package-1.1.orig/

and then fix file(s) in package-1.1/ directory

/tmp$ diff -ur package-1.1.orig  package-1.1/ | mail thepackage-maintainer@debian.org

You should submit the patch via the BTS using reportbug esp. when the fix addresses an already reported bug and/or non-trivial like mine usually aren’t. And then applying the sodding thing:

cd suitable-directory; patch --dry-run --silent -pX < patchfile # X is a suitable number to remove elements from the pathnames in the patch file.

Example:

sam$ patch -p0 < /home/hendry/Mail/mail-attachments/maradns_1.2.03.3-1.1.diff