Posts: 2
Joined: Fri Oct 24, 2014 12:21 pm

Download sources of older packages

Fri Oct 24, 2014 1:21 pm

We want to sell embedded devices powered by Raspberry Pis and Raspbian (without the non-free software). I want to distribute the sources of the os distribution with the devices (mainly to satisfy GPL requirements).

How can I download all the source packages of all the installed packages?
My approach is, to insert the following lines to /etc/apt/sources.list:

Code: Select all

deb-src wheezy main firmware
deb-src wheezy main
And then get a list of installed packages plus version information with dpkg-query and pass it to apt-get source:

Code: Select all

apt-get update
apt-get source $(dpkg-query --show --showformat="\${Package}=\${Version} ")
The problem is, that packages, not being the current version in the repository, will not be found in the raspbian / raspberrypi repos. Ok, as I understand, most of them are none modified debian packages but compiled for ARMv6 hard float. So I could get them from the original debian repos. But I think there are also modified packages. And the GPL requires me to distribute the sources to build exactly the binaries, I am distributing.

I have already assembled and tested a system for a SD-Card image and don't want to upgrade it (never change a running system).

So my question is: How do I get source packages of packages older then the current one?

Forum Moderator
Forum Moderator
Posts: 3546
Joined: Wed Dec 28, 2011 11:45 pm

Re: Download sources of older packages

Fri Oct 24, 2014 4:27 pm

For stuff that came from the raspbian respotories you can find the archive of historic source packages at You can also make a local copy of them with rsync from rsync:// (do note though that it's 336G currently)

I wrote a couple of tools called "systemscanner" and "sourcefinder" to help automate the process of gathering together the corresponding source packages for an installed system. Unfortunately it needs a local copy of the archive of source packages to pull from (fixing this would be useful if anyone fancies doing it).

systemscanner can be pointed at a folder full of deb files (useful for dealing with packages that are sitting on a system but not actually installed, for example in /var/cache/apt/archives) and/or at the /var/lib/dpkg/status file of an installed system and will provide a list of source package names and source versions on standard output.

sourcefinder will take that list and pull the needed source packages out of a large collection of source packages (stored in a debian-style dir heirachy is). The usual usage is along the lines of

./sourcefinder <list file> --copy <target dir> /mybigstuff/sourcearchive/*

(assuming /mybigstuff/sourcearchive is a local copy of rsync://

The tools can be obtained with "svn checkout svn://" if you get stuck building them post back and i'll take a look.

For stuff that came from other places you may have more detective work to do.

Posts: 2
Joined: Fri Oct 24, 2014 12:21 pm

Re: Download sources of older packages

Fri Oct 24, 2014 4:55 pm

Ah, is interesting. They have no debian repository running with that archive, right?

But it should not be that hard, to write a script that downloads the needed packages from

I will try that, thanks!

Return to “Raspbian”