diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index 6f99317..c72ac3d 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -224,15 +224,29 @@ jobs: # CDN, so a HEAD is not enough: the index and the file can disagree # for as long as the CDN caches the previous build under this name, # and the checksum is exactly what pacman verifies before installing. + # A freshly accepted upload is not routable instantly, so an absent + # file is retried before giving up; different bytes are a real + # mismatch and fail at once, since that is what breaks pacman. url="https://repo.laxacube.ch/x86_64/$PACKAGE_NAME" expected="$(cut -d' ' -f1 "$PACKAGE_FILE.sha256")" - for _ in 1 2 3 4 5 6; do - if [ "$(curl -fsSL "$url" | sha256sum | cut -d' ' -f1)" = "$expected" ]; then - echo "published $url" - exit 0 + code=000 + for _ in $(seq 1 24); do + code="$(curl -sS -o "$RUNNER_TEMP/served.pkg" -w '%{http_code}' "$url" || true)" + if [ "$code" = 200 ]; then + served="$(sha256sum "$RUNNER_TEMP/served.pkg" | cut -d' ' -f1)" + if [ "$served" = "$expected" ]; then + echo "published $url" + exit 0 + fi + echo "::error::$url serves sha256 $served instead of $expected" + echo "::error::the CDN is still caching another build under this name: purge it before re-running" + exit 1 fi sleep 5 done - echo "::error::$url does not serve this build (expected sha256 $expected)" - echo "::error::the CDN is probably still caching an older file under this name: purge it before re-running" + if [ "$code" = 404 ]; then + echo "::warning::$url is not visible yet; the repository accepted the upload, pacman will see it once the index is rebuilt" + exit 0 + fi + echo "::error::$url answered HTTP $code after the upload" exit 1 diff --git a/packaging/README.md b/packaging/README.md index bd7f222..3f0f6cc 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -100,7 +100,8 @@ ce nom de paquet (relancer une release est sans effet), et demande d'incrémente `pkgrel` pour publier un build différent. Après l'envoi, il relit aussi le paquet servi et compare son `sha256` à celui du build, pour ne pas annoncer une publication que les clients ne peuvent pas -installer. +installer. Le fichier met quelques secondes à être routé après l'upload : il est +retenté pendant deux minutes, et une empreinte différente échoue immédiatement. `pkgver` est la version du fork FWS (fichier `version` à la racine), pas celle de kitty : la version amont embarquée est dans `_kittyver`.