Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in menu_set_active_trail() (line 2404 of /usr/share/drupal7/includes/menu.inc).

Backport an Ubuntu package in 5 minutes.

Packaging software might sound scary, but backporting Ubuntu package is actually easy.
When you need some features or bugfix in a newer version of software, which exists in latest Ubuntu release, but need it to be running in your older release of Ubuntu, what you need to do is to port the software from latest Ubuntu to the version you want. And in this HowTo I'll guide you through.

  1. Install tools: sudo apt install ubuntu-dev-tools
  2. Set developer (YOU) info: export UBUMAIL="Your Name <[email protected]>"
  3. Use tool to backport backportpackage -w . the-package-name

The Story

In the LSA class I lecture in NCNU, some students have issue with one of their homeworks.

To simulate a complex web system setup, configure Nginx, Lighttpd and Apache, with a combination of Name/IP/Port-based Virtual Host and multiple layer proxy, to serve different content in different condition.

They got stuck in configuring nginx -> lighttpd -> http://lsa.bluet.org due to the following mod_proxy support issue with the default Lighttpd version (1.4.45) on Ubuntu 18.04 (Bionic).

Hostnames are not allowed there before lighttpd 1.4.46.

One of the solutions is to use IP instead of fqdn, but as fqdn is easier to remember, and, Lighttpd 1.4.55 with fqdn support is right there in Ubuntu 20.04 (Focal) default package pool, we can backport it to Ubuntu 18.04 (Bionic).

Prerequirements

With the help from others, we build it, and share with others. Here we'll use PPA to host and share the backport version lighttpd package with anyone who has similar needs.

If you are an experienced Ubuntu user, you might already have most of these steps done in the past. But just in case there's anything missing, please check all the items below again.

  1. Install tools. sudo apt install gnupg pbuilder ubuntu-dev-tools apt-file
  2. Have your GPG Key ready. Please use your real name in English and real email. I'd also recommend using the same email when you register Launchpad account later. gpg --gen-key gpg --send-keys --keyserver keyserver.ubuntu.com <KEY ID>
  3. Have your SSH Key ready. ssh-keygen -t rsa
  4. Register a Launchpad account, setup your GPG Key Fingerprint, upload your SSH Public Key, and create your first PPA on your profile page.

More details can be found in the complete setup guide.

Steps

  1. Create a working folder. mkdir -p ~/workspace/packaging/lighttpd && cd ~/workspace/packaging/lighttpd
  2. Configure name and email address. If your name is Bob Dobbs and your email is [email protected], then the commands are: export DEBFULLNAME="Bob Dobbs" export DEBEMAIL="[email protected]" Optionally, you can also use the alternative way to indicate your identity. export UBUMAIL="Your Name <[email protected]>"
  3. Prepare base files for building deb. sudo pbuilder create
  4. Use Ubuntu's backportpackage tool to do all the liftings for you. backportpackage -d bionic -b -U -u ppa:bluet/lighttpd -w . lighttpd It will build a special version of the package for PPA, upload it for you, and generate .deb files in buildresult for you to install locally. You might see something like the following messages and after that, you'll see output files in your folder.

    Downloading lighttpd_... gpgv:... dpkg-source:... ... Successfully signed dsc, buildinfo, changes files Uploading ... Successfully uploaded packages.

Optional: Manual upload

Upload your package to PPA with the command. dput ppa:bluet/lighttpd lighttpd_1.4.55-1ubuntu2~ubuntu18.04.1_source.changes

For me the PPA is here https://launchpad.net/~bluet/+archive/ubuntu/lighttpd.
Note that packages might take some time before appearing on your PPA page.1

Optional: Package for -backport

If you want to package for -backport and go through the community review, Ubuntu's backportpackage tool can still do all the liftings for you. backportpackage -w . lighttpd You might see something like the following messages and after that, you'll see output files in your folder.

`Downloading lighttpd_...  
gpgv:...  
dpkg-source:...  
...  
Successfully signed dsc, buildinfo, changes files`

Optional: Build .deb locally

  1. Install tools sudo apt install dpkg-dev devscripts debhelper
  2. Extract source tree. This will create a new folder lighttpd-1.4.55/ tar xJvf lighttpd_1.4.55.orig.tar.xz Also extract the following two files, which will create debian/ folder. Please move the folder into lighttpd-1.4.55/ folder. tar xJvf lighttpd_1.4.55-1ubuntu2.debian.tar.xz tar xJvf lighttpd_1.4.55-1ubuntu2~ubuntu18.04.1.debian.tar.xz mv ./debian/ ./lighttpd-1.4.55/ cd lighttpd-1.4.55/
  3. Prepare environment for build. pbuilder-dist bionic create
  4. Build package and install. debuild -S -d -us -uc pbuilder-dist <release> build ../<package>_<version>.dsc dpkg -I ~/pbuilder/*_result/<package>_*.deb

References

Ubuntu Packaging Guide

Add new comment