0

I am in the process of building a live CD, and to reduce the size of the CD image I need to do without some packages. By default, recommended packages are installed and flipping that switch off turns the CD from bloated with junk I don't need (why would I need the QT4 designer because I am bundling a Python QT program?) to barely usable.

What would be ideal is some tool that takes a list of packages as input and crawls their dependency graph, following only "depends" links, but printing out the "recommends" links that it finds, effectively showing me the "top level" of recommended packages that would be installed based on the packages I fed into the tool. This would help me decide which of those packages need to be included, and then I can re-run the tool on that set of packages until there are no more that I need.

Other tools like apt-cache depends will dump out everything, and if I grep for "Recommends" this will show me packages that recommended packages also recommend, which I do not want.

For example, if:

  • A depends on B,
  • B recommends C,
  • C depends on D, and
  • D recommends E.

If I ask this hypothetical tool about package A, then I would want it to give me only package C as the output -- I would not want E included, as I don't even know if I want C yet.

Is there such a tool out there, or is there a somewhat simple way to accomplish this with existing tools?

1
  • This is not a perfect solution but it may get you close. Install the sytem with install recommends on. Then run debfoster and have it configured to not treat recommends as depends. Thhis will walk you through each of the recommended packages and show you what they are pulling in and ask if you want to remove the package and its dependencies or just the package. It is tought to explain in a comment but if you install debfoster and play with it for a little while you will get the idea. Dont forget about dpigs and popcon-largest-unused
    – dfc
    Commented Mar 6, 2014 at 4:07

1 Answer 1

0

I think the apt-rdepends tool is exactly what you want. Install the package via apt-get, then run this (substituting your package "A" for the package "apt" that I am using in the example):

apt-rdepends --follow=Depends --show=Recommends apt 2>/dev/null | grep Recommends
  Recommends: gnupg
  Recommends: libc6-i686
  Recommends: gnupg-curl
  Recommends: libldap-2.4-2 (>= 2.4.7)

If you leave out grep you will also see the packages that have the "Recommends" link. It's pretty straightforward and matches your requirements exactly, with one possible gotcha: You cannot tell apt-rdepends when to stop, i.e. it will follow "depends" links to an arbitrary recursion level.

Read the man page to find out more about command line options. It's a really sweet tool, you can even do reverse-depends searches!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .