UploadingToPPA

Before you begin

This explains how to build a debian package source and upload it to a PPA (Personal Package Archive) at http://launchpad.net. You will need to have your basic development tools set up, so if you haven't already, check out UbuntuStudio/SetupDeveloperEnvironment.

̈́A debian package source is basically what you get when you do the command: apt-get source <package>. If you want to know more about building debian packages first, check out the page about Packaging.

Setting Up the Package for Upload

You will only be able to upload packages to a PPA that you have built and signed yourself. There's no real point in uploading packages that have no changes in them, except if you are planning on making a package avilable to another release than what the package is packaged for.

In either case, you will at least need to edit the changelog, in order to make a new version of the package and also explain what you have changed in the package, and then build it.

In this example, I will be using a simple package - rt-tests. A new version was packaged for Ubuntu 13.04 in Dec, so let's make it avilable for Ubuntu 12.04.

Getting the Source

There are a number of ways to get a package source. From the Ubuntu repositories, or any other Debian based repository, from bzr branches at launchpad, or Debian git repositories to name a few. In this case we will use the script pull-lp-source, which is a part of the package ubuntu-dev-tools.

To get the raring package for rt-tests, do:

$ pull-lp-source rt-tests raring

What happens is that it downloads three files:

$ ls ./
rt-tests_0.85-0ubuntu1.debian.tar.gz  
rt-tests_0.85-0ubuntu1.dsc  
rt-tests_0.85.orig.tar.gz

And as the information in the terminal window tells you, the tar files are unpacked. One is the original upstream source, which includes the actual code, and the other is the debian folder, which includes all the debian packaging details. Lastly, patches are applied, if any existed.

rt-tests_0.85-0ubuntu1.dsc is a Debian Source Control file, which is a signed description of the package.

The orig source

Using a different method to get the source might result in no .orig tar file. Having one is good, since it means you won't need to upload it - only the resulting diff from the changes you have made.

If you don't have the .orig source file, one will be automatically created during the build, and consequently uploaded to the PPA. This is generally something you want to avoid, so if you for instance are using a bzr branch, you can get the orig source by doing:

$ bzr get-orig-source

You can also use the pull-lp-source script to only download, not extract, like so:

$ pull-lp-source -d rt-tests raring

You can also just download it separately, from wherever you can find it. Naturally, the orig package must match the source package you are working with.

Dependencies

If the package for a specific release requires newer versions of dependencies, you will need to upload the dependencies first, before the package can be built. It doesn't matter in which order you upload the packages. The build of a package might initially fail, but Launchpad will redo the builds when the dependencies have been satisfied.

In this case, rt-tests only has three dependencies, and Ubuntu 12.04 has the required versions for all of those, so I can just continue to edit the changelog.

Edit the Changelog

It is quite possible to edit the changelog manually entirely, but to make things easier, we use a tool called dch, which is a part of the package devscripts.

First, cd into the package folder, and then edit the changelog:

cd rt-tests-0.85
dch -i

This will edit the file debian/changelog. We use the option -i (increment), which automatically creates a new version for us. Each new upload must be a new version, signed by the uploader.

This is how the top part of the changelog looks initially:

rt-tests (0.85-0ubuntu2) UNRELEASED; urgency=low

  *

 -- Kaj Ailomaa <zequence@mousike.me>  Mon, 13 May 2013 01:29:10 +0200

What we need to do is add a description to what we have changed, and change the release UNRELEASED to precise, so that the package will be built for the correct release version. Once we are done, the top of the changelog will look like this:

rt-tests (0.85-0ubuntu2) precise; urgency=low

  * uploading to my PPA for precise            

 -- Kaj Ailomaa <zequence@mousike.me>  Mon, 13 May 2013 01:29:10 +0200

Changelogs are important, as you can find out from the changelog what was changed in the package, so make sure you always write what you have changed as correctly as you can. Commonly, each feature change is described separately.

Build the Package, And Sign It

Now that the source is ready to be built, two simple commands will build the source. First, we setup the source by cleaning it. And then, we use the script debuild, with options to only build the source (i.e. not build the binaries, as those will be built in the PPA), and sign it:

fakeroot debian/rules clean
debuild -S -sa

Resulting files from the build:

$ ls ../
rt-tests-0.85                                   
rt-tests_0.85-0ubuntu2.dsc           
rt-tests_0.85-0ubuntu2_source.changes
rt-tests_0.85-0ubuntu2.debian.tar.gz  
rt-tests_0.85-0ubuntu2_source.build

For the moment, the one that is interesting to us is the changes file, as it is what we use next, when uploading to PPA.

Upload to PPA

Now that the package is built, uploading to a PPA is as simple as doing:

dput ppa:<username>/<ppa-name> ../rt-tests_0.85-0ubuntu2_source.changes

Once you've uploaded, a new file will be created - rt-tests_0.85-0ubuntu2_source.ppa.upload. You will need to delete it in order to do a new upload of the same version of the package, if something went wrong, and you ned to redo it.

You will be notified by email if the upload was accepted or not. And, the package will be put in a build queue. It may take anywhere to a couple of minutes to a day before the package starts building.

UbuntuStudio/UploadingToPPA (last edited 2013-05-17 01:34:52 by h-4-180)