Those are notes from a few weeks ago when I created a sample package for Ubuntu.
This article is written both as a guide and a timeline. There is no explicit tutorial here, so get your feet wet by yourself, and make sure to follow the references.
Edit: enumeration became a mess here. Sorry for that.
- Introduction; Packaging new software for Ubuntu; Debian Packaging Tutorial
- Get a couple of packages for packaging (duh):
sudo aptitude install gnupg pbuilder ubuntu-dev-tools bzr-builddeb apt-file packaging-dev
- Make sure you have a PGP key.
Send your PGP key to Ubuntu servers.
gpg --send-keys --keyserver keyserver.ubuntu.com <KEY ID>
Make sure you have a SSH key.
Create a clean build environment:
pbuilder-dist <release> create
At the time of this post, I used ‘trusty’ as the release name.
- Make sure you have a Launchpad account.
Update your Launchpad information and upload both your SSH and your GPG key into there.
Identify yourself with bzr.
bzr whoami "Bob Dobbs <email@example.com>" bzr launchpad-login subgenius
- Start a new package, and choose its type to create a new template.
bzr dh-make hello 2.7 hello-2.7.tar.gz
- Explore and edit the files of your new template. In particular, see the
commit your changes. This is a DVCS such as
git, so this should feel familiar.
- Building the package:
bzr builddeb -- -us -uc
The previous flags tell the system not to use GPG.
-nc might also be useful: it tells the system not to start from scratch.
- To view the contents of a package:
- To install / remove your new built package:
sudo dpkg -i *.deb # attention to the architecture of your package! sudo dpkg -r <name-of-your-packagee>
An alternative is to invoke
- Check for errors.
lintian *.dsc *.deb
- Next (optional; just to test the package in the chroot you have set up before, with
bzr buildddeb -S cd ../build-area pbuilder-dist trusty build *ubuntu*.dsc
- Upload your package to Launchpad:
dput ppa:<your-launchpad-username>/<your-ppa-name> *.changes
If you wanted to create a pull request instead:
bzr push lp:~<launchpad-username>/+junk/hello-package
And that’s it! Then just share your PPA with your friends and clients.
I hope this guide could serve to you as a quick reference of creating a new Ubuntu (or even Debian) package.