Packaging/PPA/BuildingASourcePackage

Not logged in - Log In / Register

Revision 20 as of 2011-11-28 18:49:44

Clear message

Launchpad Help > Packaging > PPAs > Building a PPA source package

Building a source package

Ubuntu uses Debian's system of packaging software. To get software into a PPA, you need to build a source package. That includes the source code for the software you want to distribute, along with the instructions for where the application should live in the file system and of any dependencies it has on other software.

Note: If you're already familiar with building .deb source packages for Ubuntu, you can skip straight to the Versioning section.

You can learn how to create .deb packages for Ubuntu by following the Ubuntu packaging guide.

There are a couple of aspects of PPAs that work slightly differently to standard Ubuntu packages: versioning and dependencies. You should also ensure that the email address and GPG key you use with dput are the same as those associated with your Launchpad account.

Versioning

Ubuntu package names are suffixed by the version number of the package. This allows Ubuntu to distinguish newer packages from older ones and so remain up to date.

If you're creating an alternative version of a package already available in Ubuntu's repositories, you should ensure that:

To do this, add the suffix ppan (where n is your package's revision number). Two examples:

Version numbers must be unique. This has implications if you want to provide packages for multiple Ubuntu series at once:

If your package can be used on different versions of Ubuntu without being recompiled then use the naming scheme already described. When you have successfully uploaded your package to your PPA you can copy the existing binaries to the new series; see Copying packages.

If your package does need to be recompiled to support multiple Ubuntu series, then you should add a suffix of a tilde and the series name to the version number. So a package for the Intrepid Ibex could be named myapp_1.0-1ubuntu3ppa1~intrepid1 and for the Hardy Heron myapp_1.0-1ubuntu3ppa1~hardy1. If you need to release an updated package, increment the ppan suffix. It is important to note that specifying the version name here doesn't change the series that you are targetting; this must still be set correctly as described in the Ubuntu packaging guide's section on the changelog file.

Snapshots

Often you want to offer intermediate releases as snapshots in a separate snapshot PPA so you can get early feedback from users or test the integration into different Ubuntu series. You must create a separate snapshot PPA for this purpose. This is a normal PPA which you are using for snapshots. You should not use your normal release PPA for snapshots. User which do not want to install snapshots would receive an automatic update otherwise.

For naming a snapshot you must assure that the final release version will supersede the snapshot version and that any new snapshot version supersedes a previous snapshot version.

To achieve the first requirement you cannot name the snapshot version like the final release version. You must use a lower version number. E.g. if your target release version is myapp_1.0-0ubuntu1~maverick (no Debian version exists (0) and this is the first version (ubuntu1) in Ubuntu Maverick (~maverick)) you should use the version myapp_1.0-0ubuntu0+1~maverick because 0ubuntu0+1 is lower than 0ubuntu1.

To guarantee that each snapshot version supersedes a previous version you should attach a -SNAPSHOT-<date> qualifier.

To sum up a complete snapshot versioning example would look like:

myapp_1.0-0ubuntu0+1-SNAPSHOT-2010-07-05-22-05-57+0200~maverick

In a bash script you can calculate the current snapshot date part with date +%F-%0k-%0M-%0S%z.

Dependencies

Launchpad satisfies your package's Build-Depends using:

Note: If you're already familiar with uploading to the Ubuntu primary archive, you should note that PPA builds do not have any build dependency restrictions, unlike a build in the primary Ubuntu archive. If you want to build the same package in the primary Ubuntu archive at a later point you may need to revise the package's component and/or pocket.

Depending on other PPAs

If you want Launchpad to satisfy your package dependencies using one or more other PPAs, follow the Edit dependencies link on your PPA or the team's overview page.

Options when building

See the Ubuntu packaging guide's section on building source packages.

How you build your package depends on whether you're creating a brand new package or you're creating a derivative of a package that's already in Ubuntu's primary archive.

If you're creating an alternative version of a package that's already in Ubuntu's primary archive, you don't need to upload the .orig.tar.gz file, i.e. the original source.

So, the debuild options you'd use are:

Note: If you get the error clearsign failed: secret key not available when signing the changes file, use an additional option -k[key_id] when calling debuild. Use gpg --list-secret-keys to get the key ID. Look for a line like "sec 12345/12ABCDEF"; the part after the slash is the key ID.

Next steps

Now that you have a source package, you need to upload it!

< Installing software from a PPA

Uploading a source package to a PPA >