Package sizes

This is a perl library and several perl scripts which will help in finding non-optified packages.

You can download the individual files below, or get a ZIP file containing all files.

I've also written a python equivalent - this is an all-in-one version mainly intended for embedding into other python applications.

Last Update: 29 March 2010

The simplest installation is to place all these files in a single directory, then (from within that directory), run:

perl -I. <script> [pkgname]

where <script> is the name of the script to run, and [pkgname] is the name of the package to query (if required).

For more advanced installation, you can set the PERL5LIB and PATH environment variables in your ~/.profile file and call the scripts from wherever you like.

PkgSize.pm

This is the perl module used by the other scripts. It accesses the dpkg data files directly in order to lookup display names and file lists. It then calculates the rootfs space used for the package, excluding files stored elsewhere. This is done by comparing the device number of the filesystem the file is on with that of the rootfs (using the perl stat function). This avoids the need to hardcode non-rootfs paths, and will deal with any symlinks, bind mounts, etc.

pkgsize.pl

This script takes a package name and outputs the total rootfs size for the package.

pkglist.pl

This script also takes a package name but outputs the list of files installed into the rootfs by the package, along with their size.

checkpkgs.pl

This script outputs a list of all packages containing files (excluding symlinks) in the rootfs, and the total size taken on the rootfs by the package. The display name for the package (if available) is given in brackets after the actual name.