The 0.1.7-1 release was built twice: the second run attached a package with a different sha256 under the same name, so the CDN kept serving bytes from the first build while the index announced the second, and pacman rejected the download as an invalid or corrupted package. The release now refuses to replace a published package whose checksum changed and asks for a pkgrel bump instead, and it verifies the sha256 of the served file after the upload rather than only its presence.
This commit is contained in:
3 files changed
+39
-6
No files matched your search
@@ -154,6 +154,23 @@ jobs:
|
||||
fi
|
||||
echo "release_id=$release_id"
|
||||
|
||||
# A pacman version is immutable: clients cache the package by name and
|
||||
# repo.laxacube.ch serves it through a CDN, so a rebuild published
|
||||
# under the same version leaves those caches holding bytes the index
|
||||
# no longer matches, and pacman reports the file as corrupted. A
|
||||
# re-run that rebuilds identical bytes stays allowed.
|
||||
local_sha256="$(cut -d' ' -f1 "$PACKAGE_FILE.sha256")"
|
||||
published_sha256=""
|
||||
sha_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/$tag/$PACKAGE_NAME.sha256"
|
||||
if curl -fsSL "$sha_url" -o "$RUNNER_TEMP/published.sha256"; then
|
||||
published_sha256="$(cut -d' ' -f1 "$RUNNER_TEMP/published.sha256")"
|
||||
fi
|
||||
if [ -n "$published_sha256" ] && [ "$published_sha256" != "$local_sha256" ]; then
|
||||
echo "::error::$PACKAGE_NAME is already published with sha256 $published_sha256 but this build is $local_sha256"
|
||||
echo "::error::bump pkgrel in packaging/PKGBUILD so the rebuild is published as its own version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# A re-run must replace its own artefacts instead of failing on them.
|
||||
assets="$(curl -sS -H "$auth" "$api/releases/$release_id/assets")"
|
||||
attach() {
|
||||
@@ -194,15 +211,19 @@ jobs:
|
||||
-H 'Content-Type: application/octet-stream' \
|
||||
--data-binary "@$PACKAGE_FILE"
|
||||
echo
|
||||
# The index is rebuilt server-side, so wait for the package before
|
||||
# reporting success.
|
||||
# The index is rebuilt server-side and the file is served through a
|
||||
# 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.
|
||||
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 -fsSI "$url" > /dev/null; then
|
||||
if [ "$(curl -fsSL "$url" | sha256sum | cut -d' ' -f1)" = "$expected" ]; then
|
||||
echo "published $url"
|
||||
exit 0
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
echo "::error::the upload was accepted but $url is not served yet"
|
||||
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"
|
||||
exit 1
|
||||
@@ -320,8 +320,11 @@ contrôles sur chaque PR et chaque push sur `main` qui ne modifie pas que
|
||||
Pour reconstruire la même version du fork (correctif de packaging), incrémentez
|
||||
`pkgrel` dans `packaging/PKGBUILD` puis lancez le workflow à la main
|
||||
(*Actions → Release → Run workflow*) : le paquet `0.1.7-2` remplace alors le
|
||||
`0.1.7-1`. Une nouvelle version du fork demande `version`, `pkgver` et les deux
|
||||
front-ends, avec `pkgrel=1` ; pour suivre une nouvelle version de kitty, mettre
|
||||
`0.1.7-1`. Une version déjà publiée n'est jamais réécrite avec un autre build :
|
||||
le workflow refuse de remplacer un paquet dont l'empreinte a changé et demande
|
||||
d'incrémenter `pkgrel`, sinon les caches (CDN, pacman) servent un fichier qui ne
|
||||
correspond plus à la base. Une nouvelle version du fork demande `version`,
|
||||
`pkgver` et les deux front-ends, avec `pkgrel=1` ; pour suivre une nouvelle version de kitty, mettre
|
||||
à jour `_kittyver` et `kitty/constants.py`. La publication vers
|
||||
`repo.laxacube.ch` utilise le
|
||||
secret `REPO_TOKEN` du dépôt, la release Gitea le secret `RELEASE_TOKEN` ; sans
|
||||
|
||||
@@ -91,6 +91,15 @@ fork, incrémentez `pkgrel` ici et lancez le workflow manuellement ; le paquet
|
||||
serveur. Le `PKGBUILD` lit `FWS_SOURCE_REF` (`commit=<sha>` depuis la CI) pour
|
||||
construire le commit publié plutôt que la tête de `main`.
|
||||
|
||||
Une version publiée n'est jamais réécrite : deux builds du même commit ne sont
|
||||
pas identiques à l'octet près, et le CDN comme le cache pacman gardent le fichier
|
||||
sous son nom, donc republier `0.1.7-1` avec un autre contenu donne des caches qui
|
||||
désaccordent avec la base et pacman rejette le téléchargement (`paquet non valide
|
||||
ou corrompu`). Le workflow refuse ce cas et demande d'incrémenter `pkgrel`.
|
||||
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.
|
||||
|
||||
`pkgver` est la version du fork FWS (fichier `version` à la racine), pas celle
|
||||
de kitty : la version amont embarquée est dans `_kittyver`.
|
||||
`packaging/check-version.sh` vérifie avant le build que `version` et `pkgver`
|
||||
|
||||
Reference in new issue
Block a user