Use SecureRandom to generate UUID as an attribute

This fixes a bug in which the UUID would change every time the
template is rendered. Additionally, we now use SecureRandom
instead of installing the UUID gem.
Set UID/GID on pip installs and handle dulwich

The dulwich dependency for RhodeCode versions 1.7.2 and below is
constrained to a version which is no longer available in the PyPi
repositories. We now need to download the release from github as
a tarball and install it into the virtualenv manually to ensure
the dependency resolves.

The other issues addressed in this patch are:
* Set the UID/GID for the pip installs to the rhodecode user/group.
* Install mercurial before anything else should we need to use
  mercurial to do a pip install.