diff --git a/test/upgrade-test b/test/upgrade-test index 729127e..b25360c 100755 --- a/test/upgrade-test +++ b/test/upgrade-test @@ -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"