Dough Git

commit

aaa

commit
4f0f74641f15b4a0861ad3c8fbadb08e713c371b
author
Clove Twilight <[email protected]>
date
2026-08-31 15:54

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6cc4afc..9164871 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -319,12 +319,43 @@ jobs:
             git -C /tmp/aurrepo remote add origin "ssh://[email protected]/$PKGNAME.git"
           fi
 
+          # The AUR clone is the only thing that knows whether this pkgver has
+          # already been published. Re-running the release for a tag rebuilds
+          # the AppImage, and Electron builds are not reproducible — the same
+          # 3.1.0 comes back with a different sha256. Pushing that under an
+          # unchanged pkgver-pkgrel is invisible to AUR helpers: yay sees the
+          # cached build files as up to date, skips re-fetching the PKGBUILD
+          # and then fails its validity check against the old sums. Bumping
+          # pkgrel is the only signal that makes them refresh.
+          if [ -f /tmp/aurrepo/.SRCINFO ]; then
+            _oldver=$(awk -F' = ' '/^[[:space:]]*pkgver = /{print $2; exit}' /tmp/aurrepo/.SRCINFO)
+            _oldrel=$(awk -F' = ' '/^[[:space:]]*pkgrel = /{print $2; exit}' /tmp/aurrepo/.SRCINFO)
+          else
+            _oldver=""; _oldrel=""
+          fi
+
+          if [ "$_oldver" = "$PKGVER" ] && [ -n "$_oldrel" ]; then
+            # Compare at the published pkgrel so an unchanged re-run is a
+            # no-op rather than an endless pkgrel ratchet.
+            sed "s|^pkgrel=.*|pkgrel=$_oldrel|" "$WORK/PKGBUILD" > "$WORK/PKGBUILD.cmp"
+            if cmp -s "$WORK/PKGBUILD.cmp" /tmp/aurrepo/PKGBUILD; then
+              echo "::notice::AUR package already up to date for $PKGVER-$_oldrel"
+              exit 0
+            fi
+            _newrel=$((_oldrel + 1))
+            echo "::notice::$PKGVER is already published as -$_oldrel and the package changed (rebuilt artifact?) — publishing -$_newrel"
+            sed -i "s|^pkgrel=.*|pkgrel=$_newrel|" "$WORK/PKGBUILD"
+            chown builder:builder "$WORK/PKGBUILD"
+            runuser -l builder -c "cd $WORK && makepkg --printsrcinfo > .SRCINFO"
+          fi
+
           cp "$WORK/PKGBUILD" "$WORK/.SRCINFO" /tmp/aurrepo/
           git -C /tmp/aurrepo add PKGBUILD .SRCINFO
           if git -C /tmp/aurrepo diff --cached --quiet; then
             echo "::notice::AUR package already up to date for $PKGVER"
             exit 0
           fi
-          git -C /tmp/aurrepo commit -m "Update to $PKGVER"
+          PKGREL=$(bash -c "source $WORK/PKGBUILD >/dev/null 2>&1; echo \$pkgrel")
+          git -C /tmp/aurrepo commit -m "Update to $PKGVER-$PKGREL"
           git -C /tmp/aurrepo push origin HEAD:master
-          echo "Published $PKGNAME $PKGVER to the AUR"
+          echo "Published $PKGNAME $PKGVER-$PKGREL to the AUR"
diff --git a/packaging/aur/PKGBUILD b/packaging/aur/PKGBUILD
index 1188e47..e49593d 100644
--- a/packaging/aur/PKGBUILD
+++ b/packaging/aur/PKGBUILD
@@ -5,8 +5,12 @@
 # file, rewrites `pkgver` / `_appimagefile` for the tag being released, fills
 # the checksums with `updpkgsums`, regenerates .SRCINFO and pushes the result
 # to the AUR — so edit it HERE, never in the AUR repo, or the next release
-# will overwrite your change. `pkgrel` is likewise reset to 1 every release;
-# a pkgrel-only bump means bumping it here and re-running the workflow.
+# will overwrite your change. `pkgrel` is managed by that job too: reset to 1
+# for a new `pkgver`, and incremented past whatever the AUR already carries
+# when the same `pkgver` is published again (a re-run rebuilds the AppImage,
+# and a new checksum under an unchanged pkgver-pkgrel leaves AUR helpers
+# validating a fresh download against their cached, stale sums). So a
+# pkgrel-only bump just means re-running the workflow for the tag.
 #
 # It repackages the published Electron AppImage rather than building from
 # source (Arch's guidelines would call that a `-bin` package; the unsuffixed
@@ -70,6 +74,12 @@ package() {
   install -dm755 "$pkgdir/opt/$pkgname"
   cp -a --no-preserve=ownership squashfs-root/. "$pkgdir/opt/$pkgname/"
 
+  # --appimage-extract writes squashfs-root (and every directory under it) as
+  # 0700, and `cp -a src/.` stamps the source directory's mode onto the
+  # destination — so this tree ships root-only unless we normalise it, and the
+  # /usr/bin symlink below is unusable for every non-root user.
+  find "$pkgdir/opt/$pkgname" -type d -exec chmod 755 {} +
+
   # Drop the AppImage-only bits — the runtime doesn't use them, and the
   # usr/share tree is installed to real system paths below instead.
   rm -rf "$pkgdir/opt/$pkgname/usr" \
@@ -95,14 +105,32 @@ package() {
   # doughmination:// sign-in callback is forwarded to the app.
   local desktop
   desktop=$(find squashfs-root/usr/share/applications -name '*.desktop' 2>/dev/null | head -1)
-  if [ -n "$desktop" ]; then
-    install -Dm644 "$desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
-    sed -i "s|^Exec=.*|Exec=/usr/bin/$pkgname %u|" \
-      "$pkgdir/usr/share/applications/$pkgname.desktop"
+  # electron-builder actually drops the entry at the AppImage root, beside
+  # AppRun — usr/share/applications is where it *would* live in a normal
+  # filesystem tree, so check both rather than betting on one.
+  if [ -z "$desktop" ]; then
+    desktop=$(find squashfs-root -maxdepth 1 -name '*.desktop' | head -1)
+  fi
+  # Not optional: this entry carries MimeType=x-scheme-handler/doughmination,
+  # which is what registers the app as the handler for the doughmination://
+  # OIDC sign-in callback. Silently skipping it ships a package that cannot
+  # complete a login, so fail the build instead.
+  if [ -z "$desktop" ]; then
+    echo "::error:: no .desktop found in the AppImage — sign-in callback would not register" >&2
+    return 1
   fi
+  install -Dm644 "$desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
+  sed -i "s|^Exec=.*|Exec=/usr/bin/$pkgname %u|" \
+    "$pkgdir/usr/share/applications/$pkgname.desktop"
 
   if [ -d squashfs-root/usr/share/icons ]; then
+    # `cp -a icons "$dest/"` REPLACES $dest with a copy of icons when $dest
+    # does not exist yet, which lands the theme at /usr/share/hicolor and
+    # leaves /usr/share itself mode 0700. Create the parent first so icons/
+    # is copied *into* it, then normalise the 0700 dirs as above.
+    install -dm755 "$pkgdir/usr/share"
     cp -a --no-preserve=ownership squashfs-root/usr/share/icons "$pkgdir/usr/share/"
+    find "$pkgdir/usr/share/icons" -type d -exec chmod 755 {} +
   fi
 
   install -Dm644 "$srcdir/LICENCE-$pkgver.md" \