Following to Kushal’s post about counting total number of Debian packages, he concluded that sid currently has more than 30,000 binary packages (free, contrib & non-free).

IMHO it is more relevant to count source packages. I couldn’t find any existing way of doing it, I have hence written a short bash script.

Script updated thanks to Thomas’ advice – now checking source packages directly from the mirror’s Sources.gz file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
 
if [ $# -lt 1 ]; then
  echo "Please add at least one distribution as argument"
  echo "Exiting"
  exit 1
fi
 
for arg in $*
do
 
  echo "Number of source packages in $arg: "
  for dist in main contrib non-free; do
    echo -n "  $dist: "
    wget -q -O - ftp://ftp.debian.org/debian/dists/$arg/$dist/source/Sources.gz | zgrep -c '^Package: '
  done
 
done

The results as of today:

Number of source packages in etch:
  main: 10221
  contrib: 126
  non-free: 211
Number of source packages in lenny:
  main: 12176
  contrib: 180
  non-free: 241
Number of source packages in sid:
  main: 13032
  contrib: 158
  non-free: 275

Which means we are quite far from the 18,733+ available packages, proudly announced on Debian homepage.

Update: I had misread the figure advertised on Debian homepage which is a count of the binary packages available (which is currently much higher that what is stated there)