Debian Package Dependencies

I'm having to do security updates on Debian systems today, and someone asked "why is liblcms2-2 even installed?" I had no idea. This led me into the always entertaining area of package dependencies, both forward and reverse.

apt-cache showpkg liblcms2-2 gives you everything about the package, including both depends and reverse depends, for all packages installed or not. It's brutally ugly and hard to read. Let's see if there's a better way.

What Packages Need the Named Package?

Otherwise known as "reverse depends." I tried apt-cache rdepends liblcms2-2, but the output includes everything that would require it, installed or not. You'd have to cross-reference to your installed packages - too much trouble, and again, there must be a better way. You should always install aptitude for its many lovely properties, and it handles this better too:

# aptitude why liblcms2-2
i   python-reportbug Depends    python-debianbts
i A python-debianbts Depends    python-soappy
i A python-soappy    Depends    python-wstools
i A python-wstools   Depends    python-docutils
i A python-docutils  Recommends python-pil
i A python-pil       Depends    liblcms2-2 (>= 2.2+git20110628)

Or, still simpler:

# apt-cache rdepends --installed liblcms2-2
liblcms2-2
Reverse Depends:
  python-pil

The down-side of this last one is also its advantage: it doesn't include the full dependency stack.

apt-cache rdepends --installed --recurse liblcms2-2 does what aptitude why ... did, but it does it super-ugly.

What Packages are Required by the Named Package?

This is easier to answer, and as far as I'm concerned no further investigation is necessary:

# apt-cache depends liblcms2-2
liblcms2-2
  Depends: libc6
  PreDepends: multiarch-support
  Suggests: liblcms2-utils

Note that in this case we don't have to specify '--installed' because if it's a dependency, it pretty much has to be installed. (Okay, there are ways around that - it's your damn system, you can break it if you want. You know who you are.)

What does this Package DO?

So far, the best way I've found to show a package description (which still won't tell you why some other package thinks it depends on this one, but that's a mystery known only to the people who program the dependencies lists) is:

# apt show liblcms2-2
Package: liblcms2-2
Source: lcms2
Version: 2.6-3+deb8u1
Installed-Size: 394 kB
Maintainer: Oleksandr Moskalenko <malex@debian.org>
Depends: libc6 (>= 2.14)
Suggests: liblcms2-utils
Homepage: http://www.littlecms.com/
Pre-Depends: multiarch-support
Section: libs
Priority: optional
Download-Size: 141 kB
APT-Manual-Installed: no
APT-Sources: http://security.debian.org/ jessie/updates/main amd64 Packages
Description: Little CMS 2 color management library
 LittleCMS 2 intends to be a small-footprint color management engine, with
 special focus on accuracy and performance. It uses the International Color
 Consortium standard (ICC) of color management. LittleCMS 2 is a full
 implementation of ICC specification 4.2 plus all addendums. It fully supports
 all V2 and V4 profiles, including abstract, devicelink and named color
 profiles.
 .
 This package contains the shared library of liblcms2.

N: There is 1 additional record. Please use the '-a' switch to see it

If you're hard-core, and want JUST the description, you can really muck about in the underpinnings of the APT system:

# dpkg-query -W --showformat='${Description}\n' liblcms2-2
Little CMS 2 color management library
 LittleCMS 2 intends to be a small-footprint color management engine, with
 special focus on accuracy and performance. It uses the International Color
 Consortium standard (ICC) of color management. LittleCMS 2 is a full
 implementation of ICC specification 4.2 plus all addendums. It fully supports
 all V2 and V4 profiles, including abstract, devicelink and named color
 profiles.
 .
 This package contains the shared library of liblcms2.