Refactor requirements_handler to not be racy

* As we were calling the mark_install directly, the thread could not have
  started and so we could have installed both bucket in the first shot.
  Ensure we mark as to install only in the thread.
* Adapt tests for raise (returns an error instead of raising)
* Add more tests for multi-arch and bucket_available/is_installed
* Replace cache = Cache() reload with cache.open() to reuse the same object
* Add seteuid and setegid mocks and tests
* Other tests fixes with latest API