Harder Better Safer 'opam update'

Make the global state hold much more metadata than before, which make the 'opam update' algorithm both simpler and more robust.

I'm opening this PR to start testing it, it seems to work on my limited tests but definitely needs more meat.