linuxubuntu

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


How can I view all the nested dependencies of a package in Ubuntu? For example, hadoop-yarn-resourcemanager depends on hadoop-yarn which has its own dependencies:

$ sudo apt-cache depends hadoop-yarn-resourcemanager
hadoop-yarn-resourcemanager
  Depends: hadoop-yarn

$ 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: How to list all dependencies of a Package on Linux?, but I am looking for complete dependency tree.


Solution

  • 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.

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