Plexydesk Ubuntu Package building guide

Introduction

This guide will show you how you can easily build packages for PlexyDesk and upload them to your ppa. This article was created by updating and adapting the ubuntu PPA guide to fit the needs of PlexyDesk source package. If you would like to learn about generic packaging instructions on creating a PPA for your source package, it's recommended that you follow the original post linked at the end of this article.  

What are PPAs?

Using a Personal Package Archive (PPA), you can distribute software and updates directly to Ubuntu users, Create your source package and upload it. Launchpad will build binaries (.deb files) and host them on your own apt repository. Ubuntu users can then install your packages in the same way they install standard Ubuntu packages and they'll automatically receive updates as and when you make them. PPAs are part of Launchpad, and thus follow the Launchpad terms of use:

  • Software must be free according to Launchpad's licensing guidelines.
  • Each PPA gets 2 GB of disk space. If you need more space for a particular PPA, this can be arranged through Launchpad admins.
  • You need to sign the Ubuntu Code of Conduct. (Instructions below.)

As Launchpad has a limited amount of package build machines, the build queue can at times be clogged, so it might take longer until your packages are built, but normally you can expect built packages within an hour.

Setting up your GPG key.

Before you can publish to Launhpad.net you must first setup GPG on the build system. If you already have a GPG key you can import it to the build server, or you can create a new key and submit the new key to launchpad.net Once your user profile is set up you can continue with the tutorial. For the benefit of those who do not own a GPG key, follow the instructions to create and publish your first GPG key.

Before invoking the GPG command, install rag-tools, if your system doesn't have it already. This will help you collect the required entropy to finalize the key.
sudo apt-get install rng-tools
After installing the run the following command.
sudo rngd -r /dev/urandom
After it finishes invoke gpg binary to start the process of creating your GPG key.
gpg --gen-key

This command generates a pair of key that consists of a public and a private key. A series of prompts directs you through the process. Press the Enter key to assign a default value if desired. The first prompt asks you to select what kind of key you prefer:

Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection?

We will select Option (1) to generate both private and public keys.

In the next prompt select the key size. If you are happy with 2048, just press the enter key.
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)

Next Choose when the key will expire. It is a good idea to choose an expiration date instead of using the default, which is none. If, for example, the email address on the key becomes invalid, an expiration date will remind others to stop using that public key.

Please specify how long the key should be valid.
0 = key does not expire
d = key expires in n days
w = key expires in n weeks
m = key expires in n months
y = key expires in n years
key is valid for? (0)

Entering a value of 1y, for example, makes the key valid for one year. (You may change this expiration date after the key is generated, if you change your mind.)

Finally before finishing the process it will prompt you to confirm if all the details provided are correct.

Is this correct (y/N)?

Enter y to finish the process.

Preparing the source package for Submission

In this section we are going to build PlexyDesk version v1.0.3, To start we will clone the source code from github.com with the following command.

git clone https://github.com/plexydesk/plexydesk.git
Cloning into 'plexydesk'...
remote: Counting objects: 52492, done.
remote: Total 52492 (delta 0), reused 0 (delta 0), pack-reused 52492
Receiving objects: 100% (52492/52492), 82.07 MiB | 2.36 MiB/s, done.
Resolving deltas: 100% (35599/35599), done.
Checking connectivity... done.

Once the cloning finishes, pick the branch you want to build the package for. In our case it's branch v1.0.3

git checkout -t origin/v1.0.3
Branch origin/v1.0.3 set up to track local branch master.
PlexyDesk comes with a script which makes it easy for you to prepare the source code for Debian/Ubuntu, We will run the script to create the required changes automatically.
APP_NAME=plexydesk APP_VERSION=1.0.0 GPGKEY=F4BBC295 dist/make_dist_deb.sh 
This command will result in the following files in INSTALLERS/deb
-rw-r--r-- 1 shaheeqa shaheeqa     1814 Oct 15 13:46 plexydesk_1.0.0-3ubuntu4.dsc
-rw-r--r-- 1 shaheeqa shaheeqa     1912 Oct 15 13:46 plexydesk_1.0.0-3ubuntu4_source.changes
-rw-r--r-- 1 shaheeqa shaheeqa 14565142 Oct 15 13:46 plexydesk_1.0.0-3ubuntu4.tar.bz2
-rw-rw-r-- 1 shaheeqa shaheeqa 14566242 Oct 15 13:46 plexydesk_1.0.0.tar.bz2
Now we need to update the change log before submitting the packages.
dch -i
This will open the changelog with the required lines. This should look something like the following
plexydesk (1.0.0-2ubuntu2) xenial; urgency=medium

  * Build Test

 -- Siraj Razick   Fri, 14 Oct 2016 16:29:02 -0400
Add the details about the change and save and close the editor. Now we are all set to proceed to the next step by changing in the directory INSTALLERS/deb and run the following command to submit the package to launchpad.
dput ppa:shaheeqa/plexydesk plexydesk_1.0.0-3ubuntu4_source.changes
If you followed everything correctly you should receive an email from launchpad.net, stating the state of the package.
Checking signature on .changes
gpg: Signature made Sat 15 Oct 2016 01:46:42 PM EDT using RSA key ID F4BBC295
gpg: Good signature from "Shaheeqa Siraj "
Good signature on /home/shaheeqa/ubuntu/plexydesk-vivid/INSTALLERS/deb/plexydesk_1.0.0-3ubuntu4_source.changes.
Checking signature on .dsc
gpg: Signature made Sat 15 Oct 2016 01:46:37 PM EDT using RSA key ID F4BBC295
gpg: Good signature from "Shaheeqa Siraj "
Good signature on /home/shaheeqa/ubuntu/plexydesk-vivid/INSTALLERS/deb/plexydesk_1.0.0-3ubuntu4.dsc.
Uploading to ppa (via ftp to ppa.launchpad.net):
  Uploading plexydesk_1.0.0-3ubuntu4.dsc: done.
  Uploading plexydesk_1.0.0-3ubuntu4.tar.bz2: done.        
  Uploading plexydesk_1.0.0-3ubuntu4_source.changes: done.
Successfully uploaded packages.

Now you can visit launchpad.net to check the build status of the package and you can start distributing and informing your friends about the availability of the package.


Contains Extracts from : Ubuntu Official Binary Package Building Guide