Add AUR as version check / cache invalidation source

This commit is contained in:
Peter Cai 2024-04-27 15:06:07 -04:00
parent b7b5a61286
commit a05fb1ecd9
2 changed files with 7 additions and 0 deletions

View file

@ -17,6 +17,9 @@ extra_args=""
if [ ! -z "${INVALIDATE_CACHE_UPSTREAM_ARCHLINUX+x}" ]; then
log "Fetching upstream package version from Arch Linux"
upstream_ver="$(get_archlinux_pkg_ver "$INVALIDATE_CACHE_UPSTREAM_ARCHLINUX")"
elif [ ! -z "${INVALIDATE_CACHE_UPSTREAM_AUR+x}" ]; then
log "Fetching upstream package version from AUR"
upstream_ver="$(get_aur_pkg_ver "$INVALIDATE_CACHE_UPSTREAM_AUR")"
elif [ ! -z "${INVALIDATE_CACHE_UPSTREAM_UBUNTU+x}" ]; then
log "Fetching upstream package version from Ubuntu (Launchpad)"
upstream_ver="$(get_ubuntu_pkg_ver "$INVALIDATE_CACHE_UPSTREAM_UBUNTU")"

View file

@ -126,6 +126,10 @@ get_archlinux_pkg_ver() {
curl https://archlinux.org/packages/$1/json/ 2>/dev/null | jq -r '. | .pkgver + "-" + .pkgrel'
}
get_aur_pkg_ver() {
curl "https://aur.archlinux.org/rpc/v5/info?arg[]=$1" 2>/dev/null | jq -r '.results[0].Version'
}
# Note: this does not specify which version of Ubuntu to use, because we don't actually care
# this version can and will only used to invalidate Docker cache, and we only need a vague
# idea of whether this package has been updated upstream.