Cleaning MacPorts Dependencies
Sometimes MacPorts gets a little carried away with dependencies. I recently tried installing mercurial on 10.6, and found MacPorts yak shaving various X11 libraries. After deciding that this yak didn't need to be shaved, I cancelled the install and downloaded the Mac OS X mercurial installer (index).
Unfortunately, canceling a port install leaves behind extra packages. Which packages? Good question. I knew that I had asked for some packages (libidl, graphviz, bash-completion), but I didn't know which packages were only installed as dependencies of my half completed mercurial request. Given a package,
Given a map of package names to a list of packages dependent on that package:
Unfortunately, canceling a port install leaves behind extra packages. Which packages? Good question. I knew that I had asked for some packages (libidl, graphviz, bash-completion), but I didn't know which packages were only installed as dependencies of my half completed mercurial request. Given a package,
port
can find the packages that are dependent on it. Hmm, this sounds like some programming homework...Given a map of package names to a list of packages dependent on that package:
- find packages with no dependencies, which were not explicitly installed by the user
- if there are none, you are done
- add them to a list of packages to remove
- remove their map entry
- remove them wherever they appear as dependent on another package
- recurse!
2 Comments:
Very nice idea. You could extend it to be a "uninstall and prune" command; grab the graph before, uninstall, grab the graph after and prune away any new leaves.
By Ben, At 9/12/09 6:01 PM
I just learned today about the port port_cutleaves . It's designed to take care of this sort of problem...
By sampablokuper, At 2/17/10 9:40 PM
Post a Comment
<$I18N$LinksToThisPost>:
Create a Link
<< Home