Wednesday, March 16, 2022

[SOLVED] How to patch a debian package?

Issue

I used apt-get source to get a debian package $PKG-VERSION. I now have a folder $PKG-VERSION/, files $PKG-VERSION.diff.gz, $PKG-VERSION.dsc and $PKG.orig.tar.gz. If I understand it correctly, the diff file $PKG-VERSION.diff that is archived in $PKG-VERSION.diff.gz represents the difference between the upstream version in .orig.tar.gz and the debian version, and it has already been applied to files in the folder $PKG-VERSION/. But then I go look inside $PKG-VERSION/debian/patches/ subfolder. There's a bunch of .diff and .patch files there. When I look at one of the .diffs, I see that the patches haven't been applied. So then I try to run quilt push -a to apply the patches. It returns that

"the patch ... is already applied; check your series file"

for each patch. But it clearly isn't when I check the sources.

Also after reading debian/README.source, it suggests to run the target patch in debian/rules. But I don't see any patch: in the rules file and running make patch gives

make: *** No rule to make target 'patch'.  Stop.

So I don't understand: are the patches in debian/patches/ applied in the binary $PKG-VERSION.deb even though the source files are unpatched? And how do I patch the sources? I could just write a bash script to loop over and run patch over debian/patches/*.diff but surely that's not how it's supposed to work?


Solution

The patches in debian/patches are applied during the build process. So the binaries will be based on the patches.

See https://wiki.debian.org/debian/patches.



Answered By - Xypron
Answer Checked By - Gilberto Lyons (WPSolving Admin)