Occasionally people ask me for the sources to Debian packages that I publish on Launchpad. As it turns out, the sources are already there, you just have to know how to get to them. Fortunately it’s trivially easy to do.
The reason you can’t just grab them immediately with
apt-get source as you’d expect is that the
add-apt-repository tool you probably used to make your machine look at the PPA didn’t put a
deb-src line in to the
.list file it created for you. Let’s look at a quick example using my Tornado PPA.
To “install” the PPA, you would use the following command:
sudo add-apt-repository -y ppa:chris-lea/python-tornado
When you run that command, the file
gets created (though the name for the distro you’re using will be there if you’re not using Precise). That file has the following contents:
deb http://ppa.launchpad.net/chris-lea/python-tornado/ubuntu precise main
If you want to get the sources, just open up that file with your editor of choice and add a
deb-src line so it looks like this:
deb http://ppa.launchpad.net/chris-lea/python-tornado/ubuntu precise main deb-src http://ppa.launchpad.net/chris-lea/python-tornado/ubuntu precise main
After you do that, you can get the source files by running
sudo apt-get update apt-get source python-tornado