Is there an easy way to automatically patch ubuntu sources as they become available and upload to a PPA?
Solution 1:
Well, it sounds like packaging recipes are the way to go here. Basically, packaging recipes can automatically create Ubuntu source packages and upload them to a PPA whenever a bzr branch on Launchpad changes. The online documentation is pretty good, but I'll give a couple of examples...
First, you specify a branch to track (for example, lp:gtk3
) and then add a command to nest your own Debian packaging branch into that branch. Take a look at this recipe I created for daily builds of Inkscape.
# bzr-builder format 0.4 deb-version 1:0.48+devel+{revno}+{revno:packaging}
lp:inkscape
nest packaging lp:~inkscape.dev/inkscape/debian-packaging debian
This recipe creates an Ubuntu package each day using the latest upstream source for Inkscape, but copies customised Debian packaging instructions from the lp:~inkscape.dev/inkscape/debian-packaging
branch into a subfolder called "debian
".
The packaging recipe page on Launchpad allows you to specify which PPA to automatically upload your packages to. In our case, it is uploaded here.
As an alternative approach, you could base your recipe on an existing Ubuntu package rather than directly on the upstream source. For example, lp:ubuntu/gtk+3.0
. You'd then need to create a branch of this code, and commit any modifications you require. Let's call it lp:~myaccount/ubuntu/saucy/gtk+3.0/my-custom-build
, for example. You would then create a recipe to automatically merge your changes rather than nest packaging instructions. The recipe would look something like:
# bzr-builder format 0.4 deb-version {debversion}+{date}
lp:ubuntu/gtk+3.0
merge my-custom-build lp:~myaccount/ubuntu/saucy/gtk+3.0/my-custom-build
This recipe, therefore automatically builds a custom Ubuntu source package and uploads it to your PPA whenever there is a change in the official Ubuntu package.
If you take this "merge" approach, then you have two options for applying your patches. Either you'd just edit the upstream source code directly in your branch and let bzr take care of merging it, or you could create patch files inside the debian/
folder using quilt. Each has its own advantages/disadvantages. The former approach is a bit smarter... if one of your patches is adopted by the upstream developer, then the merge will usually still work and the Ubuntu package will build OK. The latter approach lets you handle your patches using the standard Debian-based approach of keeping packaging code separate from upstream code... however, if the upstream developer adopts one of your patches then quilt won't be able to apply the (duplicate) patch and the package will fail to build.