I have a few local patches to customize some packages in my system, so every time one of these packages is upgraded, I have to manually run apt source to fetch the sources, apply the patches, build and install the package.

Most of my patches are very small and can be applied to multiple package versions without manual conflict resolution, so I feel like I'm doing a lot of repeated work.

Is there a better way to do this?


It depends on how many such patches you have.

I don't think any code for doing what you want to do exists, so you'd have to write something yourself.

If it's just a handful, what you're doing right now seems like the right approach. Anything else will almost certainly cost you a lot of time, and then you run afoul of XKCD #1205.

If you have a decent set of patches, you might be able to use some continuous integration system (say, buildbot) together with dgit to maintain your patches in git, and rebase your patch branch onto version that was newly uploaded. After having done so, your CI system then calls dch to create a new changelog entry with a new version number, feeds it to sbuild to build the package, and uploads it to a local repository (something like reprepro which you enable on all your hosts.

It's doable, but would be a lot of work to set up; and depending on how much time you spend maintaining your patches, might not be worth it.

  • Thanks for the suggestion, but it looks far complicated for something I will only use to apply local customizations. Do you know a way to involve a script with the names of packages that were upgraded? If such a hook exists, I could write a shell script that is executed when the any of the interesting packages are upgraded, fully automating the task. – Thiago de Arruda Nov 13 '17 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.