Add support to query reverse dependencies of a formula.

* Refine reinstall code to be easily reused.