From 69c90c4e039d4d9398989ad57cf5493fd00974c5 Mon Sep 17 00:00:00 2001 From: Harrison Kairalla Date: Wed, 7 Oct 2026 15:49:28 -0600 Subject: [PATCH] grok-bot: track stable releases --- docs/upstream-sources.md | 2 +- pkgbuilds/grok-bot/.omarchy/package.json | 2 +- pkgbuilds/grok-bot/.omarchy/upstream.sh | 77 ++++++++++++++++++++++++ pkgbuilds/grok-bot/PKGBUILD | 11 ++-- pkgbuilds/grok-bot/update-pkgver.sh | 49 --------------- 5 files changed, 84 insertions(+), 57 deletions(-) create mode 100755 pkgbuilds/grok-bot/.omarchy/upstream.sh delete mode 100755 pkgbuilds/grok-bot/update-pkgver.sh diff --git a/docs/upstream-sources.md b/docs/upstream-sources.md index 2e30f0711..c88370e33 100644 --- a/docs/upstream-sources.md +++ b/docs/upstream-sources.md @@ -221,7 +221,7 @@ in `origin` and has no effect on release selection. ## Existing manual holds -`grok-bot`, `libfprint-git`, `libretro-cap32-git`, `libretro-database-git`, `libretro-fbneo-git`, `libretro-uae-git`, `libretro-vice-git`, `quickshell-git`, `supergfxctl`. +`libfprint-git`, `libretro-cap32-git`, `libretro-database-git`, `libretro-fbneo-git`, `libretro-uae-git`, `libretro-vice-git`, `quickshell-git`, `supergfxctl`. These packages were already excluded from automatic AUR updates. The migration preserves that policy. diff --git a/pkgbuilds/grok-bot/.omarchy/package.json b/pkgbuilds/grok-bot/.omarchy/package.json index 2e8b08973..5a61bc6fc 100644 --- a/pkgbuilds/grok-bot/.omarchy/package.json +++ b/pkgbuilds/grok-bot/.omarchy/package.json @@ -1,6 +1,6 @@ { "source": "local", - "sync": false, + "release_ring": "fast", "origin": { "aur": "grok-bot", "commit": "05eb78fca06b482affda28b26223cbf249d4bbcd" diff --git a/pkgbuilds/grok-bot/.omarchy/upstream.sh b/pkgbuilds/grok-bot/.omarchy/upstream.sh new file mode 100755 index 000000000..d73f7cee4 --- /dev/null +++ b/pkgbuilds/grok-bot/.omarchy/upstream.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +# Cursor's Debian indexes provide version and SHA256 metadata for both +# architectures, so sync does not need to download the application binaries. +set -euo pipefail + +BASE_URL="https://downloads.cursor.com/aptrepo/dists/grok-bot/main" +declare -A DEBIAN_ARCHES=([x86_64]=amd64 [aarch64]=arm64) +declare -A VERSIONS=() CHECKSUMS=() + +newest_release() { + local package_index="$1" package_arch="$2" + local best_version="" best_checksum="" best_filename="" + local version checksum filename + + while IFS=$'\t' read -r version checksum filename; do + [[ "$version" =~ ^[A-Za-z0-9][A-Za-z0-9._+]*$ ]] || continue + [[ "$checksum" =~ ^[0-9a-f]{64}$ ]] || continue + + if [[ -z "$best_version" ]] || [[ "$(vercmp "$version" "$best_version")" -gt 0 ]]; then + best_version="$version" + best_checksum="$checksum" + best_filename="$filename" + fi + done < <(awk -v target="grok-bot" ' + BEGIN { RS = ""; FS = "\n" } + { + package = version = checksum = filename = "" + for (i = 1; i <= NF; i++) { + sub(/\r$/, "", $i) + if ($i ~ /^Package: /) package = substr($i, 10) + if ($i ~ /^Version: /) version = substr($i, 10) + if ($i ~ /^SHA256: /) checksum = substr($i, 9) + if ($i ~ /^Filename: /) filename = substr($i, 11) + } + if (package == target && version != "" && checksum != "" && filename != "") { + print version "\t" checksum "\t" filename + } + } + ' <<<"$package_index") + + [[ -n "$best_version" ]] || return 1 + + local expected_filename="pool/grok-bot/g/gr/grok-bot_${best_version}_${package_arch}.deb" + [[ "$best_filename" == "$expected_filename" ]] || { + echo "Unexpected Grok Bot package path for ${package_arch}: ${best_filename}" >&2 + return 1 + } + + printf '%s\t%s\n' "$best_version" "$best_checksum" +} + +for arch in x86_64 aarch64; do + index_url="${BASE_URL}/binary-${DEBIAN_ARCHES[$arch]}/Packages" + package_index="$(curl -fsSL --retry 3 "$index_url")" + package_index="${package_index//$'\r'/}" + + if ! release="$(newest_release "$package_index" "${DEBIAN_ARCHES[$arch]}")"; then + echo "No usable Grok Bot release found for ${arch} in ${index_url}" >&2 + exit 1 + fi + + IFS=$'\t' read -r version checksum <<<"$release" + VERSIONS[$arch]="$version" + CHECKSUMS[$arch]="$checksum" +done + +if [[ "${VERSIONS[x86_64]}" != "${VERSIONS[aarch64]}" ]]; then + echo "Grok Bot architectures are mid-release (${VERSIONS[x86_64]} vs ${VERSIONS[aarch64]}); skipping" >&2 + echo '{}' + exit 0 +fi + +jq -cn \ + --arg pkgver "${VERSIONS[x86_64]}" \ + --arg x86_64 "${CHECKSUMS[x86_64]}" \ + --arg aarch64 "${CHECKSUMS[aarch64]}" \ + '{pkgver: $pkgver, sha256sums: {x86_64: [$x86_64], aarch64: [$aarch64]}}' diff --git a/pkgbuilds/grok-bot/PKGBUILD b/pkgbuilds/grok-bot/PKGBUILD index bcc579799..ad238509e 100644 --- a/pkgbuilds/grok-bot/PKGBUILD +++ b/pkgbuilds/grok-bot/PKGBUILD @@ -2,9 +2,8 @@ # Contributor: Omarchy pkgname=grok-bot -pkgver=0.47.0 +pkgver=0.68.1 pkgrel=1 -_commit=c1e7d7a46549956d25f53e9c0b9f59666e03aa3a pkgdesc='Grok Bot desktop agent' arch=('x86_64' 'aarch64') url='https://x.ai/bot' @@ -35,15 +34,15 @@ source=( 'grok-bot.desktop' ) source_x86_64=( - "${_deb_x86_64}::https://downloads.cursor.com/grokbot/stable/${_commit}/linux/x64/${_deb_x86_64}" + "${_deb_x86_64}::https://downloads.cursor.com/aptrepo/pool/grok-bot/g/gr/${_deb_x86_64}" ) source_aarch64=( - "${_deb_aarch64}::https://downloads.cursor.com/grokbot/stable/${_commit}/linux/arm64/${_deb_aarch64}" + "${_deb_aarch64}::https://downloads.cursor.com/aptrepo/pool/grok-bot/g/gr/${_deb_aarch64}" ) sha256sums=('6dfa6c305941afa6cbaefbeaae06d05ab5a88f31630005d25a819a160c20c7a3' '3e2a2461ea58d17ac1777616be9ba660f7cb9ceefa9292016e36c55758bf78dd') -sha256sums_x86_64=('11ca0f51a535b97af51a352adf9c0f9ecd2e1b0430a69ae9451b688a7a065808') -sha256sums_aarch64=('836f8d19d3826c6573c31ac45c7a9b797abc73381ae0d2b1e7a8dae5410e7e46') +sha256sums_x86_64=('b2be8106d2b3eae07d983d5f1ca77b657accde666dc440db2a409421ecff3359') +sha256sums_aarch64=('3f85fbe2ba3c1d122aa16f8be672076bc19146e07e9d431f37a93b85fa75a93f') noextract=("${_deb_x86_64}" "${_deb_aarch64}") package() { diff --git a/pkgbuilds/grok-bot/update-pkgver.sh b/pkgbuilds/grok-bot/update-pkgver.sh deleted file mode 100755 index 40e9474e8..000000000 --- a/pkgbuilds/grok-bot/update-pkgver.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash -# Resolve current Grok Bot stable from Cursor's update feed and pin PKGBUILD. -# Linux has no latest alias (linux-x64 feed returns 204). The darwin-arm64 -# sand feed publishes version + commit; the Linux .deb lives at the same commit. -# Darwin can ship first — HEAD-check the Linux URL and fail loudly if 404. -set -euo pipefail - -PKGBUILD_PATH="${1:-PKGBUILD}" -[[ -f "${PKGBUILD_PATH}" ]] || { echo "Error: PKGBUILD not found at '${PKGBUILD_PATH}'" >&2; exit 1; } - -FEED='https://api2.cursor.sh/updates/api/update/darwin-arm64/sand/0.0.0/00000000-0000-0000-0000-000000000000/stable' -json="$(curl -fsSL -H 'cache-control: no-cache' "${FEED}")" - -ver="$(jq -er '.name // .version' <<<"${json}")" -feed_url="$(jq -er '.url' <<<"${json}")" -commit="$(sed -nE 's@.*/(grokbot|sand)/stable/([0-9a-f]{40})/.*@\2@p' <<<"${feed_url}")" - -[[ -n "${ver}" && -n "${commit}" ]] || { - echo "Error: could not parse version/commit from feed: ${json}" >&2 - exit 1 -} - -deb_url="https://downloads.cursor.com/grokbot/stable/${commit}/linux/x64/Grok_Bot_${ver}.deb" -code="$(curl -fsSIL -o /dev/null -w '%{http_code}' "${deb_url}")" -[[ "${code}" == "200" ]] || { - echo "Error: Linux deb not fetchable (${code}): ${deb_url}" >&2 - exit 1 -} - -tmp="$(mktemp)" -trap 'rm -f "${tmp}"' EXIT -curl -fL --retry 3 -o "${tmp}" "${deb_url}" -sum="$(sha256sum "${tmp}" | awk '{print $1}')" - -current_ver="$(sed -nE 's/^pkgver=([^[:space:]#]+).*/\1/p' "${PKGBUILD_PATH}" | head -n1)" - -sed -i -E \ - -e "s/^_commit=.*/_commit=${commit}/" \ - -e "s/^pkgver=.*/pkgver=${ver}/" \ - -e "0,/^[[:space:]]*'[0-9a-f]{64}'/s// '${sum}'/" \ - "${PKGBUILD_PATH}" - -if [[ "${ver}" != "${current_ver}" ]]; then - sed -i -E 's/^pkgrel=.*/pkgrel=1/' "${PKGBUILD_PATH}" -fi - -echo "${ver} ${commit}" -echo "${deb_url}" -echo "${sum}"