Dear diary,

Today I've spent most of my day trying to bring zsh 4.3.12 into a debian package. At first I thought "Well, we've prepared this pretty nicely. So, it'll take about 20 minutes. Tops. So, let's get crackin'!"

Four hours later, I was ready for vacation.

Actually, most of our preparations did work out quite well. But we've got this helper utility in our workflow, which decided it didn't want to play along. At all. That program is `git-dch' from `git-buildpackage'. It generates debian/changelog updates from git history.

It seems though, that it doesn't like it if the history it is looking at isn't linear. And with pkg-zsh, we are merging defined points from upstream into our packaging branch. So there's our non-linearity.

Our history basically looks like this:

*    at2quilt: Updating autotools patches
M    Merge commit 'zsh-4.3.12' into debian
|`*  unposted: released 4.3.12
| *  ...
| *  ... lots of other upstream commits ...
| *  ...
* |  Removing upstream patches due to new release
* |  Last debian/4.3.11-* commit
* |  ...
* |  ... lot's of other debian/4.3.11-* commits
* |  ...
M´   Merge commit 'zsh-4.3.11' into debian
|`*  unposted: released 4.3.11
...  older history

There's "Removing upstream patches due to new release" which does exactly what it sounds like: It removes all patches from debian/patches/ that are not included upstream. That is useful to do before merging the upstream changes because otherwise there would be one commit that wouldn't built the package (because applying the already applied patches would fail).

Then there is the merge of the zsh-4.3.12 tag which pulls all upstream changes up to the new release into our packaging branch.

Next is the "at2quilt: Updating autotools patches" commit which was created by using debian/at2quilt to generate a set of quilt patches that create all GNU autotools files (think: `configure') needed for building.

Now to make life easier for `git-dch', I've created a simple script that creates a new-version changelog entry for a given number of commits. I just tell it which package I'm working on, which version and finally I give it a list of commit-sha1-sums:

% ./debian/urcl -p=zsh -v=4.3.12-1 b495ba1e5 f575f568e0dc

I would commit that changelog change, by prefixing the commit message's first line with "[dch-ignore]" (I'll get back to that later). With this commit, we get back to a linear sub-history which is great for `git-dch', so it can do the heavier changelog-generating work. We just need to tell it --since=.

There is also a bug that get's closed just by using this new upstream release, so I added another changelog line manually:

* New upstream release (Closes: #627046)

Again, I prefixed the commit message by "[dch-ignore]".

I worked on the package a little more, created some commits... and finally came to the point were I was happy and I wanted to generate the changelog for the release by using `git-dch'. For that task I - again - wrote a little helper script for convenience. It knows all the options we want for propper formating and it takes care of weeding out commit lines that are prefixed by "[dch-ignore]".

I spent all day writing these helpers and updating documentation. It was a bit painful, so here's a listing of the crucial steps in getting out a new debian zsh package when upstream did a new release:

% ...remove all upstream included patches from debian/patches/
% ...and debian/patches/series, too.
% git commit -m'Removing upstream patches due to new release'

% ./debian/at2quilt
% git commit -a -m'at2quilt: Updating autotools patches'

% ./debian/urcl -p=zsh -v=4.3.12-1 b495ba1e5 f575f568e0dc
% git commit -a -m'[dch-ignore] changelog: urcl update

% ...add new upstream release line to debian/changelog...
% git commit -a -m'[dch-ignore] changelog: Closes due to new release

% ...hack
% ...hack
% ...hack and - oh yeah - commit

% ./debian/do-dch --since='f575f568e0dcad68a' -R

% git commit -a -m'Release new version 4.3.12-1'
% git tag -m'Debian version 4.3.12-1' -s debian/4.3.12-1

% git-buildpackage -us -uc --git-debian-branch=debian --git-upstream-branch=zsh-4.3.12

That's it.

Oh, and when I can finally push to alioth again, there might be packages soon. For now the code is at

Posted Thu 02 Jun 2011 18:20:35 CEST Tags: