Diff for "Packaging/PPA/BuildingASourcePackage"

Not logged in - Log In / Register

Differences between revisions 1 and 26 (spanning 25 versions)
Revision 1 as of 2009-07-29 16:56:01
Size: 5348
Editor: 92-237-59-186
Comment:
Revision 26 as of 2018-11-16 10:01:30
Size: 6897
Editor: cjwatson
Comment: be more specific about the upload-and-copy workflow
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
'''DRAFT: this page is a work in progress. Please [[Feedback|seek further help]] or check the [[TitleIndex|wiki index]] for a complete page on this topic.''' ~- [[FrontPage|Launchpad Help]] > [[Packaging]] > [[PPA|PPAs]] > Building a PPA source package -~
Line 7: Line 7:
Let's take a look at the basics of getting your software into a PPA. 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.
Line 9: Line 9:
'''Note:''' If you're already familiar with building .deb source packages, you can skip straight to the ''[[#versioning|Versioning]]'' section. '''Note:''' If you're already familiar with building .deb source packages for Ubuntu, you can skip straight to the ''[[#versioning|Versioning]]'' section.
Line 11: Line 11:
Ubuntu using Debian's system of packaging software. You can learn how to create .deb packages for Ubuntu by following the [[http://packaging.ubuntu.com/html/|Ubuntu packaging guide]].
Line 13: Line 13:
Before you start using your PPA to distribute software, you need to be familiar with building .deb source packages for Ubuntu. The best place to learn how to package for Ubuntu is the [[https://wiki.ubuntu.com/PackagingGuide|Ubuntu packaging guide]].

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.

There are a couple of aspects of PPAs that work slightly differently to standard Ubuntu packages: '''versioning''' and '''dependencies'''.

Let's take a look at each in detail.
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.
Line 31: Line 25:
To do this, increase the Ubuntu version number and add a suffix of ~ppa''n'' (where ''n'' is your package's revision number). To do this, add the suffix ppa''n'' (where ''n'' is your package's revision number).  Two examples:
Line 33: Line 27:
For example: you're creating an experimental version of the ``myapp_1.0-1`` package. Your PPA package would be named ``myapp_1.0-2~ppa1``.

Here, the tilde knocks the precedence of the package down to below whatever is in front of it. So, for now, this package counts as being a higher version number than ``myapp_1.0-1`` but when Ubuntu releases ``myapp_1.0-2`` that will supersede your PPA version.
 * Ubuntu package ``myapp_1.0-1`` → PPA package ``myapp_1.0-1ppa1``
 * Ubuntu package ``myapp_1.0-1ubuntu3`` → PPA package ``myapp_1.0-1ubuntu3ppa1``
Line 39: Line 32:
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 [[Packaging/PPA#copyingpackages|Copying packages]] below. If your package can be used on different versions of Ubuntu ''without being recompiled'' then use the naming scheme already described, and start by uploading your package to the oldest series that you want to support. When you have successfully uploaded your package to your PPA you can copy the existing binaries to the new series; see [[Packaging/PPA/Copying|Copying packages]], and use the "Copy existing binaries" option.
Line 41: Line 34:
If your package does need to be recompiled to support multiple Ubuntu series, then you should add a suffix of the series name to the version number. So a package for the Intrepid Ibex could be named ``myapp_1.0-2~ppa1~intrepid1`` and for the Hardy Heron ``myapp_1.0-2~ppa1~hardy1``. If you need to release an updated package, increment the ~ppa''n'' 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 [[https://wiki.ubuntu.com/PackagingGuide/Basic#changelog|changelog file]]. 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 version to the version number. So a package for the Yakkety Yak (16.10) could be named ``myapp_1.0-1ubuntu3ppa1~ubuntu16.10.1`` and for the Xenial Xerus (16.04) ``myapp_1.0-1ubuntu3ppa1~ubuntu16.04.1``. If you need to release an updated package, increment the ppa''n'' 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 [[http://packaging.ubuntu.com/html/debian-dir-overview.html#the-changelog|changelog file]].

=== Snapshots ===

You need snapshots when

 * you want to release previews of your software for interested people
 * you want to have a separation between stable code and code in development
 * released versions cannot be uploaded twice so version numbers are increasing too quickly
 * you want to test your uploads and do not want to clutter your stable versions PPA

For this purpose you must create a PPA dedicated for snapshots. You and interested user can add this PPA to their update repositories.

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 do this you cannot name the snapshot version like the final release version. You must use a ''lower'' version number. Debian/Ubuntu versions are sorted by their ASCII code.
Because a snapshot is always heading to the next version use the pattern `<current>+<next>` at the place where the version number will change, e.g. when moving from `1.0` to `1.1` use `1.0+1`. You cannot use `1.1` directly because the release version number will not supersede the snapshot version number in this case.
To guarantee that each snapshot version supersedes a previous snapshot version you should also attach a `SNAPSHOT<date>` qualifier.

To sum up a complete snapshot version number example would look like:

`myapp_1.0+1SNAPSHOT20120613154859+0200-0ubuntu1ppa1~precise`
Line 48: Line 60:
 * all sections of the primary Ubuntu archive - i.e. main, restricted, universe and multiverse  * all sections of the primary Ubuntu archive -- i.e. main, restricted, universe and multiverse
Line 57: Line 69:
== Building ==

''See the Ubuntu packaging guide's section on [[https://wiki.ubuntu.com/PackagingGuide/Basic#Building%20the%20Source%20Package|building source packages]].''
= Options when building =
Line 70: Line 79:
'''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-keys``` to get the key ID. Look for a line like "```pub 12345/12ABCDEF```"; the part after the slash is the key ID. '''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 [[Packaging/PPA/Uploading|upload it]]!

||<tablestyle="border: 0; width: 100%;"> ~-[[Packaging/PPA/InstallingSoftware|< Installing software from a PPA]] -~ ||<style="text-align: right;"> ~-[[Packaging/PPA/Uploading|Uploading a source package to a PPA >]] -~||

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:

  • your package supersedes the official Ubuntu version
  • future Ubuntu versions will supersede your package.

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

  • Ubuntu package myapp_1.0-1 → PPA package myapp_1.0-1ppa1

  • Ubuntu package myapp_1.0-1ubuntu3 → PPA package myapp_1.0-1ubuntu3ppa1

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, and start by uploading your package to the oldest series that you want to support. When you have successfully uploaded your package to your PPA you can copy the existing binaries to the new series; see Copying packages, and use the "Copy existing binaries" option.

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 version to the version number. So a package for the Yakkety Yak (16.10) could be named myapp_1.0-1ubuntu3ppa1~ubuntu16.10.1 and for the Xenial Xerus (16.04) myapp_1.0-1ubuntu3ppa1~ubuntu16.04.1. 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

You need snapshots when

  • you want to release previews of your software for interested people
  • you want to have a separation between stable code and code in development
  • released versions cannot be uploaded twice so version numbers are increasing too quickly
  • you want to test your uploads and do not want to clutter your stable versions PPA

For this purpose you must create a PPA dedicated for snapshots. You and interested user can add this PPA to their update repositories.

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 do this you cannot name the snapshot version like the final release version. You must use a lower version number. Debian/Ubuntu versions are sorted by their ASCII code. Because a snapshot is always heading to the next version use the pattern <current>+<next> at the place where the version number will change, e.g. when moving from 1.0 to 1.1 use 1.0+1. You cannot use 1.1 directly because the release version number will not supersede the snapshot version number in this case. To guarantee that each snapshot version supersedes a previous snapshot version you should also attach a SNAPSHOT<date> qualifier.

To sum up a complete snapshot version number example would look like:

myapp_1.0+1SNAPSHOT20120613154859+0200-0ubuntu1ppa1~precise

Dependencies

Launchpad satisfies your package's Build-Depends using:

  • the most recent versions of the packages in the PPA you're uploading to
  • all sections of the primary Ubuntu archive -- i.e. main, restricted, universe and multiverse
  • optionally: other PPAs in Launchpad.

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

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:

  • alternative version of an existing package (will be uploaded without the .orig.tar.gz file): debuild -S -sd

  • brand new package with no existing version in Ubuntu's repositories (will be uploaded with the .orig.tar.gz file): debuild -S -sa

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 >

Packaging/PPA/BuildingASourcePackage (last edited 2020-10-02 12:55:39 by cjwatson)