From 7747f583b837029c326317aff531b46a583e0ed4 Mon Sep 17 00:00:00 2001 From: Philipp Micheel <39773919+bbx0@users.noreply.github.com> Date: Sun, 1 Dec 2024 17:29:10 +0100 Subject: [PATCH] Try `aur srcver` with and without `--no-prepare` (#103) --- lib/aurto/sync-devel | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/aurto/sync-devel b/lib/aurto/sync-devel index 686591e..eb499ea 100644 --- a/lib/aurto/sync-devel +++ b/lib/aurto/sync-devel @@ -46,10 +46,31 @@ while IFS=: read -r mode rev_old rev path; do esac done <"$tmp"/fetch_results +# Probe `aur srcver` with and without the `--no-prepare` option. +# - A `prepare()` function can fail without its `makedepends`. +# (These are not available.) +# - Typically `prepare()` is not required to run `pkgver()`. +# +# Usage: srcver +srcver() { + local srcver=() + for pkg in "${@}"; do + local ver="" + if ! ver=$( + set +e + aur srcver --no-prepare "${pkg}" 2>/dev/null + ); then + ver=$(aur srcver "${pkg}") + fi + srcver+=("${ver}") + done + echo "${srcver[@]}" +} + # Update `epoch:pkgver-pkgrel` for each target with `aur-srcver`. # This runs `makepkg`, cloning upstream to the latest revision. The # output is then compared with the contents of the local repository. -aur vercmp -p <(aur srcver "${targets[@]}") <"$tmp"/db | awk '{print $1}' >"$tmp"/ood +aur vercmp -p <(srcver "${targets[@]}") <"$tmp"/db | awk '{print $1}' >"$tmp"/ood if [[ -s $tmp/ood ]]; then aur build -a "$tmp"/ood "${build_args[@]}"