I have used a tool that calculates the minimal set of packages you can install to get the current set of packages you have. This is different than telling you what your selections are. It literally finds the shortest list of packages that will, through dependencies, give you what you currently have.
I forgot where to find this tool. What is it called?
aptitude
can get you most of the way with its search feature. Here's how you find everything installed that wasn't only an automatic dependency:This wont be optimal some of these may be able to be removed but I don't know a simple way to work that out. Perhaps the answer lies in
man aptitude
.On second thought, with that list you could loop through it and find the dependant packages (not dependencies) for each one. If one of those is in the master list, remove the current package from the list... but only after you've parsed the whole list or you'll miss intermediates in a 3+ level dep tree.
You find dependants with a query like this:
I'd try and write the script but I'm typing this on a tiny phone keyboard. Even I have limits.
Edit: After five minute of trying to sleep, I started hacking away on this. something like this should do the job:
Note this takes a really long time to run and it might be over-keen (eg it will remove thing that you manually installed, that you want to be manually installed, if they are depended on by something else in the $orig list that you perhaps installed afterwards).
I have written a small python script to do that, posted as a gist here.
You give it a set of package names on the command line, and it should give you a smaller, minimal set of packages that imply all the others you have given as arguments. Here,
x11-proto-fixes-dev
is implied (a dependency of) bylibgtk2.0-dev
:I tried answers from this and two other similar questions on a system I've been running for years and the shortest list I could get was 1338 packages, most of which were obviously dependencies or stock packages.
However, over on the Unix/Linux Stack Exchange I found this answer, which pulls the list of stock packages for your install from the Ubuntu mirror and filters it out. That got my list down to 404 packages that looks sane to me.