From c2ccdccff4c22e884457635f192543c8f031d1c6 Mon Sep 17 00:00:00 2001 From: nevaforget Date: Mon, 20 Apr 2026 14:09:33 +0200 Subject: [PATCH] fix(ci): wipe all existing versions before upload to kill zombie DB entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gitea's Arch registry doesn't regenerate the repo DB on pkgver change — old entries linger as zombies (e.g. moonarch-git r99 stuck in moonarch.db even though only r105 exists as a package). List all versions of each built package and DELETE them before the upload so the DB gets rebuilt cleanly. Bump moonarch-git pkgrel to force a rebuild and exercise the fix. --- .gitea/workflows/build-and-publish.yaml | 36 +++++++++++++++++++++---- moonarch-git/PKGBUILD | 2 +- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/build-and-publish.yaml b/.gitea/workflows/build-and-publish.yaml index 7a21964..5aa2e01 100644 --- a/.gitea/workflows/build-and-publish.yaml +++ b/.gitea/workflows/build-and-publish.yaml @@ -67,6 +67,37 @@ jobs: continue fi + # Collect unique package names (includes split packages like + # foo + foo-debug). We delete ALL existing versions of each + # before upload: Gitea's Arch registry doesn't fully regenerate + # the repo DB on pkgver change — old entries stick around as + # zombies and block pacman from seeing updates. + declare -A SEEN_NAMES + for PKG_FILE in "${PKG_FILES[@]}"; do + base="${PKG_FILE%.pkg.tar.zst}" + base="${base%-*}"; base="${base%-*}"; base="${base%-*}" + SEEN_NAMES["$base"]=1 + done + + sudo pacman -S --needed --noconfirm jq + + for PKG_NAME in "${!SEEN_NAMES[@]}"; do + echo "==> Clearing existing versions of $PKG_NAME" + # Listing API returns every matching package across all types, + # so we filter by exact name client-side. + VERSIONS=$(curl -s \ + -H "Authorization: token ${{ secrets.PKG_REGISTRY_TOKEN }}" \ + "https://gitea.moonarch.de/api/v1/packages/nevaforget?type=arch&q=${PKG_NAME}&page=1&limit=100" \ + | jq -r --arg n "$PKG_NAME" '.[] | select(.name==$n) | .version') + for V in $VERSIONS; do + echo " delete $PKG_NAME@$V" + DEL_CODE=$(curl -s -o /dev/null -w '%{http_code}' -X DELETE \ + -H "Authorization: token ${{ secrets.PKG_REGISTRY_TOKEN }}" \ + "https://gitea.moonarch.de/api/v1/packages/nevaforget/arch/${PKG_NAME}/${V}") + echo " HTTP $DEL_CODE" + done + done + for PKG_FILE in "${PKG_FILES[@]}"; do base="${PKG_FILE%.pkg.tar.zst}" PKG_ARCH="${base##*-}" @@ -79,11 +110,6 @@ jobs: echo "==> Uploading $PKG_FILE ($PKG_NAME $FULL_VER $PKG_ARCH)" - # Delete old version if it exists (ignore 404) - curl -s -o /dev/null -X DELETE \ - -H "Authorization: token ${{ secrets.PKG_REGISTRY_TOKEN }}" \ - "https://gitea.moonarch.de/api/packages/nevaforget/arch/moonarch/${PKG_NAME}/${FULL_VER}/${PKG_ARCH}" || true - # Upload new version. Capture HTTP status — curl -sf alone # hides the response, and a silent failure lets the run green # while the registry stays stale. diff --git a/moonarch-git/PKGBUILD b/moonarch-git/PKGBUILD index 3c6d166..8e121b8 100644 --- a/moonarch-git/PKGBUILD +++ b/moonarch-git/PKGBUILD @@ -5,7 +5,7 @@ pkgname=moonarch-git pkgver=r105.f4f6ede -pkgrel=7 +pkgrel=8 pkgdesc="Moonarch desktop environment defaults — Niri, Waybar, Catppuccin Mocha" arch=('any') url="https://gitea.moonarch.de/nevaforget/moonarch"