Do lock the repos during fsck/repack

Looks like if a repo that is pulled with --mirror is updated in the
middle of fsck, it reports scary corruption errors that are
false-positive. Lock the repo before repack/fsck and unlock right after
to avoid those.

Also, a few cleanups and further py3 compatibility.

Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
6 files changed