tuk
tuk

Reputation: 6852

How to view all nested dependencies of a package in ubuntu?

Can someone let me know how can I view all the nested dependencies of a package in Ubuntu? For example,

support@vrni-platform:/tmp$ sudo apt-cache depends hadoop-yarn-resourcemanager
hadoop-yarn-resourcemanager
  Depends: hadoop-yarn

support@vrni-platform:/tmp$ sudo apt-cache depends hadoop-yarn
hadoop-yarn
  Depends: libc6
  Depends: adduser
  Depends: bigtop-utils
  Depends: hadoop
  Depends: avro-libs
  Depends: zookeeper

I am looking for something like below. Somewhat similar to mvn dependency:tree

hadoop-yarn-resourcemanager
  Depends: hadoop-yarn
     Depends: libc6
     Depends: adduser
     Depends: bigtop-utils
     Depends: hadoop
     Depends: avro-libs
     Depends: zookeeper

I have seen this question but I am looking for complete dependency tree.

Upvotes: 4

Views: 2747

Answers (2)

mainmachine
mainmachine

Reputation: 307

This question is quite old, however apt-cache currently has a --recurse option for depends and rdepends that makes this easy:

apt-cache depends -i --recurse <packagename>

You probably also want the -i as that limits output to actual Depends:, filtering out non-essentials like Recommends: and Suggests:.

With the above options, the output can be enormous as it will include every package down to the kernel itself! With simple packages this might be no big deal, but for a desktop environment or even a large application...

Upvotes: 5

larsks
larsks

Reputation: 311416

Well, there is the apt-cache dotty command, which will generate a graphviz representation of the package's dependencies. However, this is going to be less useful than you think: there are a lot of "core packages" that are going to be required by just about everything, and the resulting graphs will be quite large.

For example, the output of apt-cache dotty openssh-client renders into this beast.

The dot syntax is relatively simple; you could probably parse that yourself to extract a subset of the information.

Upvotes: 3

Related Questions