Update and warning: My bzr diff was not accepted. It turns out this particular package doesn't accept that format. Apparently different packages within Ubuntu require different types of patches, and there's no good way to find out besides submitting one type of patch and seeing if it's rejected or ignored. In the end, I did get a patch accepted, and will write up separately how that patch was generated.
The process of submitting bugs and patches to Ubuntu can be deeply frustrating. Even if you figure out how to fix a bug and attach a patch, the patch can sit in Launchpad for years with no attention, as this ubuntu-devel-discuss thread attests.
The problem is that there are a lot of bugs and not enough people qualified to review patches and check them in. To make things easier for the packagers, sometimes people are told to "make a debdiff" or "make a ppa". But it's tough to find good instructions on how to do these things. There are partial instructions at Contributing and on the Packaging Guide -- but both pages are aimed at people who want to become regular packagers of new apps, not someone who just has one patch for a specific bug, and they're both missing crucial steps. Apparently there's a new and better packaging guide being written, but it's not publically available yet.
These days, Bazaar (bzr), not debdiff, is considered the best way to make a patch easy for Ubuntu developers to review. With a lot of help from #ubuntu-women, and particularly Maco (THANKS!), I worked through the steps to submit a patch I'd posted to bug 370735 two years ago for gmemusage. Here's what I needed to do.
Set up the tools
First, install some build tools you'll need, if you don't already have them:
sudo apt-get install bzr bzr-builddeb pbuilder
You will also need a Launchpad account:
bzr whoami "Firstname Lastname <email@example.com>" bzr launchpad-login your-acct
Check out the code
Create a directory where you'll do the work:
mkdir pkgname cd pkgname
Check out the source from bzr:
bzr branch lp:ubuntu/pkgname pkgname
Make a bzr branch for your fixes. It's probably a good idea to include the bug number or other specifics in the branch name:
bzr branch pkgname pkgname-fix-bugnum cd pkgname-fix-bugnum
Now you can apply the patch, e.g.
or edit source files directly.
Make a package you can test
Making a package from a bzr directory requires several steps.
Making a source package is easy:
bzr bd -S -- -uc -usThis will show up as ../pkgname_version.dsc.
But if you want something you can install and test, you need a binary package. That's quite a bit more trouble to generate. You'll be using pbuilder to create a minimal install of Ubuntu in a chroot environment, so the build isn't polluted by any local changes you have on your own machine.
First create the chroot: this takes a while, maybe 10 minutes or so, or a lot longer if you have a slow network connection. You'll also need some disk space: on my machine it used 168M in /var/cache (plus more for the next step). Since it uses /var/cache, it needs sudo to write there:
sudo pbuilder --create natty
Now build a .deb binary package from your .dsc source package:
sudo pbuilder --build ../pkgname_version.dscpbuilder will install a bunch of additional packages, like X and other libraries that are needed to build your package but weren't included in the minimal pbuilder setup.
And then once it's done with the build, it removes them all again. Apparently there's a way to make it cache them so you'll have them if you need to build again, but I'm not sure how.
pbuilder --build gives lots of output, but none of that
output tells you where it's actually creating the .deb.
Look in /var/cache/pbuilder/result for it.
And now you can finally try installing it:
sudo dpkg -i /var/cache/pbuilder/result/pkgname_blahblah.deb
You can now test your fix, and make sure you fixed the problem and didn't break anything else.
Check in your bzr branch
Once you're confident your fix is good. it's time to check it in.
Make a new changelog entry:
dch -iThis will open your editor of choice, where you should explain briefly what you changed and why. If it's a fix for a Launchpad bug, list the bug number like this:
If you're proposing a fix for an Ubuntu that's already released, you also need to add -proposed to the release name in the top line in the changelog, e.g.:
pkgname (0.2-11ubuntu1) natty-proposed; urgency=low
Also, pay attention to that ubuntu1 part of the version string if the entry prior to yours doesn't include "ubuntu" in the version. If you're proposing a change to a stable release, change that to ubuntu0.1; if it's for the current development release, it's okay to leave it at ubuntu1 (more details on this Packaging page).
Finally, you can check it in to your local repository:
debcommitand push it to Launchpad:
bzr push lp:~yourname/ubuntu/natty/pkgname/pkgname-fix-bugnum
Notify possible sponsors
You'll want to make sure your patch gets on the sponsorship queue, so someone can review it and check in the fix.
bzr lp-open(For me, this opened chromium even though firefox is my preferred browser. To use Firefox, I had to:
sudo update-alternatives --config x-www-browserfirst. Boo chromium for making itself default without asking me.)
You should now have a launchpad page open in your browser. Click on "Propose for merging into another branch" and include a description of your change and why it should be merged. This, I'm told, notifies potential sponsors who can review your patch and approve it for check-in.
Whew! That's a lot of steps. You could argue that it's harder to prepare a patch for Ubuntu than it was to fix the bug in the first place. Stay tuned ... I'll let you know when and if my patch actually gets approved.
[ 14:38 May 16, 2011 More linux | permalink to this entry | comments ]