Rebuilding a Debian package for another release

Over at Ideascube we want to start using Cockpit for various appliance maintenance tasks.

Warning

Feel free to use our packages, but don't expect anything. I built it to enable us to start playing with Cockpit, but we might never upgrade these packages, or we could as well remove them.

The idea germed last year when I met Stef Walter at GUADEC in Karlsruhe, where he walked me through Cockpit and what we could do with it. Unfortunately, we've had to set this project aside due to other priorities.

One thing we were missing though, was a Cockpit package for Debian Jessie. This is the OS we use in our deployments, and as such we would need an easy way to install Cockpit there.

Fortunately, since then Martin Pitt pushed Cockpit to Debian Sid, so I could just rebuild his package for Jessie.

This article explains how I did it, because this was my first time (although I've done it countless times for Fedora packages) and I'm sure I will forget, so this will serve me as a useful reminder in the future.

I have to thank Didier Roche who explained this stuff to me.


First, download the source package, extract it, and get into the extracted tree:

$ dget -x http://http.debian.net/debian/pool/main/c/cockpit/cockpit_142-1.dsc
$ cd cockpit-142/

Next, edit the debian/changelog file to add a new build with its own version and for the right Debian release. I added the following:

cockpit (142-1~jessie1) jessie; urgency=medium

  * Rebuild the Sid package for Jessie

 -- Mathieu Bridon <bochecha@daitauha.fr>  Thu, 15 Jun 2017 15:15:00 +0200

I used this version because dpkg will consider that 142-1~jessie1 is a lower version than 142-1. As such, if we ever upgraded our machines from Jessie to Sid, then apt would naturally "upgrade" to the official Debian package.

At this point, I could just build the package:

$ sbuild --verbose --arch=amd64

This worked because I ran this on a machine which already had sbuild configured with the right set of schroots: the server we normally use to build Ideascube packages for Debian Jessie.

Finally, I added the package to our repository:

$ dput local ../cockpit_142-1~jessie1_amd64.changes

And that's it, we now have Cockpit packages for Debian Jessie in our repository.

Now to do the same thing for ARM, so we can have Cockpit on the Koombooks...