aptly-dev / aptly

aptly - Debian repository management tool
https://www.aptly.info/
MIT License
2.56k stars 374 forks source link

Feature request: option to generate a lastupdate file during aptly publish #1229

Open Grimler91 opened 11 months ago

Grimler91 commented 11 months ago

Detailed Description

To keep traffic to a minimum some mirrors would like to have a lastupdate file with timestamp of latest repo update. The mirror can then check this file before rsync'ing.

Context

See for example lastupdate check in archlinux's repo sync template (not an apt repo, but principle is the same).

Possible Implementation

I'm not very fluent in golang, but seems to me like it should be possible to (optionally) generate or update a lastupdate file in repo root (or perhaps a configurable subfolder) every time repo is re-published. From shell we can run date +%s > /path/to/aptly/published/folder/lastupdate to generate a lastupdate file with timestamp.

Your Environment

neolynx commented 9 months ago

Hi,

could this be achieved by exploring the Release.gpg file ? A HTTP HEAD command returns the last modified:

$ curl --head http://aptlyserver/patch/dists/stable/Release.gpg
HTTP/1.1 200 OK
Server: nginx/1.22.1
Date: Wed, 20 Dec 2023 13:07:15 GMT
Content-Type: application/octet-stream
Content-Length: 516
Last-Modified: Wed, 20 Dec 2023 13:01:45 GMT
...
Grimler91 commented 9 months ago

Hi @neolynx, I think for mirrors it would be useful with a lastupdate file, as that might be what they are used to. I can run a cronjob on the server and parse the Release file to generate a lastupdate file easily though, thanks for the idea!