Software Development with Linux

Easy backporting of Ubuntu and Debian packages

WED, 01 DEC 2010

Often, you want (or need) to use a newer (or older) version of an application that is not available in the repositories of your Ubuntu or Debian version.  At that point, you can either build the application from source (risky and not managed by the packaging system), use a .deb created by someone else (you have to trust them), or try the .deb created for another .deb based distribution or version.  But an easier and less risky approach is to simply backport or repackage the required version for your distribution.  Here is how to do it.

Before we start, I recommend using a chrooted environment. This has many advantages, like ensuring no conflict with your "real" OS and allowing backport to a different distribution than the one you are running.  Read Creating a Debian or Ubuntu chroot for instructions on how to do it.

Now, to package the application (either in the chroot environment or where you want to work), we will follow the instructions from Building source and binary .deb, but with a small modification.  Between steps 4 and 5, we need to modify the file debian/changelog.  In there you need to add a section at the top, for the changes you are doing.  Since the change is only repackaging for another distribution, you should add something like this :
gdb (7.2-1ubuntu6) lucid; urgency=low

* Backport to lucid.

-- Laurent Parenteau <laurent.parenteau@gmail.com>
Fri, 17 Dec 2010 15:53:12 -0500
Your best bet is to copy the latest changelog entry, and simply change the distribution nickname (on the first line), the message itself, the author, and the date.

You can then continue with step 5.  During the build, you may be required to install some missing packages.  If the application you are repackaging is well done, you should have explicit messages about them.  Otherwise, you may have to search for the missing packages yourself.  Once everything is done, you can install the resulting binary package, and you're all set.

Isn't it easy?