Skip to content
gijzelaerr edited this page Oct 29, 2014 · 2 revisions

How to make a new Package

Introduction

This is a way too short guide for creating debian source packages. Debian source packages are a set of files, consisting a the original source package tarball and a set of debian files which contain metainformation on how to compile and patch the source tarball to get it compiling on a fresh Ubuntu system resulting in a binary Debian package. This source package is then uploaded to the Launchpad PPA build farm, where it is build. If the build is succesful it will be published on a public apt repository.

Preparations

Location

Best is to have designated system and location somewhere, for example build in your homefolder.

PGP key and launchpad

To upload a package to the Launchpad PPA you need a PGP key and register that on launchpad. You only need to do this once.

Follow these steps:

install required packaging tools

   $ sudo apt-get install git devscripts dput

Note about isolated environment

When creating a package it is important to get the build dependencies right. If a software package requires for example boost and this package is installed while it is not listed as a requirement (in debian/control), the package will build find on your local system but not an a clean system and on the launchpad PPA build farm. best is to create packages on a clean Ubuntu system, virtual machine, chroot or even better but more advanced, using pbuilder. Check notes below about pbuilder.

Release

If the software you want to package is maintained by yourself or your team and it is unreleased, you first need to make a release. If not just download the tarball to your build folder.

Make sure that:

  • You Cleaned up the source tree
  • make sure it is compiling. Maybe you should use travis-ci to automatically check this?
  • Make sure all version strings are set correctly
  • Make sure no debian package files are included in the source tree, we will add them later to the release tarball.

To make a release on the SKA-SA corporate github account:

Now download the tarball to your build folder.

making the package

to build and upload a package:

  • download the tarball to your build folder, which is named TAG.tar.gz, e.g. v1.3.3.tar.gz

  • rename the tarball to PACKAGE_VERSION.orig.tar.gz e.g. meqtrees-cattery_1.3.3.orig.tar.gz

  • extract the tarball (subdirectory will be named PACKAGE-VERSION)

  • get the debian package files. If they don't exist yet create a new github repository and copy the files from one of the other packaging repositories, change accordingly:

   $ cd PACKAGE-VERSION
   $ git clone git@github.com:ska-sa/PACKAGE-debian debian  # PACKAGE is e.g. meqtrees-cattery
  • make sure you are in the right branch. Idea is that every Ubuntu/Debian release has it own branch in the repo. At the moment only trusty (14.04) is used
   $ cd debian
   $ git checkout trusty
  • increase the debian version number:
   $ cd .. # now back in the PACKAGE-VERSION folder
   $ dch  -i

You can also manually update debian/changelog. Make sure the email address is your valid PPA maintainer address and if the Ubuntu release is correct. Version number should be <version>-<packageversion><ubunturelease> for example 1.3.0-1trusty (NB: packageversion is always "1" for now).

I.e. each new source release starts at "x.y.z-1trusty", then goes to "x.y.z-2trusty" if a new debian package is released. (NB: we add the ubuntu release specific version to the package version, otherwise launchpad won't accept the package. You can't upload the same package version combination for multiple releases.)

Typical changelog message is "new upstream release".

  • check if the package is building:
   $ dpkg-buildpackage
  • fix problems -- patches under ./debian may need fiddling with if the upstream package has changed considerably. Running dpkg-source --commit will generate new patch files under ./debian based on any changes made to the source tree.

  • commit changes to PACKAGE-debian to the repository (as a minimum, this is the new version number). Might need to git add any new patch files generated at the previous step:

   $ pushd debian && git commit -a && git push && popd

Typical commit message is "new upstream release".

  • make a signed source package:
   $ debuild -S -sa
  • upload the package:
   $ dput ppa:ska-sa/main ../PACKAGE_VERSION_source.changes

If all goes well you'll receive an email from launchpad that the new package has been accepted. Then, go to https://launchpad.net/~ska-sa/+archive/main/+packages to check the package build status.

more reading