Welcome to the second session on packaging!

This session will continue on the adventures of packaging: Ubuntu Packaging for Launchpad PPAs (Packaging: Part 2)

This session requires far less steps than the first session which covered the entire creation of a standalone .deb

However, all the packaging requirements for the first session still apply, as does the dh_makecommand.

The key difference between creating a standalone .deb and uploading to a PPA are that you do not upload a standalone Debian file to the PPA.

You will be creating a source package which will be uploaded to the PPA

You will require one additional package: dput

Please install it now.

After you have installed the package dput, you will need to create its config file for the user if you wish to use SFTP or SSH-tunneled uploading. For 9.10 and later, you can use a different method.

You will also need to create a PPA on Launchpad.

In order to do this, you will need to have imported your PGP key that you created earlier into Launchpad

Open up seahorse and open up the properties of the PGP key you created.

On the “Details” tab, you will see text titled “Fingerprint”

You will need all the text under that area when you import the key into launchpad.,

In Launchpad, open up your user information page (after you’ve logged in).

If you do not have a launchpad account, you will need to create one.

On your user info page, there is a section called “OpenPGP Keys”. Click the yellow pencil icon next to that field.

You will need to import a PGP key, which is where the fingerprint you just found is needed.

Copy and paste the entire fingerprint into the “Import a PGP Key” box on the Launchpad page.

then click “import”

You will need to check the email address you have registered for Launchpad for further instructions on finishing the import

On the email you get, it will have sent a PGP encrypted message using your key.

You will need to decrypt that message.

Go to the received email, and copy the text between the lines -----BEGIN PGP MESSAGE-----and -----END PGP MESSAGE-----

including those lines

Copy those lines into a text file.

You will be using the gpg --decrypt function from the command line to decrypt this text

Open the terminal and navigate to wherever you stored the text file with the encrypted message.

type gpg --decrypt ./filename, replacing filename with the name of the file

The content will be decrypted, and you will need to follow the instructions in the decrypted message in order to finish importing your PGP key.

After importing the PGP key, you will need to create a personal PPA for yourself on Launchpad

However, you may need to sign the Ubuntu Code of Conduct. Instructions for how to do this are on Launchpad’s site.

Use the passphrase you used when you created the key

After creating the PPA on Launchpad and accepted all terms of them, and also after importing the PGP key, we can continue.

I will wait for you to finish the imports of the PGP keys

Before I continue, I will briefly touch on a configuration you must do for dput

and I strongly recommend this.

Navigate to your home directory.

If there is not a .dput.cf file (and it would be hidden), please create it.

[my-ppa]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~<your_launchpad_id>/<ppa_name>/ubuntu/
login = anonymous
allow_unsigned_uploads = 0

This is an example, however this is how you would configure it.

You may leave the login as anonymous but its recommended you use your own launchpad ID in place of anonymous

This is an example of a dput block, which I have for my addgpg-apt project:

[addgpg-apt]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~addgpg-apt-developers/ppa
login = trekcaptainusa-tw
allow_unsigned_uploads = 0

After you have done this, and after you created the PPA on Launchpad, we are ready to continue.

We are now ready to build the source package

If you followed the instructions through the first session, the procedure is similar to building the standalone deb

with one exception

if you did not yet build the program into a .deb from the first session, please disregard this next step.

If you built the program from the first session into a .deb, do the following in the directory that held the folder you unzipped/downloaded: rm packaging-test_1.0-*

Navigate into the source directory for the Debian package (the folder that contains any programs or source, and also has debian in it)

Run this command: debuild -S

Several files will be generated in the directory that is the parent of the source directory.

Go to the parent directory.

If you created the .dput.cf file as I specified earlier, you will only need to use the text that was between the [ ] in this step.

Type the following: dput my-ppa packaging-test_1.0-1_source.changes

Then allow the program to run (NOTE: It may ask for your launchpad password so you can upload to the PPA)

This will then upload all required files to the PPA system.

Subsequently, the package will be queued for building on Launchpad.

You will receive an email at your launchpad registered email and it will tell you whether the upload was accepted or rejected.

if accepted, then it will queue it for building

if rejected, it will explain why.

That’s the basics of Packaging for Launchpad. Not entirely different from building standalone .deb installers.

Leave a comment