Upgrade test: a channel that cannot be asked is a failure of its own

The question to the channel had no time limit, and a download that
failed gave an empty answer, which the test read as nothing on offer. A
server that held the connection open could keep the test until the job's
limit, and one that was down made it report "Nothing to upgrade to".

The request now has a deadline, a failure anywhere in it counts, and the
test stops with its own message and the last lines of what went wrong.
This commit is contained in:
Emir Beganovic committed 2026-10-10 00:57:46 +02:00
1 parent 40c5fb8e98
commit 3e21939b9e
1 file changed
+17 -5
+17 -5
View File
@@ -152,15 +152,27 @@ done
# no upgrade. Say so now: the release's own updater, run with nothing to do,
# ends at a prompt nobody is there to answer.
case $channel in edge) package=omarchy-dev ;; *) package=omarchy ;; esac
offered=$(guest "curl -fsSL --retry 3 https://pkgs.omarchy.org/$channel/\$(uname -m)/omarchy.db | bsdtar -xOf - '$package-[0-9]*/desc' | sed -n '/^%VERSION%\$/{n;p;}'" 2>/dev/null | head -n 1)
# A server that cannot be reached, or does not answer in time, is not a channel
# with nothing on offer: that is a failure of its own, said as one.
if ! offered=$(guest "set -o pipefail; curl -fsSL --connect-timeout 20 --max-time 120 --retry 2 https://pkgs.omarchy.org/$channel/\$(uname -m)/omarchy.db | bsdtar -xOf - '$package-[0-9]*/desc' | sed -n '/^%VERSION%\$/{n;p;}' | head -n 1" 2>"$out/probe.log") || [[ -z $offered ]]; then
{
echo "**The $channel channel could not be asked what it offers.** The test did not run."
echo
echo '```'
tail -n 5 "$out/probe.log"
echo '```'
} >"$out/report.md"
cat "$out/report.md"
exit 1
fi
installed=$(guest "pacman -Q $package 2>/dev/null | cut -d' ' -f2" 2>/dev/null)
log "The $channel channel offers $package ${offered:-nothing}; installed: ${installed:-none}"
log "The $channel channel offers $package $offered; installed: ${installed:-none}"
# pacman's own ordering: 0 for the same version, below 0 for an older offer.
newer=1
[[ -z $installed ]] || newer=$(guest "vercmp $(printf %q "${offered:-0}") $(printf %q "$installed")" 2>/dev/null)
if [[ -z $offered ]] || (( ${newer:-0} <= 0 )); then
[[ -z $installed ]] || newer=$(guest "vercmp $(printf %q "$offered") $(printf %q "$installed")" 2>/dev/null)
if (( ${newer:-0} <= 0 )); then
{
echo "**Nothing to upgrade to.** The $channel channel offers \`$package ${offered:-nothing}\`, and the machine has \`$(fact "$out/before.txt" omarchy)\`."
echo "**Nothing to upgrade to.** The $channel channel offers \`$package $offered\`, and the machine has \`$(fact "$out/before.txt" omarchy)\`."
echo
echo "The test did not run: point it at a channel that holds a newer Omarchy."
} >"$out/report.md"