aptirepo: move dists dirname decision higher in the call chain
aptirepo: minimize the time dists directory is broken during update

Dists updating is done in a temporary directory which is renamed to
"dists" after everything is set. This minimizes the time the
repository is in a broken state.
aptirepo: use write_to_tmp + rename -pattern in Release.gpg writing