Unify how we solve barclamp dependencies in build_lib.

This also makes the dependency solving a good deal more robust.