I had a problem with my apt packages which I resolved. The problem and resolution are discussed here:
Aptitude says that lots of my packages need to be removed ...?
However, in discussing this, I realized that I have an ancillary question about apt which I'd like to find the answer to, which is why I'm posting this current question.
I did something accidentally which caused more than 1,400 "auto" packages to become orphaned, and they were were listed as "no longer in use" and flagged for removal in aptitude. It seems now that the reason for this is because they all were ultimately dependent on some base-level package or meta-package that was incorrectly deleted.
If that is the case, is there a utility or procedure I can use to take a list of apt packages as input, and produce a dependency tree for this entire set of packages, taken as a whole? If so, I would probably have been able to identify the package at the top of this tree that I accidentally deleted, and I then could have reinstalled this package in order to fix my problem.
In other words, I'm looking for some procedure or utility which would take a list of packages as input and produce something similar to this as output ...
top-package
|--package-000
|-+package-001
| |--package-002
|-+package-003
| |--package-004
| |--package-005
| |-+package-006
| | |--package-007
| |--package-008
|--package-009
... etc. ...
... where package-NNN are my list of input packages plus any other packages they happen to be dependencies for, and top-package is the root of the dependency tree. If my hypothesis is correct that my problem was due to a high-level meta-package having been accidentally deleted, then top-package would identify that deleted package. I could then reinstall top-package and presumably fix my problem.
To be clear, I want to repeat that I already solved my specific problem in a different way (see the referenced discussion). I'm asking this here not to solve that particular problem, but rather, because I would like to have some sort of dependency-tree-listing tool like I described above, in order to help diagnose and fix other similar problems which might occur in the future.
Thank you very much for any references or suggestions.
apt-cache rdepends <package>.apt-cache depends <package>to build a dependency tree of what's needed for your package. Do this one a few packages at the same time and filter to only what's common for all packages.