Total Pageviews

Thursday, 15 December 2011

Launchpad PPA

So after discovering that my quick and dirty rtorrent fix didn’t actually fix what i needed it to (xmlrpc stuff, specifically), I decided to instead look into setting up a ppa on launchpad to host some of my custom packages. So here is a quick guide on how to do this:
first, some things you will need to install:
sudo apt-get install dput devscripts
of course, you’ll need some of the usual stuff like build-essentials and other common dev packages. dput is used to upload your source packages to your ppa, and devscripts contains some useful debian package scripts, such as debuild which is used to build your package.
now, create a gpg key for your ppa (or use an existing one if you have one)
simply use gpg –gen-key to generate a key (use the defaults, unless you want to get more specific)
if you already have a set of keys on another machine, you can export/import the public and private keys to your other machine. If you get into trouble with not enough entropy (happens when your compile machine is headless and you do everything through ssh), then try installing rng-tools and set your device to /dev/urandom (in /etc/default/rng-tools) then start the service. This will generate entropy for you.
Now setup your own ppa. First you’ll need a launchpad account, then you just need to authenticate yourself and create a new ppa. I won’t detail this process, but you can probably get a good idea from here: http://blog.launchpad.net/ppa/personal-package-archives-for-everyone
Now grab your source package as well as its build dependencies:
sudo apt-get build-dep PACKAGE
apt-get source PACKAGE

note that you don’t need to sudo when getting package sources. If you are upgrading the package using the latest version, things can get a little wonky because ubuntu packages are usually customized with patches, and these patches often don’t work with bleeding edge source. None the less you can give it a shot, simply grab the source for your package (not through apt, but from svn, git, http, etc…) and then copy the debian directory from the ubuntu source directory to your newer source directory. You will need to modify the changelog and create a new entry for your package (with an updated version). Alternatively, you can use dch to do this. Once you have your source set up, you have to build the source package. I recommend building the binary first, but this is not necessary, it just helps to for testing installation of the package and other things. to build the source package:
debuild -S -sa
this will generate a source package in the parent directory. Once this finishes, you can upload it to you ppa.
to upload your package to your ppa, just run:
dput PPA PACKAGE_source.changes
PPA will be something like ppa:USER_NAME/PPA_NAME
the changes file will have been created as a part of the source package creation.
this will ask you to enter your gpg password, and then upload the files to the launchpad servers. In a few minutes your package will be built and you’ll get a notice saying it was successful or not.
Caveats! They exist! some things i have found which are slightly annoying are the following:
you cannot re-upload (re-build) a package. This is useful if you have a dependency issue, the only fix is to increment the version and re-upload (please correct me if there is a better solution).
deleting packages is not very clear what happens, a deleted package still exists for quite some time on the server. There appears to be no notice of a package being purged, it just randomly stops existing.
p.s. updated rtorrent ppa will come soon, if you really want to get it now, you can use this package source:
deb http://ppa.launchpad.net/patricksissons/pjs/ubuntu karmic main
this is my development ppa, so it may contain things you don’t actually want to install.

No comments:

Post a Comment