In the comments of the article explaining how to generate different dependencies on Debian and Ubuntu with a common source package, I got asked if it was possible to apply a patch only in some distribution. And indeed it is.
The source package format 3.0 (quilt) has a neat feature for this. Instead of unconditionally using debian/patches/series
to look up patches, dpkg-source first tries to use debian/patches/vendor.series
(where vendor is ubuntu, debian, etc.). Note that dpkg-source does not stack patches from multiple series file, it uses a single series file, the first that exists.
So what’s the best way to use this? Debian should always provide debian/patches/series
, they are supposed to provide the default set of patches to use. Any derivative cooperating with Debian can maintain their own series files within the common VCS repository used for package maintenance. They can drop Debian-specific patches (say branding patches for example), and they can add their own on top of the remaining Debian patches.
It’s worth noting that it’s the job of the maintainers to keep both series files in sync when needed. dpkg-source offers no way to have stacked series files (or dependencies between them).
If you want to use quilt
to edit an alternate series file, you can temporarily set the QUILT_SERIES
environment variable to “vendor.series”. Just make sure to start from a clean state, i.e. no patches applied. Otherwise quilt
will be confused by the sudden mismatch between the series file and its internal data (stored in the .pc directory).
Found it useful? Click here to see how you can encourage me to provide more articles like this one.
Alessio Treglia says
Ehy man,
I’ve found this very very useful!
Big ‘thank you’ from me.