How to create and maintain patch on Debian package?
I want to patch on Trac package. I know how to patch and rebuild the package, but there are some things I don't understand very well.
My patch is something dangerous and not likely to commit back to the community. So, let me just say, it's a very private patch. But, I want my patch keep working when the Ubuntu packages upgrade. (Should I apt-get source trac
and move my patch to the new version of source directory each time the Trac
upgrades?)
I see there is a patch/
directory (many using quilt
I guess) in debian/
, but I don't know how to use it? Will debuild
automatic apply all patches in the patch/
directory? And what about dpkg-buildpackage
? Is there some environ variables to control the selection of patches to apply?
Read the Patches to Packages section in the Packaging Guide, for a better understanding how it works you should read the entire guide.
Even though this is an old question, it is actual still. Thus I'd like to add some up-to-date information to it. The other answer bluntly links to manual whereas it would be helpful to point exactly the necessary information.
From the manual mentioned relevant part is
8.4. Upgrading to New Upstream Versions
To upgrade to the new version, you can use
bzr merge-upstream
command
But this is Ubuntu-specific.
Alternatively one can use apt-src
. Manual says:
-p, --patch
Try to patch local changes into new source tree when upgrading. On
by default, use --no-p to disable. Configuration Item:
APT::Src::Patch.
For this to work you need to install apt-src
, with sudo apt-get install apt-src
for instance.
Another possibility is to use quilt
. Excerpt from paragraph "5.26. patches/*" from Debian New Maintainers' Guide follows:
When anyone (including yourself) provides a patch foo.patch to the source later, modifying a 3.0 (quilt) source package is quite simple:
$ dpkg-source -x gentoo_0.9.12.dsc
$ cd gentoo-0.9.12
$ dquilt import ../foo.patch
$ dquilt push
$ dquilt refresh
$ dquilt header -e
... describe patch