Getting Debian Packages Sources from Launchpad

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

/etc/apt/sources.list.d/chris-lea-python-tornado-precise.list

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

5 thoughts on “Getting Debian Packages Sources from Launchpad

  1. Branden Visser (@meestaveesa)

    Thanks for this. I should add that if you’re looking to freeze a version in your own PPA, Launchpad also provides the ability to “Copy Packages” to your own PPA repository. Look at the top-right of the packages screen for the link.

    Reply
    1. chris lea Post author

      Hi Rohit. Fedora uses an entirely different packaging system called “yum”. It won’t work with Debian style apt repositories such as the one I maintain. Sorry!

      Reply

Leave a Reply