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
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.
You too good for calling pull-lp-source? 🙂
Too ignorant. Didn’t know that existed. 😉 Thanks!
i want to do this on FEDORA “sudo apt-get-repository ppa:chris-lea/node.js” but turns out that it is not supported please help
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!