fix(ci): refresh the apt index before uvr installs system dependencies

uvr v0.4.5 runs `apt-get install` for every resolved system dependency without
refreshing the package index first, and the ubuntu build images end their apt
layers with `rm -rf /var/lib/apt/lists/*`. With no index apt cannot resolve a
package that exists and is enabled, so `igraph needs: libglpk-dev` fails with
`E: Unable to locate package libglpk-dev` on ubuntu 26.04, taking every package
depending on igraph with it.

Refresh in `uvr-install.sh` rather than per pipeline: every build pipeline
reaches it, directly or through `install-bincraft.R`, and the index it
populates persists for the bincraft-driven syncs later in the same step.

Guard on apt-get and keep it non-fatal. `apk add` fetches its index implicitly
and dnf refreshes expired metadata on its own, so alpine and redhat need
nothing here.

Stopgap: build-env-images#23 fixes this in the image, but only reaches CI once
an image rebuild is triggered.
This commit is contained in:
Patrick Schratz 2026-08-10 06:26:23 +00:00
commit c3004db22a
No known key found for this signature in database
GPG key ID: 62050D5BC68AB6DC

View file

@ -87,4 +87,23 @@ cd "$project_dir"
# --no-install: resolve and lock only. The install happens in the sync below,
# which is the only command that honours --library.
"$uvr_bin" add --no-install "$@"
# TEMPORARY (drop once the images ship a uvr above v0.4.5): the sync below runs
# `apt-get install` for every resolved system dependency without refreshing the
# index first, and the ubuntu build images end their apt layers with
# `rm -rf /var/lib/apt/lists/*`. With no index apt cannot resolve a package that
# exists and is enabled, so `igraph needs: libglpk-dev` fails the whole build
# with `E: Unable to locate package libglpk-dev` on ubuntu 26.04.
#
# Fixed upstream in `e491b2e`, tagged one day after v0.4.5 (nbafrank/uvr#250),
# and the images pick it up via build-env-images#23 — but only after an image
# rebuild is triggered, which is why this runs here too.
#
# apt only: `apk add` fetches its index implicitly and dnf refreshes expired
# metadata on its own. Non-fatal, since a refresh failure still leaves whatever
# index is already there, and the install's own error is the more actionable one.
if command -v apt-get >/dev/null 2>&1; then
apt-get update -qq || echo "warning: apt-get update failed; continuing" >&2
fi
"$uvr_bin" sync --library "$target_lib" --install-system-deps