Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm looking for a tool to do the following:

  • Automatically detect updates to a set of source packages (specifically gtk+2 and gtk+3)
  • download the source package
  • apply my own custom patches to the source
  • commit the patch properly (dpkg-source --commit [something-or-other]?)
  • if successful upload them to a PPA on Launchpad (which I can then point my system to in the usual way).

Can Launchpad do all of that for me?

If not, is there a tool that will automatically do all of that from a cron job?

Failing the above, I'll knock something together myself, but what commands do I need to:

  • detect and download the source package updates? (I'd prefer something like (bzr|git) pull rather than having to apt-get source a brand new copy each time)
  • auto-commit the patch locally (I'd use the same commit description each time)?
  • upload the sources non-interactively to a PPA?

I've found a question ( What is the proper way to patch Wine for a custom PPA? ), which is similar but the steps in the answer are still basically manual and interactive. A completely hands-off version of that plus automatic detection of source updates would help a lot.

share|improve this question

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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