There is a time frame where the `Packages` files are updated, but the
`Release` files are not updated yet. To reduce the time frame where the
archive is in an inconsistent state, generate the update for the `dists`
directory in a temporary directory. Once the update is prepared, use
`os.rename` to move the old directory away and move the newly prepared
directory in place. There is a tiny time frame between both `os.rename`
where the directory is missing, but this time frame should be small
enough to be not relevant in practice.
To make the `dist` directory generation truly atomic, symlinks need to
be used. Even after that there could be a race on the client side: The
client could fetch the `Release` file, then the `dists` directory could
be updated, then the client tries to fetch the `Packages` file.
Signed-off-by: Benjamin Drung <email address hidden>
feat: Generate .Release.gpg.new and use atomic replace
There is an unnecessary window when `Release.gpg` is absent. Generate
`.Release.gpg.new` and use atomic replace to update `Release.gpg`. There
is still a window where `Release` and `Release.gpg` are out of sync.
This should be addressed in the future by atomically replacing the
complete directory.
Signed-off-by: Benjamin Drung <email address hidden>