This site is now 100% read-only, and retired.

Downloading Debian source packages easily

Posted by Steve on Tue 6 Mar 2007 at 09:30

To download the source of a package contained inside a Debian repository, whether official, or unofficial, is a straightforward operation using the apt-get support for "source lists". However downloading a package source which is stored upon a remote webserver can be a little fiddly - requiring multiple files to be fetched before the source can be unpacked. Using the dget tool this can be easily automated.

As we've discussed previously a Debian package consists of a collection of files, such as:


Here we have, in turn, three files:

  1. The "diff" file, which contains differences between the original software release and the final Debian package.
  2. The "dsc" file, which contains checksum information and other details.
  3. The "orig" file, which is supposed to be the pristine release as downloaded from the project's homepage/site.
    • Although in practise this might have been modified to remove non-redistributable files, etc.

If these files were not available to you in a repository from which apt-get could locate them then you would need to download each file in turn - then unpack them manually.

Instead of doing this you can make use of the dget tool which is included within the devscripts package.

The dget command can also unpack the downloaded files, automatically invoking the dpkg-source command.

If you're missing the devscripts package first install it:

apt-get install devscripts

Once installed you can download a source package via a command such as:

dget -x

This will first download the dsc file, then in turn any files referenced within it. Finally, because we specified the -x flag, the resultant package will be extracted, or unpacked.

The dget command is a real time-saver compared to copying and pasting links from a browser window and downloading each one in turn.



Re: Downloading Debian source packages easily
Posted by cparker (204.136.xx.xx) on Tue 6 Mar 2007 at 17:37
[ View Weblogs ]
This reminds me of a question that I think of every now and then: Is it possible to turn Debian into a source-based distribution (see also FreeBSD, Gentoo)?

[ Parent ]

Re: Downloading Debian source packages easily
Posted by Steve (80.68.xx.xx) on Tue 6 Mar 2007 at 17:40
[ View Weblogs ]

apt-build, etc, will allow you to rebuild packages in a reasonably automated fashion.

If you want more than that you'll need to organise it yourself. There was a project setup to start work on this, "debtoo", but it seems to only exist in the wayback machine now.


[ Parent ]

Re: Downloading Debian source... (DebToo)
Posted by Anonymous (212.91.xx.xx) on Mon 26 Mar 2007 at 22:56
Yes, DebToo never actually took off. The two project leaders
that announced it had no programming or management skills
to do anything else but the announcement.

One good thing that came out of it was my complete rewrite
of apt-build. Julien Danjou (original apt-build author and
maintainer) received it and replaced the old codebase in
favor of the rewrite. It was a few years ago, so don't worry
about package versions...

Davor Ocelic

[ Parent ]

Good bye wget! ;)
Posted by ptecza (193.0.xx.xx) on Wed 7 Mar 2007 at 08:52
Steve, you're great! Now I need to run only one command
instead of four (3 x`wget` + 1 x `dpkg-source -x`)
when I want to build my own Debian backport.

[ Parent ]

Re: Good bye wget! ;)
Posted by ptecza (193.0.xx.xx) on Wed 7 Mar 2007 at 09:02
I've forgotten to say thank you very much! :)

[ Parent ]